This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Serial Port Library Receive interrupt

Hi,
I am using the Serial port library in SDK15. I am using the port in NRF_SERIAL_MODE_IRQ mode. After transmission the number of bytes receive are variable ranging from 1-10 bytes. I am not calling nrf_serial_read() explicitly. I access the data directly from the rx buffer. However I am having some issues with the communication.
When is the NRF_SERIAL_EVENT_RX_DATA event triggered ? Does it trigger for every byte received or all the bytes for a particular response are received ?
Also, how does the sizes of the tx and rx buffer sizes defined in NRF_SERIAL_BUFFERS_DEF affect the communication ?

Regards,
Sid

Parents
  • The NRF_SERIAL_EVENT_RX_DATA event is triggered in the callback handler from the UART driver when a RX operation is completed (NRF_DRV_UART_EVT_RX_DONE event is generated). How often this will happen depends on the size you used for creating the buffers using NRF_SERIAL_BUFFERS_DEF. If you set the RX buffer to 1, this event should be generated for every byte received. Large buffers will result in larger transfer blocks, reducing the amount of interrupts/events at the cost of longer wait before data is available in the queues.

  • That helps a lot. The documentation for the Serial port library is lacking and the examples based on IRQ do not implement any kind of event handler. 

Reply Children
No Data