-
Notifications
You must be signed in to change notification settings - Fork 166
[L01 with 1.14.0.b1] UART issues (buffer overflow?) #129
Comments
I do not see an issue here: if the buffer is full, the device can either stop receiving or overwrite old content. The buffer is there for ... buffering. It is up to the application to consume the data at the average rate, it arrives, and soon enough. Buffering supports the application, in that soon enough does not mean: 1 * character time, but buffer size * character time . |
like @robert-hh i do not see issue here |
Ok, I understand that the buffer size is limited. Let's say that "error" in bold line of following reading is caused by buffer being full:
What I do not understand is why following readings have '\r\n' in the first line and in last line '\r\n' is missing?
|
This is because \r\n is from you last read (missing)
maybe it's not entirely comfortable that readline() read also when no \r\n exists but this is how it work now |
Ok, that's explanation for '\r\n' in the first line but why is last line always without it? |
|
I don't think that it should timeout because '\r\n' characters are transmitted continuously after the numbers. I left method test2() from this code running for an hour and it never happened. And I doubt that my reading algorithm was in perfect sync with the transmitting sensor.
|
The mechanics are hard to know without knowing the mechanism for the serial buffer. It could be a timeout, if the buffer was full and the last \r\n did not fit into the buffer any more. If you are continuously reading, then the buffer will not overflow, and you will always get full ines. Besides that, it something you could do: set up a timer wich reads the data continously and keep the last line read. Or, when you want to read, first flush the buffer and then read until you get a full line. Or read lines and just keep the last full line. |
Maybe there is really some problem |
Other users are experiencing similar issue: Please take a look at it. |
…#129) Co-authored-by: Andreas Motl <[email protected]>
…#409. (pycom#129) Co-authored-by: Andreas Motl <[email protected]>
In my application object I have a test() method making use of UART bus 1. CO2 sensor transmitting messages (with format " Z 01540 z 01575\r\n") every 500ms is connected to this bus via pins P3 and P4.
Simplified code:
I am calling node.test() method manually from REPL. It works well until I keep the L01 receving data from the sensor a little longer without calling the node.test() method. It seems that in case UART buffer gets full some characters are lost or the order is mixed. This behavior keeps going on until next reset.
The text was updated successfully, but these errors were encountered: