UARTE Spurious Null Byte Received after NRF_UARTE_EVENT_ENDRX (buffer replacement)

Hi there,

I faced this issue while I was setting up a test through two UART0 & UART1 ports on NRF5340 chip, using baudrate 1000,000.

Here is the setup:

  • UART0 & UART1 & Kconfigs

CONFIG_UART_ASYNC_API=y
CONFIG_SERIAL=y
CONFIG_UART_NRFX=y

CONFIG_NRFX_UARTE=y
CONFIG_NRFX_UARTE0=y
CONFIG_NRFX_UARTE1=y
CONFIG_NRFX_TIMER2=y
CONFIG_NRFX_TIMER1=y
CONFIG_NRFX_TIMER=y
CONFIG_NRFX_PPI=y

CONFIG_UART_0_NRF_TX_BUFFER_SIZE=100
CONFIG_UART_0_ASYNC=y
CONFIG_UART_0_NRF_HW_ASYNC=y
CONFIG_UART_0_NRF_HW_ASYNC_TIMER=1

CONFIG_UART_1_NRF_TX_BUFFER_SIZE=100
CONFIG_UART_1_ASYNC=y
CONFIG_UART_1_NRF_HW_ASYNC=y
CONFIG_UART_1_NRF_HW_ASYNC_TIMER=2

&uart1 {
compatible = "nordic,nrf-uarte";
status = "okay";
current-speed = <1000000>;
tx-pin = <8>;
rx-pin = <9>;
rx-pull-up;
};

.baudrate = 1000000,
.data_bits = UART_CFG_DATA_BITS_8,
.flow_ctrl = UART_CFG_FLOW_CTRL_NONE,
.parity = UART_CFG_PARITY_NONE,
.stop_bits = UART_CFG_STOP_BITS_1

UART BUFFER SIZE = 1024

&uart0 {
compatible = "nordic,nrf-uarte";
status = "okay";
current-speed = <1000000>;
tx-pin = <29>;
rx-pin = <42>;
};

.baudrate = 1000000,
.data_bits = UART_CFG_DATA_BITS_8,
.flow_ctrl = UART_CFG_FLOW_CTRL_NONE,
.parity = UART_CFG_PARITY_NONE,
.stop_bits = UART_CFG_STOP_BITS_1

UART BUFFER SIZE = 1024

        I enabled hw byte counting to support high baudrate interaction. 

  • Test Scenario

        I send dummy message over uart0 port to nrf5340dk board, and it will be re-routed to uart1 port. Then uart1 side will send back respond message to uart0 side.

  • Issue symptom

       After I keep sending uart messages around 22 times, only uart2 port will be blocked. And it won't be able to interact with nrf5349dk board.

       From the log, I can see that after 1024 byte rx buffer is filled-up, endrx events are triggered for both uart0 & uart1 interfaces.

       Since I'm using HW_ASYNC_TIMER mode, rx_timeout in nordic sdk is kept triggering to polling the status of newly read bytes from RXD through DMA.

       As it deals with the second NRF_UARTE_EVENT_ENDRX for uart0, uart1 asynchorously detects spurious null byte from no where. 

  • Further tests
    • Increase RX Buffer could delay the issue timing. -> it's closed related to 1024 byte buffer size boundary.
    • Made use of logic analyzer. Null byte is not observed in the signal tracing.
    • The next good frame 0x12 0x.. 0x.. 0x12 will overwrite the position of null byte (0x00) in the buffer. -> suspect rx_timeout was triggered wrongly and 

  hw timer logs extra byte for the spurious null byte.

 

Might be something wrong with my configuration? Please help advise. thanks

Parents
  • Hello,

    I'l take a closer look at this tomorrow/Thursday.

    I send dummy message over uart0 port to nrf5340dk board, and it will be re-routed to uart1 port. Then uart1 side will send back respond message to uart0 side.

    Could explain this in more details? If you could upload a diagram of how the nRF5340 DK and the nrf5349dk are connected that would be awesome.

    Also, do you have a minimal reproducible sample?

    Best regards,

    Simon

Reply
  • Hello,

    I'l take a closer look at this tomorrow/Thursday.

    I send dummy message over uart0 port to nrf5340dk board, and it will be re-routed to uart1 port. Then uart1 side will send back respond message to uart0 side.

    Could explain this in more details? If you could upload a diagram of how the nRF5340 DK and the nrf5349dk are connected that would be awesome.

    Also, do you have a minimal reproducible sample?

    Best regards,

    Simon

Children
Related