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

UART Overrun Error after Reset

Hi all,

I see there are similar questions posted on this forum, but none answers my question satisfactorily.

What I have:

  • we use the nRF52 we use UART0 to
  • transmit / receive data (totally
  • straight forward circuit) we use the nrf_drv_uart driver plus our own event handler, as per Nordic example

What I experience:

  • with the Softdevice S132 disabled, data transmission / reception works flawlessly
  • with the S132 enabled, we experience more than not that UART0 is unable to receive data. Instead, overruns are reported (event->data.error.error_mask = 0x00000001)
  • if the nRF52 starts up without overrun error, Tx / Rx works fine
  • once I see overrun errors reported, I need to reset the device a couple of times before I get Tx / Rx back again.

What is your suggestion?

Thank you for your help M

Parents
  • This can happen if you disable hardware flow control on one or both sides. The softdevice can reserve CPU when there is BLE activity and when the peer side is transmitting data in UART fast while the RX buffer overflow then there will be overrun errors. Enable hardware flow control so that the other side stops transmitting uart data when the DUT have RX buffer filled.

    If the data loss is not a big problem then you can clear this error in uart irq handler so that the uart driver continues working as normal.

  • Hi Aryan, thank you for your quick reply. I do understand what you are saying, but... ... if, after reset, the UART starts off without overruns I will NEVER get an overrun ... if, after reset, the UART starts WITH overruns, the nRF will never recover from this and I literally get millions of overruns. How do I recover from this situation?

    Here is part of my code:

    else if (event->type == NRF_DRV_UART_EVT_RX_DONE)
    {
        ...
        ....
    }
    else if (event->type == NRF_DRV_UART_EVT_ERROR)
    {
        mUartErrors++;
        mUartErrorMask = event->data.error.error_mask;
    
        nrf_drv_uart_rx (&mUart, &mRecvByte, 1);        /* Receive next byte */
    }
    

    In the present case. mUartErrorMask is set to 1.

    Thank you for your reply

Reply
  • Hi Aryan, thank you for your quick reply. I do understand what you are saying, but... ... if, after reset, the UART starts off without overruns I will NEVER get an overrun ... if, after reset, the UART starts WITH overruns, the nRF will never recover from this and I literally get millions of overruns. How do I recover from this situation?

    Here is part of my code:

    else if (event->type == NRF_DRV_UART_EVT_RX_DONE)
    {
        ...
        ....
    }
    else if (event->type == NRF_DRV_UART_EVT_ERROR)
    {
        mUartErrors++;
        mUartErrorMask = event->data.error.error_mask;
    
        nrf_drv_uart_rx (&mUart, &mRecvByte, 1);        /* Receive next byte */
    }
    

    In the present case. mUartErrorMask is set to 1.

    Thank you for your reply

Children
No Data
Related