Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Conditions under which NRF_SERIAL_EVENT_RX_DATA is sent?

OK, a bit of confusion somebody can clear up for me, I hope;

Does NRF_SERIAL_EVENT_RX_DATA get sent when there is ANY data in the RX buffer, or only when the RX buffer is full?

And if the later, does the FIFO keep receiving data during any processing dead time in handling that event?

What I want to do is several reads of differing length as I have a Start of Frame followed by a length, and I would ideally read two characters, extract the length, and then read the rest of them.  However, if I have to take one event per character, the processor is fast enough to manage.  I just need to know which situation I have to expect.

Thanks in advance!!

-Ben Burch

BTR Controls, Inc.

Parents
  • Hello Ben,

    if you look in nrf_serial.c, you can see the uart_event_handler(). NRF_DRV_UART_EVT_RX_DONE is issued on every UART byte. The rest of the logic is in the source code.

    I haven't used nrf_serial too much, but it doesn't look like it fits your needs. If you want events only on UART timeout, or when an RX buffer is full, you should look into the example:

    SDK16\examples\peripheral\libuarte.

    This one has a buffer that is filling up, and only sends the RX complete event to the main application when either it hasn't received a byte for a while, or when the RX buffer is full. Like in this example, it is possible to study the source code for the libraries to see how this is done.

    Best regards,

    Edvin

  • Well, if nrf_serial does call on each byte then this works for me.  HOWEVER, I am now in the situation that though I can send data out the UART, no input is ever seen.  I do not ever get events at NRF_DRV_UART_EVT_RX_DATA though I do get them at the TX_DONE branch when my initial send completes.  Any thoughts on this?  The nrf_serial_init succeeded, obviously, or we would never emit the start string.  How can I determine what is up with the RX side of things?

Reply
  • Well, if nrf_serial does call on each byte then this works for me.  HOWEVER, I am now in the situation that though I can send data out the UART, no input is ever seen.  I do not ever get events at NRF_DRV_UART_EVT_RX_DATA though I do get them at the TX_DONE branch when my initial send completes.  Any thoughts on this?  The nrf_serial_init succeeded, obviously, or we would never emit the start string.  How can I determine what is up with the RX side of things?

Children
No Data
Related