This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

libuarte with softdevice (ble_app_beacon ) giving fatal error in execution time.

Hello, 

I want to use libuarte - advanced UARTE driver in our current application developed for nRF52832 with SDK 17.0.2.

My aim is to merge example libuarte and ble_app_beacon .

Because in my application I am receiving 48bytes of sensor data from uart and want to beaconing 4 bytes of data by processing those datas.

Given that fact that SoftDevice requires RTC0 and Timer0 and app_timer library consumes RTC1, I used RTC2 and Timer2 for libuarte implementation:

NRF_LIBUARTE_ASYNC_DEFINE(libuarte, 0, 2, 2, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3);

I followed this ticket  https://devzone.nordicsemi.com/f/nordic-q-a/41215/general-libuarte-questions  and my project successfully built but problem comes in execution time .

After receiving some bytes program goes to in fatal error . I can't find out what is the issue ?

Here is snippet of my libuarte code .

void uart_event_handler(void * context, nrf_libuarte_async_evt_t * p_evt)
{
    nrf_libuarte_async_t * p_libuarte = (nrf_libuarte_async_t *)context;

    
    ret_code_t ret;

    switch (p_evt->type)
    {
        case NRF_LIBUARTE_ASYNC_EVT_ERROR:
            bsp_board_led_invert(0);
            break;
        case NRF_LIBUARTE_ASYNC_EVT_RX_DATA:
            
            memcpy(rx_buffer,p_evt->data.rxtx.p_data,p_evt->data.rxtx.length);
            
            nrf_libuarte_async_rx_free(p_libuarte, p_evt->data.rxtx.p_data, p_evt->data.rxtx.length);
            
            break;
        
        default:
            break;
    }
}


void uart_init()
{
 uint32_t err_code;
 nrf_libuarte_async_config_t nrf_libuarte_async_config = {
            .tx_pin     = TX_PIN_NUMBER,
            .rx_pin     = RX_PIN_NUMBER,
            .baudrate   = NRF_UARTE_BAUDRATE_19200,
            .parity     = NRF_UARTE_PARITY_EXCLUDED,
            .hwfc       = NRF_UARTE_HWFC_DISABLED,
            .timeout_us = 100,
            .int_prio   = APP_IRQ_PRIORITY_LOW
    };

    err_code = nrf_libuarte_async_init(&libuarte, &nrf_libuarte_async_config, uart_event_handler, (void *)&libuarte);

    APP_ERROR_CHECK(err_code);

    nrf_libuarte_async_enable(&libuarte);
}

Thanks in advance for your time and efforts.

Ram

  • Have you set NRFX_RTC2_ENABLED and NRFX_TIMER2_ENABLED to 1 in your sdk_config.h?

  • Hello Narek,

                      Yes obviously and disable legacy RTC2_ENABLED and TIMER2_ENABLED.

                      You can check the my code below.

                      

    // <q> NRFX_RTC2_ENABLED  - Enable RTC2 instance
    
    #ifndef NRFX_RTC2_ENABLED
    #define NRFX_RTC2_ENABLED 1
    #endif
    
    // <q> NRFX_TIMER2_ENABLED  - Enable TIMER2 instance
     
    
    #ifndef NRFX_TIMER2_ENABLED
    #define NRFX_TIMER2_ENABLED 1
    #endif

                      If  NRFX_RTC2_ENABLED  and NRFX_TIMER2_ENABLED not set to 1 ,then it will give error in compilation .

                      My compilation successfully done , but problem arises in the time of running .

                      memcpy(rx_buffer,p_evt->data.rxtx.p_data,p_evt->data.rxtx.length); gives me 

                      109,26556,0,3179,0,164,-5263,0,7646,9947,2,12345678 these value where 12 parameters is there with 11                      "," . I want to clear rx_buffer[] array when 12 parameters received and I tried with       memset(rx_buffer,0,sizeof(rx_buffer));  without success

    Thanks 

    Ram

  • Hi,

    If you build the application in debug configuration (with the DEBUG preprocessor symbol set), you should get the actual error code, along with the file name and line number output on the log.

    This will make it easier to help you determine the cause of the issue.

    You can find an existing example of using libUARTE together with BLE in this post, for reference.

    Best regards,
    Jørgen

Related