Unexpected RXDRDY count

Hello,

I'm writing my own UARTE library because I need some functionality not offered in the SDK. But I came across a hardware behaviour I can't explain.

In my understanding, the RXDRDY event is triggered when a byte is fully received in the RX pin (at the stop bit). Then, after the RX FIFO and DMA it will eventually be written to RAM.

My code, similarly to libuarte_async, uses a TIMER to detect when there is no more activity in RX and another TIMER to count the number of RXDRDY events, which should represent the number of bytes physically received at the RX pin.

The problem is, the number of RXDRDY events is sometimes not what I would expect. For instance, consider this trace:

At [1], the RXTO irq handler runs because the DMA transfer is complete. As you can see, 78 bytes were received up to that point. The RXD.AMOUNT register reads 76 and the RXDRDY count is 77. I would expect the RXDRDY count to be 78.

Then, at [2], the RXTO irq handler runs because the reception is stopped due to RX idle. At this point, the RXD.AMOUNT register reads 14 and the RXDRDY count is 13. I would expect the RXDRDY count to be 12.

In short, it looks like the RXDRDY event is not triggered when a byte is received at the RX pin.

Can you please shed some light on this behaviour?

Parents Reply
  • Hi,

    Again, my apologies for the slow feedback on this request. I was able to reproduce the issue and received some feedback from our HW team on when the event is generated.

    The RXDRDY event is generated every time a byte is moved to the top of the FIFO. This means that for the first 16 bytes, the data will be moved to RAM and the a new byte will me placed at the top of the FIFO when it is received. When the 17th byte is received, this will also be stored at the top of the FIFO and a RXDRDY event will be generated. However, since the RAM buffer is full (MAXCNT reached), the byte will be left in the FIFO until the UARTE is flushed/restarted. If you receive more data after the 17th byte, these bytes will be placed lower in the FIFO, and the RXDRDY events will first be generated when the data at the top of the FIFO is moved to RAM and a new byte is moved to the top of the FIFO.

    Best regards,
    Jørgen

Children
No Data
Related