Hi, I have a device connected to the USB port of the laptop. This device pumps data to the port which is read by the python script.
As per the baudrate of the board I use folowing configuration to open the port.
Serial(options.port,921600,timeout=0.2,xonxoff=0,rtscts=1)

But when I analyse the collected LOG file I see lot of data miss in between. Looks like buffer is over written.

Can anyone please tell me what is happening ?

Thanks in advance !

Recommended Answers

All 5 Replies

Do you have anything besides the Python script that can read the data? It might be worth your while to investigate whether the dataloss is related to your script or not, because right now, there are too many unknowns.

Thanks for the reply.
Other then python script I can use "Teraterm" or "xshell" to read serial port. When I use those application then there is no data loss. But I have to automate the process, so have to use python.

Well, that is great news - at least you now know exactly where the problem lies.

What libraries are you using for the Python code? Have you tried to simply log information to screen, to see if perhaps you are losing data because the Python script is locked at the moment of writing and perhaps fails to read data from the buffer?

Looks like the issue is Resolved.
I am using pyserial module of python.
The script was doing following task:
1. Reading large amount of data from the serial port
2. Printing same on screen
3. Writing same to Log file
4. Also the timeout for read was earlier set to 0.2 sec now increased to 1 sec

I think script at times was not able to manage write and print on screen at same time. So there was some data miss.

Anyways thanks for the effort Ewald

Great job - that's some good investigative development there.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.