Hello,
my application requires a reliable break detection (The serial data input is '0' for longer than the length of a data
frame) sent from a peer device on the UART RxD line.
I use the SDK15.3.0 and expanded the code in nrf_serial.c/h so that I get the error condition (overrun, parity, framing, break) in the uart_rxd_event_handler.
But I never get the break condition, only a few framing error conditions in series. I checked the run-time behavior with a debugger. Setting a breakpoint directly at the beginning of the isr "uarte_irq_handler", and after sending the break condition with the peer device, I can see that both bits, break and framing, in the ERRORSRC register are set.
Then I removed the resetting (p_reg->ERRORSRC = errsrc_mask) of the bits in the ERRORSRC register in the function "nrf_uarte_errorsrc_get_and_clear". I also removed the breakpoint in the debugger at the beginning of the isr. After a reboot and sending the break condition with the peer device, both bits (break and framing) should be set in the ERRORSRC register. I stopped the debugger anywhere and checked the ERRORSRC register. Only the framing bit is set in the ERRORSRC register.
Then I removed additioniallly the reading (errsrc_masK = p_reg->ERRORSRC) of the ERRORSRC register in the function "nrf_uarte_errorsrc_get_and_clear". After a reboot and sending the break condition with the peer device, I stopped the debugger anywhere and checked the ERRORSRC register. Now both bits, break and the framing bits are set in the ERRORSRC register.
I read somewhere, that first a framing error is detected and afterwards a break condition is detected when a break condition is received from a peer device. All above means, that the framing interrupt with the following reading of the ERRORSRC register prevents the setting of the break bit in the ERRORSRC register.
Could you please verify my result and instruct me how to handle a reliable break detection?!?!