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

UART FIFO Missing bytes when BLE transmission is going on

Hello, 

I am using Nordic nRF52840 (nRF5SDK v16.0.0) and softdevice : s140.

Nordic MCU is connected to Host MCU over UART interface (baudrate = 115200). I have below observation:

When we send byte stream from Host MCU to Nordic and Nordic is transmitting over Bluetooth, then sometime UART Rx fifo misses one byte in reception.

Does anyone knows about this behavior ?

I tried sending 6 uart packets (each of 178 bytes) back to back over uart and same packet is being transmitted over Bluetooth using the UART test code.


} while (err_code == NRF_ERROR_RESOURCES);

code snippet from void uart_event_handle(app_uart_evt_t * p_event)
                      uint16_t length = (uint16_t)(index-4);// removing datalen (starting2 bytes [0] [1]) + cmdID([2])  and  '\n'(EOF) from the data which is being sent over BLE
                      err_code = ble_nus_data_send(&m_nus, &data_array[3], &length, m_conn_handle);
                      if ((err_code != NRF_ERROR_INVALID_STATE) &&
                          (err_code != NRF_ERROR_RESOURCES) &&
                            (err_code != NRF_ERROR_NOT_FOUND))
                      {
                        // APP_ERROR_CHECK(err_code);
                      }
                    } while (err_code == NRF_ERROR_RESOURCES);
                    

  • Hello Susheel, 

    I just observed that at times i do get APP_UART_COMMUNICATION_ERROR. Since we already have hardware and we did not planned for RTS/CTS , so these hardware options are not there. 

    Any suggestion for APP_UART_COMMUNICATION_ERROR root cause ?

  • onishant82 said:
    I just observed that at times i do get APP_UART_COMMUNICATION_ERROR

     Yes, it means that you need to go and look into the p_event->data.error_communication and check it with ERRORSRC. Like i suspected on my first reply, this most likely could be OVERRUN error. This happens if you are receiving bytes faster than you could process it (very common on high baudrates and no flowcontrol setup). With overrun error, the data is lost as the hw buffers are overwritten before the application could pull it, so there is no recovery of lost bytes possible unless you develop a mechanism from the application to ask the peer to retransmit

Related