Why does this code stop at 165667

PickyBiker

Well-known member
The simple code below always stops around 16566n regardless of the length of the delay on 2 different Teensy 4.0's using teensyduino 1.55 and arduino 1.8.15.

Why???

Code:
unsigned long c;
void setup() {
  Serial.print(115200);
}
void loop() {
  Serial.println(c++);
  delayMicroseconds(10);
}
 
You are sending 8 bytes every 10µs to (I assume) the Serial Monitor of the IDE. This makes 800'000 characters per second. I assume that the Sermon simply is not fast enough to display those. If I increase the delay to say 100µs it works without problem (using TyCommander as serial monitor). Just curious, why do you need to display 800'000 characters per second on the SerMon?
 
Paul made some edits recently to the Teensy SerMon used in the IDE - it might be fixed moving to TD 1.56.

And as @luni notes say 10,000 lines of 80 characters is a UI display issue for the host computer.

Teensy 4 sends on 480 Mbps USB and actual output is close to half that output rate. A Windows PC can BUFFER Megabytes of that faster than the GUI app can pull the data and get it displayed. Then Windows has shown issues getting that buffered data delivered usably to the GUI app and the buffering grows and grows so the data is then several seconds behind when the T_4.x sends at full speed - or even with a slight delay. As @luni notes the delay needs to be increased to the point where the net output rate doesn't trash the host to GUI app processing.
 
I don't need to send all that data. This was an issue when I wrote something to track down an error. I put a print in a tight loop and discovered this.

I have since upgraded to teensyduino 1.56 and the problem went away.
 
I don't need to send all that data. This was an issue when I wrote something to track down an error. I put a print in a tight loop and discovered this.

I have since upgraded to teensyduino 1.56 and the problem went away.

Great that TD 1.56 had the needed fix!

It can still cause troubles with super-fast printing overwhelming the HOST computer. Writing some Teensy Code to emit Code to make a LARGE Teensy program (over 3MB worth of 'source' making 4,000 functions calling each other with blocks of FLASH data) I was finding the 'corrupted' code wouldn't Compile and had to insert some delay between the .printf()'s to have it work. That was during TD 1.55 development - so it may work now, but 'sermon print' time wasn't critical - just getting working code so the delay's stayed, and the test worked ... running Large Encrypted code from Flash.
 
Back
Top