Data gets split into two lines

If you have specific questions or problems with any of my Freeware applications, post them here.
Post Reply
bobliu.rck
Posts: 1
Joined: Fri Aug 11, 2023 2:36 am

Data gets split into two lines

Post by bobliu.rck »

Hi Roger,

I'm using Coolterm as a terminal to collect data from Arduino, while the serial monitor reads everything properly, when I use file capture, it splits the data into two lines at random locations every once in a while which makes the processing of these data very difficult, could you help me troubleshoot what the problem is? Thank you!

Data collected:
2023-07-30 10:49:22 2494.8.93.0

2023-07-30 10:49:36 2495.8.92.0

2023-07-30 10:49:51 2496.8.93.0

2023-07-30 10:50:06 2497.8.9 <------Where the data gets split into two lines
2023-07-30 10:50:06 1.0 <----- Where the data gets split into two lines

2023-07-30 10:50:21 2498.8.91.0

2023-07-30 10:50:36 2499.8.91.0

2023-07-30 10:50:51 2500.8.91.0
User avatar
roger
Site Admin
Posts: 434
Joined: Fri Apr 24, 2009 12:41 am
Contact:

Re: Data gets split into two lines

Post by roger »

Hi,

sorry for the late response. I believe what you're seeing is a side effect of the asynchronous nature of how the reception of serial data works. There is a SerialData event that fires when then OS notifies CoolTerm when new data arrives. In addition to that, CoolTerm also polls the port periodically to check for new data. When either of these cases happens, CoolTerm grabs all the data and puts on screen and writes it to file if capturing is enabled. It can sometimes happen that this occurs when the attached serial device is in the middle of sending data. In such a case, CoolTerm only gets part of the data during one cycle and then gets the rest during the next cycle a fraction of a second late. Normally, that's not a problem. However, when timestamps are turned on (which seem to be case in your capture data), you get separate lines with separate timestamps for the two chunks of data.

For use cases like this, it is recommended to enable the "Wait for Termination String" option under the "Capture File" options. Make sure that the hex values in the "Termination String (Hex):" match with how your Arduino terminates each line. I assume your are using Serial.println(), which uses CR+LF. If so, then "0D 0A" should be correct value for the termination string. Keep the "Retain termination String" option turned off since the timestamp feature already adds a new line after each line.

I hope this helps.

Roger
Post Reply