UARTE does not receive RX RDY on timeout when double buffering

I've tested two scenarios using a hardware loopback to test UART functionality. The double buffer approach does not work as expected.

SDK version 1.6.1

CONFIG_SERIAL=y
CONFIG_UART_ASYNC_API=y

  1. Single buffer works as expected:
    1. Setup a buffer of X bytes
    2. Enable UART RX, get UART_RX_BUF_REQUEST event and ignore it.
    3. Transmit X-1 bytes.
    4. Get UART_TX_DONE event
    5. I successfully get an UART_RX_RDY event after X-1 bytes are received.
  2. Double buffer does not work as expected example 1
    1. Setup two buffers of X bytes
    2. Enable UART RX with buffer_1
    3. Get UART_RX_BUF_REQUEST event and pass in buffer_2
    4. Transmit X-1 bytes (less than one buffer's worth)
    5. Get UART_TX_DONE event
    6. Then, nothing! - Here I'm expecting UART_RX_RDY event to signify no more characters have come in.
  3. Double buffer does not work as expected example 2 
    1. Setup two buffers of X bytes
    2. Enable UART RX with buffer_1
    3. Get UART_RX_BUF_REQUEST event and pass in buffer_2
    4. Transmit X+1 bytes.
    5. Get UART_RX_RDY
      UART_RX_BUF_RELEASED (buffer_1)
      UART_RX_BUF_REQUEST-> pass in buffer_1 back in
    6. Get UART_TX_DONE event
    7. Then, nothing! - Here I'm expecting another UART_RX_RDY event to signify no more characters have come in.

What might I be doing wrong? I can confirm the data is in the buffers as expected through the debug watch window.

Parents
  • Hi,

    Can you post the code you used for the 3 scenarios (preferably with full samples in order to reproduce on our end)?

    Best regards,
    Jørgen 

  • Hi Jørgen ,

    I ran a very similar test to the zephyr provided double buffer test. This worked as expected.

    Now I'm running into another issue where some characters are dropped. This appears to happen only when a RX timeout occurs.

    For example, I might send 100 characters over UART to my 82 byte double buffers (2 x 82 bytes). I get the UART_RX_RDY for the first buffer full with 82 bytes. The second buffer I'll notice all the data is in memory, but the length of data/number of bytes returned is between 15-17 bytes (short 1-3 bytes).

    I'm running a loopback at 115,200 baud. If I do nothing in UART_RX_RDY  event, I get all the data and the correct length.

    If I do too much work in the event, I then start missing characters. I suspect I need to enable UART hardware counting.

    Does this sound correct? What steps do I need to take to enable hardware counting?

Reply
  • Hi Jørgen ,

    I ran a very similar test to the zephyr provided double buffer test. This worked as expected.

    Now I'm running into another issue where some characters are dropped. This appears to happen only when a RX timeout occurs.

    For example, I might send 100 characters over UART to my 82 byte double buffers (2 x 82 bytes). I get the UART_RX_RDY for the first buffer full with 82 bytes. The second buffer I'll notice all the data is in memory, but the length of data/number of bytes returned is between 15-17 bytes (short 1-3 bytes).

    I'm running a loopback at 115,200 baud. If I do nothing in UART_RX_RDY  event, I get all the data and the correct length.

    If I do too much work in the event, I then start missing characters. I suspect I need to enable UART hardware counting.

    Does this sound correct? What steps do I need to take to enable hardware counting?

Children
No Data
Related