Hello everyone,
I am currently using the Nordic-Thingy-91 to test the nRF9160. Now I am trying to receive Data from the UART interface using the "UART Async API".
I am switching between three 64 bytes buffers to ensure continuous reception of data.
And that is where run into a problem when the receiving data is split into two buffers, due to one buffer running out of space.
I am using Putty to send data and I am not sending byte for byte, I am sending multiple bytes at once.
As long as the received data fits into the current buffer, everything is fine.
But if the RX data doesn't fit into to current buffer and the second buffer is used too, I loose data.
For example:
RxBuffer1 and RxBuffer2 each have 64 bytes.
RxBuffer1 has only 4 bytes left.
I send 10 bytes of data from Putty to the board.
Expected behaviour:
- RX_RDY event for the 4 bytes in RxBuffer1
- Another RX_RDY event for the remaining 6 bytes in RxBuffer2
Actual behaviour:
- RX_RDY event for the 4 bytes in RxBuffer1
- Another RX_RDY event, but the event data says there is only 1 byte in RxBuffer2
--> so I loose 5 bytes of data
For RX_BUF_REQUEST events I provide the API with the next buffer, to ensure continuous reception.
Here are two Screenshots of exactly this case. I have marked the 3 buffers in the memory window.
The red entries in the memory view is the new data which is split into 2 buffers.
So there are 4 new bytes in the first buffer and 6 new bytes in the second buffer.
Here is the first RX_RDY event which gives me 4 bytes in the first buffer. Everythings is fine..
The second RX_RDY event, which is shown next, says there is only 1 byte new in the second buffer, even though I can see there is actually more data in the memory.
So all the data is received and correctly stored in the memory, but the second RX_RDY event for the second buffer only gives me 1 byte, even though there are more…
Has anyone experienced a similar problem and can help me with this issue? Or is this a known issue?
I have also looked into the Zephyr driver test under *\v1.5.0\zephyr\tests\drivers\uart\uart_async_api but this test only sends/receives data which fits perfectly into the buffer.
Here is my prj.conf and main.c I use:
prj.conf:
main.c