Timestamps

If you have specific questions or problems with any of my Freeware applications, post them here.

Timestamps

Postby Alan_Segal » Mon Oct 19, 2020 6:43 pm

Dear Roger,

I am a new user of CoolTerm and I have it running on my PC, Mac, and Raspberry Pi. It has fast become my favorite serial port terminal application as I find it the most intuitive and user friendly, and seems to be one (only?) such application to work well on the Raspberry Pi.

I do have several questions, most of which are probably my fault as a new user:
1. Timestamp: when I choose a timestamp of HH:MM:SS.sss, I notice that several data points are assigned the same timestamp, suggesting the sampling rate
exceeds 1000 samples per second. Is there a way to resolve a time resolution finer than 1 millisecond?
2. Raspberry Pi: when I make the same timestamp choice here, CoolTerm does not produce output and hangs. It works fine if the timestamp is simply
date/time or just time. What is causing this behavior?
3. Finally, despite saving changes I make in the options dialog box, I notice the settings are back to their default values. What am I doing wrong here?

Thanks!
Alan
Alan_Segal
 
Posts: 6
Joined: Mon Oct 19, 2020 12:50 pm

Re: Timestamps

Postby roger » Mon Oct 19, 2020 7:33 pm

Hi Alan,
Alan_Segal wrote:1. Timestamp: when I choose a timestamp of HH:MM:SS.sss, I notice that several data points are assigned the same timestamp, suggesting the sampling rate
exceeds 1000 samples per second. Is there a way to resolve a time resolution finer than 1 millisecond?

Actually, CoolTerm receives data in chunks. Serial ports have a receive buffer that is monitored by the operating system, and when data arrives in that buffer, the API throws a DataAvailable event to tell CoolTerm to go and grab that data. This is not guaranteed for every character that is received. Especially at higher baud rates and/or when the system is busy otherwise, there can be quite a number of bytes in the buffer when this event fires. When CoolTerm gets that data from the buffer, it also gets a timestamp from the system. If there are multiple lines in the data it got from the buffer, CoolTerm will apply the timestamp to each line. Thus, when you see the exact same timestamp on multiple consecutive lines, it means that they all arrived at CoolTerm at the same time.
Alan_Segal wrote:2. Raspberry Pi: when I make the same timestamp choice here, CoolTerm does not produce output and hangs. It works fine if the timestamp is simply
date/time or just time. What is causing this behavior?

Let me see if I can replicate this behavior on the Raspberry Pi. As I disclaim on my website, the Linux and Raspberry Pi builds are not "officially" supported. Thus, not much of my own testing has gone into those builds as I rely on beta testers on those platforms. I have not received any feedback describing the issue you are experiencing. I'll take a look when I get a chance. When you select millisecond resolution for the timestamp, CoolTerm increases its serial port polling rate to force the DataAvailable event to fire if the system hasn't fired it on its own yet. This has a tendency to increase the CPU load. I wonder if the Pi has some difficulty with that. Which Pi are you using (2,3, or 4)?
Alan_Segal wrote:3. Finally, despite saving changes I make in the options dialog box, I notice the settings are back to their default values. What am I doing wrong here?

When you saying that the settings are back their default values, do you mean that they are back to the defaults after a new start of CoolTerm?
You can save your current settings to disk, and load the settings after a new launch.

I hope this helps.

Roger
User avatar
roger
Site Admin
 
Posts: 281
Joined: Fri Apr 24, 2009 12:41 am

Re: Timestamps

Postby Alan_Segal » Tue Oct 20, 2020 10:13 am

Dear Roger,

Thanks so much for your very prompt and helpful explanations.

It is a Raspberry Pi 4, and like I said, it works perfectly for "Time only" and "Date and Time" but hangs when "Time + Milliseconds" is selected.

This happens at both baud rates I have tried (9600 and 115200).

Thanks again.
Alan
Alan_Segal
 
Posts: 6
Joined: Mon Oct 19, 2020 12:50 pm

Re: Timestamps

Postby roger » Tue Oct 20, 2020 1:04 pm

Hi Alan,

I have done some testing with my Raspberry Pi 2B today, and I have not been able to reproduce what you are seeing. The timestamps in HH:MM:SS.sss format are added as soon as data is received on the serial port. It's actually quite snappy given that it's a Pi 2. I have tested different baud rates too.

The one case where I have seen the Pi version not display incoming data is when the baud rate on the Pi didn't match the baud rate of the serial device on the other end. This may be due to characters getting garbled and resulting in being something that is not printable. However, it's still possible to see what's being received when switching to hex mode. However, this behavior was independent of the timestamp format.

In your case, when you see the issue, is CoolTerm completely hanging, or are you still able to access its menus, etc? Can you switch to hex mode?

Roger
User avatar
roger
Site Admin
 
Posts: 281
Joined: Fri Apr 24, 2009 12:41 am

Re: Timestamps

Postby Alan_Segal » Tue Oct 20, 2020 1:53 pm

Hi Roger,

The baud rates on the Pi 4 and the serial ports match, and as soon as I change to ask for Time + Milliseconds, the data flowing in the window stops and the window freezes completely irrespective of whether I am using HEX or not.

Thanks,
Alan
Alan_Segal
 
Posts: 6
Joined: Mon Oct 19, 2020 12:50 pm

Re: Timestamps

Postby Alan_Segal » Tue Oct 20, 2020 2:56 pm

Roger,

It is very interesting. I just left the window up and found that a few minutes later the display actually was updated with Time + Milliseconds data and that the data update every minute or so. It appears that perhaps the data are coming in so fast that the display can't keep up so instead the data continue to accumulate and then are periodically dumped to the display, which may also explain why the window appears to be frozen but the program is still going strong. What do you make of that?

Thanks,
Alan
Alan_Segal
 
Posts: 6
Joined: Mon Oct 19, 2020 12:50 pm

Re: Timestamps

Postby roger » Tue Oct 20, 2020 4:54 pm

Hmm, not sure. I don't really have an explanation. What is your data rate (not baud rate)? I.e. how much data is your device sending per second? Is it massive quantities of data?
User avatar
roger
Site Admin
 
Posts: 281
Joined: Fri Apr 24, 2009 12:41 am

Re: Timestamps

Postby Alan_Segal » Wed Oct 21, 2020 5:45 am

The serial port is just connected to an Arduino board reading one ADC at whatever rate the data are sent at 9600 baud. Like I said, the main difference is that instead of the fast constant "streaming" in the window when the timestamp is set to Date/Time or Time, the data in the window when Time + Milliseconds is selected is choppy and seems to update over periods of many seconds (or minutes).
Alan_Segal
 
Posts: 6
Joined: Mon Oct 19, 2020 12:50 pm

Re: Timestamps

Postby roger » Wed Oct 21, 2020 5:32 pm

Would you mind posting your Arduino sketch (or an example sketch that also demonstrates the issue)? I can upload that to my Arduino UNO and see if I can replicate this with Py.
User avatar
roger
Site Admin
 
Posts: 281
Joined: Fri Apr 24, 2009 12:41 am

Re: Timestamps

Postby Alan_Segal » Thu Oct 22, 2020 3:08 pm

Sure Roger, it is just the example from the Arduino.cc Web Editor, which I have pasted below. As I may have mentioned, this sketch with Time + Milliseconds runs perfectly on my Mac and PC, it just hangs/delays on the Raspberry Pi 4.

/*
ReadAnalogVoltage

Reads an analog input on pin 0, converts it to voltage, and prints the result to the Serial Monitor.
Graphical representation is available using Serial Plotter (Tools > Serial Plotter menu).
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

This example code is in the public domain.

http://www.arduino.cc/en/Tutorial/ReadAnalogVoltage
*/

// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1023.0);
// print out the value you read:
Serial.println(voltage);
}
Alan_Segal
 
Posts: 6
Joined: Mon Oct 19, 2020 12:50 pm

Next

Return to Support

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron