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

APP_UART_COMMUNICATION_ERROR, NRF_UART0->ERRORSRC value of 2

I'm using the UART to talk to a GSM modem. It has hardware flow control and supports a baud rate of 115200. I'm using app_uart_fifo.c, not app_uart.c. I'm using the SoftDevice and have it enabled before starting the UART comms.

I'm seeing frequent UART errors, where the event handler is called with event type APP_UART_COMMUNICATION_ERROR. Debugging in the UART0_IRQHandler(), I see that NRF_UART0->ERRORSRC is 2. Here are the defines for parsing the error from brf51_bitfields.h:

/* Bit 3 : The serial data input is '0' for longer than the length of a data frame. */
#define UART_ERRORSRC_BREAK_Pos (3UL) /*!< Position of BREAK field. */
#define UART_ERRORSRC_BREAK_Msk (0x1UL << UART_ERRORSRC_BREAK_Pos) /*!< Bit mask of BREAK field. */
#define UART_ERRORSRC_BREAK_NotPresent (0UL) /*!< Error not present. */
#define UART_ERRORSRC_BREAK_Present (1UL) /*!< Error present. */
#define UART_ERRORSRC_BREAK_Clear (1UL) /*!< Clear error on write. */

/* Bit 2 : A valid stop bit is not detected on the serial data input after all bits in a character have been received. */
#define UART_ERRORSRC_FRAMING_Pos (2UL) /*!< Position of FRAMING field. */
#define UART_ERRORSRC_FRAMING_Msk (0x1UL << UART_ERRORSRC_FRAMING_Pos) /*!< Bit mask of FRAMING field. */
#define UART_ERRORSRC_FRAMING_NotPresent (0UL) /*!< Error not present. */
#define UART_ERRORSRC_FRAMING_Present (1UL) /*!< Error present. */
#define UART_ERRORSRC_FRAMING_Clear (1UL) /*!< Clear error on write. */

/* Bit 1 : A character with bad parity is received. Only checked if HW parity control is enabled. */
#define UART_ERRORSRC_PARITY_Pos (1UL) /*!< Position of PARITY field. */
#define UART_ERRORSRC_PARITY_Msk (0x1UL << UART_ERRORSRC_PARITY_Pos) /*!< Bit mask of PARITY field. */
#define UART_ERRORSRC_PARITY_NotPresent (0UL) /*!< Error not present. */
#define UART_ERRORSRC_PARITY_Present (1UL) /*!< Error present. */
#define UART_ERRORSRC_PARITY_Clear (1UL) /*!< Clear error on write. */

/* Bit 0 : A start bit is received while the previous data still lies in RXD. (Data loss). */
#define UART_ERRORSRC_OVERRUN_Pos (0UL) /*!< Position of OVERRUN field. */
#define UART_ERRORSRC_OVERRUN_Msk (0x1UL << UART_ERRORSRC_OVERRUN_Pos) /*!< Bit mask of OVERRUN field. */
#define UART_ERRORSRC_OVERRUN_NotPresent (0UL) /*!< Error not present. */
#define UART_ERRORSRC_OVERRUN_Present (1UL) /*!< Error present. */
#define UART_ERRORSRC_OVERRUN_Clear (1UL) /*!< Clear error on write. */

Does a value of 2 therefore mean I have a parity error? What do I then do about that?

See also this thread on the subject. If that's relevant for this error, I'm not sure how to get the UART to use the larger buffer.

devzone.nordicsemi.com/.../what-to-do-with-app_uart_communication_error

Related