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

UART Framing error / communication error on nrf52820

HI  DEV

Currently we found a UART Frame error on customer product:

Application scenario diagram

Figure1 

nrf52820 ,SDK17.02, softdevice:S132 , gap event length=6*1.25ms =7.5ms

Issue description:

When user production working on above scenario, sometime the uarte RX will miss some data.

The detail could be show as below. And after debugging we found it will have uarte communication error / frame error.

Picture1 red highlight part is the correct data

Picture2 the red highlight part shows error data

For picture1 correct data like below :

68 1C 00 C3 05 08 93 33 00 00 00 00 22 A3 85 01 DC 20 00 02 01 01 12 08 B3 00 00 D5 BE 16

For picture2 error data like below :

68 1C 00 C3 05 08 93 33 00 00 00 00 22 A3 85 01 E3 20 00 02 01 01 12 08 82 00 00 missing byte1 missing byte2 16

What we did:

  1. We have change the UARTE to libuarte, but this issue still happen.
  2. The project only have BLE, RTC and UARTE, we set the uarte interrupt as the highest priority but the issue still happen.
  3. We try to set stop bits as one stop bits & two stop bits, the issue still happen.

4. we use other uart module to  test the uart communication, there is no issue happen. when change back to nrf52820 and working on figure1 status the issue is happen.

Picture3

What we suspect:

1. since uarte and BLE both will use the hfclk, and the this issue only happen will 5 BLE connection(see figure 1).do we have some specical ceritaria for using function "sd_clock_hfclk_request()" ?

    is it ok for below sequence to call function sd_clock_hfclk_request() ?

Picture4 Com_Init(): the uarte init , BLE_Init: ble stack init

Our question :

 1. uart event error handler 

we try to add the bleow code in UART error handler , but the issue still happen.

 we want to know,  when the error handler capture the APP_UART_COMMUNICATION_ERROR, does it means uarte RX data is incorrect?

  

Picture5 

BR

  • Hi,

    We have change the UARTE to libuarte, but this issue still happen.

     The code snippets you posted shows that you're calling the UARTE driver APIs directly, not libuarte. Is that the old code?

    The project only have BLE, RTC and UARTE, we set the uarte interrupt as the highest priority but the issue still happen.

     I would rather recommend that you increase the DMA buffers to offload the CPU more.

    1. since uarte and BLE both will use the hfclk, and the this issue only happen will 5 BLE connection(see figure 1).do we have some specical ceritaria for using function "sd_clock_hfclk_request()" ?

     Calling sd_clock_hflck_request() after ble_stack_init() is sufficient. This will make the SD keep the HFXO always on.

     1. uart event error handler 

    we try to add the bleow code in UART error handler , but the issue still happen.

     we want to know,  when the error handler capture the APP_UART_COMMUNICATION_ERROR, does it means uarte RX data is incorrect?

     Yes, APP_UART_COMMUNICATION_ERROR effectively means you recived a corrupted packet and that it is dropped/lost.

    Best regards,

    Vidar

  • Hi Berg

    Thanks for your reply.

    we will try your suggestion.

    Just a quick question at here.

    do we have any setting to ignore or "turn off" the APP_UART_COMMUNICATION_ERROR handler?

    for example, after we "turn off" APP_UART_COMMUNICATION_ERROR handler, if the uarte received a corrupted packet, the uarte still can go to "NRF_DRV_UART_EVT_RX_DONE" then put the receive data into fifo.

  • Hi,

    I recommend you use the Libuarte - advanced UARTE driver instead of the app uart library. The app uart library doesn't support large DMA buffers (only supports 1 byte) and it can be difficult to prevent data loss unless you include HW flow control.

    for example, after we "turn off" APP_UART_COMMUNICATION_ERROR handler, if the uarte received a corrupted packet, the uarte still can go to "NRF_DRV_UART_EVT_RX_DONE" then put the receive data into fifo.

    Yes, but APP_UART_COMMUNICATION_ERROR means you have lost a packet due to an UARTE error condition.

Related