UART RX buffer issue after buffer overflow
incognico last edited by
Summary: overflowing the UART receive buffer causes an offset in the ring buffer pointer so further use of the UART returns incorrect data.
From this thread. Reproduced by me this morning without difficulty. The GPS module discussed in the thread is not relevant/required to reproduce the issue.
Test setup: External device (I used an Arduino) setup to send n chars to the FiPy UART. I've only tested this on UART 1 so far (P3/P4).
UART(1, baudrate=9600, bits=8, parity=None, stop=1, timeout_chars=10, pins=('P3', 'P4'))
(sysname='FiPy', nodename='FiPy', release='1.15.0.b1', version='v1.8.6-849-baa8c33 on 2018-01-29', machine='FiPy with ESP32', lorawan='1.0.0', sigfox='1.0.1')
Sending 50 bytes results in any() showing 50 and readall() returning correct data (as expected).
Sending 999 bytes results in any() showing 480 and readall() returning truncated data (as expected?).
However, this overflow appears to cause some corruption or offset in the ring buffer pointer. Any subsequent data is received and the bytes correctly counted when checking any(), BUT reading the data with read(n) or readall() returns
previous data from the bufferbefore some of the new data. eg (sent 20 chars):
>>> uart.any() 20 >>> uart.readall() b'xxx01234567890123456'
In this case, "xxx" was previous data still in the buffer, the data actually received and counted was "01234567890123456789".
De (&re) init of the UART does not fix it once the buffer is in this state. Calling machine.reset() and initializing the UART from fresh seems to be the only way to sort it.
nicoloboatto last edited by
@daniel was this problem actually fixed?
I think I'm having a similar issue on the latest LoPy4 firmware.
nathanh last edited by
@nathanh it will be a standard firmware update.
nathanh last edited by
Sorry for the dumb question, but will this be a firmware update which we simply use the firmware updater tool on our devices or will we need to build our own off the repo?
Also, thanks a lot to everyone involved in getting this sorted, will save me a lot of headaches going forward!
daniel ADMINISTRATORS less than a minute ago
The issue fixed in the IDF is definitely affecting us. We will merge that patch and will be available for our next release this week.
danielm last edited by
I believe I am experiencing the same issue: