This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Problems with UART in 52840

I am using a code similar to App_uart_C from SDK17.02 - central sending data over uart to another peripheral.

After 30-60 sec, the operation stops probably due to an error in the UART and I need to reset the chip

How can I handle UART errors ? I don't mind loosing data - but I cannot stay with the software crashing

Thanks

Avi

  • I solved the problem by adding a delay of 4msec after each packet of 10bytes at 38K UART.

  • Hi,

    It does not sound like a very reliable way to resolve the issue with a delay, and this could also increase the current consumption of your device.

    If you can explain where the error occurs, and what the error is, I can help you find a better solution. If the chip "stops", it is most likely ending up in the error handler, because an error code was passed to APP_ERROR_CHECK() macro, and you have built the application in debug mode. You do not have to pass all error codes to this macro, it is fully up to you how you handle an error. For instance, if you get a NRF_ERROR_NO_MEM error from a call to app_uart_put(), you can filter this error and tell your application to retry the operation at a later point.

    Best regards,
    Jørgen

  • Indeed, after more testing, it was not a reliable solution.

    I am streaming data via the UART at 38K from external processor, and transmitting the data to another peripheral. 

    The reception is done via uart_event_handle which is forwarding the data arrays to ble_nus_c_string_send

    Since my circuit is part of a system (i.e. ext processor), I cannot use debugger and I cannot see the errors if exist.

    I will have to try "fixing" the code and check it on my system to see if it helps.

    I would appreciate any ideas

  • Have you considered adding HWFC pins to the UART in your application? If you are not able to process the FIFO fast enough, the incoming stream of data may overflow the UART, causing an error.

    You can try to remove the APP_ERROR_CHECK in APP_UART_FIFO_ERROR case in uart_event_handle(). This will ignore any OVERRUN/PARITY/FRAMING/BREAK errors from the UART peripheral, which may lead to data loss.

    case APP_UART_FIFO_ERROR:
        //APP_ERROR_HANDLER(p_event->data.error_code);
        break;

  • I cannot use the HWFC since my ext processor doesn't support it.

    I removed the //APP_ERROR_HANDLER(p_event->data.error_code);

    And still the transfer is stuck after few seconds (about 1000 lines of 15 chars each).

    The only way to recover is via hard reset

Related