Just starting to work with the Teensy 3.2 boards and finding that Serial.print() statements do not work when in or called by something in the setup() portion. In loop() or any other routine, the print statements are normal. Same code works on any other Arduino board I use. It appears that the serial output back to the monitor is not enabled until after setup() completes. The only workaround I found is to put the info into global variables and print at the beginning of loop().
I’m using ‘Serial’ as my upload method. Is this a Teensy bug or did I miss something in the board selection?
Some Arduinos, like the Leonardo, need to wait for the Serial1 instance to be started. Perhaps the Teensy needs to do that, too.
I've got the Serial.begin() as my first statement in setup(), as I always do in any sketch, but no print statement works until loop() is started. It's not a show stopper with the workaround but just annoying. Just checked and the latest Teensy library is still 1.27.
The Leonardos usually have something like
This makes the Leonardo wait for the Serial1 instance to be ready for use. The Teensy might require something like that for Serial.
the latest Teensy library is still 1.27.
Library for what?
The Teensy library is for the core and those items not found in other boards.
Your suggestion works using:
while( !Serial );
Apparently, the 72MHz CPU clock finishes the setup() routine before the external serial monitor connection to the PC is established.
Thanks for the clue.
I also found this info.