Dear all,
I've got some problems with the uart implementation in the peripheral uart example. I am using nRF52833 DK and SDK 2.0.2.
What I need for evaluation is a device which advertises and has a simple uart interface to comunicate with some python scrips.
So, peripheral uart example seems to be perfect to start with. The BLE part (own service etc.) is implemented and works fine.
The idea is to implement a command line shell (LwSHELL) to get/set parameters and send/receive some data.
As not all commands are of the same length and payload can also be variable it is hard to select the "perfect" buffer size. When I get that right the buffer is only released if it is full and the next buffer is loaded:
As you can see the buffer is only put to fifo in the UART_RX_BUF_RELEASED event.
I've also seen the example in Nordic Dev Academy:
The data is directly processed in the UART_RX_RDY event. This is may be good for setting I/O's, but is also meant to be the solution for larger amount of data or maybe calling
a subfunction which returs a few hundred milliseconds later? Is this callback called in an ISR context?
For now I modified the example that the data is copied to a second buffer in the UART_RX_RDY event an this buffer will be put to fifo:
But this leads to another question.
What happends if the incoming data does not fit into the buffer anymore? Is it swapped to the new buffer?
Thanks and best regards.
Oliver