Can not using debug (NRF_LOG_INFO) when using reading large data via UARTE

Hi,
I'm developing an application using UARTE to reading response from Module Sim. The content response from Module Sim has 495 characters.
When I debug, I only read some information I logged before and after that Segger will be crashed
Here is my uarte init

NRF_LIBUARTE_ASYNC_DEFINE(libuarte1, 0, 1, 2, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 1000, 3);
// using app timer for this uarte
NRF_LIBUARTE_ASYNC_DEFINE(libuarte2, 1, 2, NRF_LIBUARTE_PERIPHERAL_NOT_USED, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 1000, 3);



static void uarte1_init(void) {
uint32_t err_code;
nrf_libuarte_async_config_t nrf_libuarte_async_config = {
.tx_pin = TX_PIN_NUMBER1,
.rx_pin = RX_PIN_NUMBER1,
.baudrate = NRF_UARTE_BAUDRATE_115200,
.parity = NRF_UARTE_PARITY_EXCLUDED,
.hwfc = NRF_UARTE_HWFC_DISABLED,
.timeout_us = 100,
.int_prio = APP_IRQ_PRIORITY_LOW_MID};

err_code = nrf_libuarte_async_init(&libuarte1, &nrf_libuarte_async_config, uart_event_handler_1, (void *)&libuarte1);
APP_ERROR_CHECK(err_code);
nrf_libuarte_async_enable(&libuarte1);
}



static void uarte2_init(void) {
uint32_t err_code;
nrf_libuarte_async_config_t nrf_libuarte_async_config2 = {
.tx_pin = TX_PIN_NUMBER2,
.rx_pin = RX_PIN_NUMBER2,
.baudrate = NRF_UARTE_BAUDRATE_115200,
.parity = NRF_UARTE_PARITY_EXCLUDED,
.hwfc = NRF_UARTE_HWFC_DISABLED,
.timeout_us = 100,
.int_prio = APP_IRQ_PRIORITY_LOW_MID};

err_code = nrf_libuarte_async_init(&libuarte2, &nrf_libuarte_async_config2, uart_event_handler_2, (void *)&libuarte2);
APP_ERROR_CHECK(err_code);
nrf_libuarte_async_enable(&libuarte2);
}

 

Parents
  • Not sure what you mean "Segger will be crashed"?
    Is it a hardfault or just hung without doing anything? 

    Have you started your application in debugger mode and run it for a while, pause and see what context of code the chip is executing?

  • Hi, I'm using 2 libuartes to communicate with module sim and gps
    I'm using debug (NRF_LOG_INFO) to log contents I want to show. Debug Terminal showed correctly the content but for a while it stop at random line I used NRF_LOG_INFO and do nothing.
    For example I have an piece of code (I suppose it's easy to understand, because my code is quite complicated.)

    int main(){
    NRF_LOG_INFO("init example");
    for(;;){
    NRF_LOG_INFO("data from sim");
    NRF_LOG_INFO("data from GPS");
    }
    }
    
    



    Here is my debug terminal
    init example
    data from sim
    data from GPS
    
    data from sim
    data from GPS
    
    data from sim
    data from GPS
    
    data from sim
    data from GPS
    
    data from sim


    As usual, it will have to continue to print. "data from GPS", but It stop at "data from sim" and do nothing.
    I use uart terminal as well (Hercules) and my data is still send and receive, but my debug terminal stop show like at initialize steps after reset

    This issue occurs when my nRF use libuarte1 to receive file http response from module sim (475 characters).

    My debug terminal is still running but nothing else occur,

  • It looks like either (1) deadlock somewhere in the code or (2) the libuarte has not responded correctly to the incoming data

    (1) For deadlock debugging

    Can you start your application in debugger mode and start the debugger and run your application.

    Once you reach to a point where nothing happens, pause the debugger and see which instruction is being executed and the context of it. 

    (2) For checking if the data arrived but the driver misbehaved

    Connect the UART pins to an analyzer like logic analyzer and make sure that the data (475 characters or part of it) actually came from the module sim. You can check this in the logic analyzer. If it did arrive from the sim then there is something wrong in the handling of incoming data. 

    Check if the application is handling errors properly from libuarte or other devices.


  • Here is my debug terminal when it stuck. I'm new at debug so I can not read register yet. 

Reply Children
Related