I read here...
NRF52840_PS_v1.1.pdf
Peripherals > UART (6.33.7)
“An ERROR event, in the form of a framing error, will be generated if a valid stop bit is not detected in a frame. Another ERROR event, in the form of a break condition, will be generated if the RXD line is held active low for longer than the length of a data frame. Effectively, a framing error is always generated before a break condition occurs”
When these ERROR events get passed up to the serial event handler, every error looks like NRF_SERIAL_EVENT_DRV_ERR. I would like to be able to identify the specific kind of UART error that is happening --- i.e., Is a stop bit missing, or has RXD been held low for longer than 1 data frame?
I would also like to know:
- Are there other types of framing errors besides missing stop bit? Other types of break conditions besides RXD being held low?
- Do both Tx and Rx errors get sent to NRF_SERIAL_EVENT_DRV_ERR? What kind of Tx errors are there?
- Once I intentionally held the RXD line low forever, and I got 2 NRF_SERIAL_EVENT_DRV_ERR, then no more errors, even though the RXD line was still being held low. Is this expected behavior? Other times, I get a flood of NRF_SERIAL_EVENT_DRV_ERR, and I don't know what is causing it.
--------------------
One thing I tried, following the instruction here (https://devzone.nordicsemi.com/f/nordic-q-a/37270/nrf_serial_event_rx_data-never-triggered):
was I set a debug break point and found:
p_event->data.error.error_mask = 0x00000004
But in nrf_uart.h
error_mask value 0x04 doesn't seem to exist. What does this error mask correspond to? In general, how can I find out what error is associated with a given error mask?
typedef enum
{
NRF_UART_ERROR_OVERRUN_MASK = UART_ERRORSRC_OVERRUN_Msk, /**< Overrun error. */
NRF_UART_ERROR_PARITY_MASK = UART_ERRORSRC_PARITY_Msk, /**< Parity error. */
NRF_UART_ERROR_FRAMING_MASK = UART_ERRORSRC_FRAMING_Msk, /**< Framing error. */
NRF_UART_ERROR_BREAK_MASK = UART_ERRORSRC_BREAK_Msk, /**< Break error. */
} nrf_uart_error_mask_t;
--------------------
Generally, I would like to know all the different things that trigger NRF_SERIAL_EVENT_DRV_ERR,
because I am getting a lot of these errors and I would like to figure out the specific source of these errors in order to troubleshoot them.