3 months, 1 week ago.
how to reliably read from UART
Hi, I am trying to read a serial datastream at 115200 baud. this does work with my code, but sometimes (about 1 of 1000bytes) 1 byte is received incorrectly. I am receiving with UARTSerial and sending the received stuff out over BLE in paralell.
I have confirmed no buffer is overflowing (except for the hardware buffer... but I dont think so..) I am on an NRF52840.
Is there anything I am missing in order to make it more reliable? Do I have to split receiving and sending into seperate threads maybe? would that help? also I have the feeling, that the problem gets worse, with more CPU load.
what can I do about this?
3 months ago.
I would need more information for clarifying this issue.
Where's the error byte occurring? Is it on UART receive side or on BLE receive side?
Have you checked readble() before read()?
For increasing CPU load, maybe you can use a smaller connection interval and no slave latency, under this configuration, would it be easier for reproducing this issue?
In you current implementation, where do you put UART receiving, is it in ISR or main thread?
You need to log in to post a question