This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

BUG: Lost/bad data between app_uart_close and app_uart_init

I have a setup where I will be switching the nRF51822 UART between two different peripherals (one being a connection to another nRF51822), so I need to be able to safely close, switch, and reopen without losing data.

app_uart_close triggers the STOPTX and STOPRX tasks as it should, but it doesn't wait for the receive timeout (RXTO) event before immediately disabling the UART. In my test (full duplex transfer of a stream continuously incremented bytes with periodic close/reopen from one side), this results in a lost byte on the chip closing/reopening and garbled data (e.g., an unexpected 0xfe byte) on the other side. Both chips are using APP_UART_FLOW_CONTROL_ENABLED and have RTS/CTS set up correctly.

Parents
  • I have fixed this issue with changes to app_uart; see attached files/patches (against SDK 6.0.0 but 6.1.0 has no conflicting changes). An APP_UART_CLOSE event is added in case it's important to catch when the UART is actually disabled after the RXTO event.

    This fixes my test with the full-duplex incrementing byte sequence, i.e., no bytes are lost/garbled between one side closing/waiting/reopening the UART any more.

    (If Nordic wishes to uses these changes I give whatever permission is needed for them to be incorporated into the SDK.)

Reply
  • I have fixed this issue with changes to app_uart; see attached files/patches (against SDK 6.0.0 but 6.1.0 has no conflicting changes). An APP_UART_CLOSE event is added in case it's important to catch when the UART is actually disabled after the RXTO event.

    This fixes my test with the full-duplex incrementing byte sequence, i.e., no bytes are lost/garbled between one side closing/waiting/reopening the UART any more.

    (If Nordic wishes to uses these changes I give whatever permission is needed for them to be incorporated into the SDK.)

Children
Related