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

APP_UART_COMMUNICATION_ERROR without flow control

My application is using the FIFO UART module to communicate with another MCU. It is also running softdevice S132 v2.0.0.

While most of the time everything runs smoothly, I will occasionally receive a APP_UART_COMMUNICATION_ERROR with reason of overrun. Presumably, this is because the softdevce is jumping in at the same time as a data transfer is taking place.

Unfortunately, the MCU I am communicating with does not have a driver for flow control and I likely don't have time to write one either.

My question is: if I switch over to using the UARTE with EasyDMA, will this solve my problem or is flow control the only solution?

  • The way it works now is that app_uart_fifo uses nrf_drv_uart which uses either the UART (no DMA) or the UARTE (with DMA) peripheral depending on the UART_EASY_DMA_SUPPORT/UART_LEGACY_SUPPORT configuration. Even though UARTE uses DMA it only uses a RAM buffer of 1 byte, which means that when not using flow control bytes can be missed when switching from primary RAM buffer to secondary RAM buffer (if the application is interrupted). So there is no way to use the app_uart driver without the risk of losing bytes when using no flow control. This might be changed in the future, but I cannot guarantee anything.

    If you want to use uart without flow control and without the risk of losing bytes you have to write your own driver and configure the RAM buffer to be large enough to buffer the data. The problem then is that you only get notified when the buffer is full, see the figure here. This can be fixed by reading the buffer before it is full by regularly polling for data or configure GPIOTE and a timer to know when there has not been any activity on the bus for a while and then do a read.

  • Ole,

    Thank you for the clarification. I will convert that to the answer.

    In my case, we defined the UART packets to be explicitly defined length and format so that a checksum can be included since flow control was not in the cards. This makes EasyDMA ideal for us and knowing that I need to modify the drivers helps out tremendously.

Related