Too many examples have the bad "while(!serial);", or more harmlessly "//while(!serial);". I just found 30 threads hitting on qBlink() - my "power the LED on startup and wait some time for serial to come online" simple blink sketch. About as often as I2C devices get rushed to start - folks don't have proper pull-ups. The Wiki or a good intro text could fill in those gaps since they can be covered.
Is that a separate issue to where I thought this thread started?
I'm up over 33 UPLOADS from the IDE with SerMon open and not triggered the T_3.2 'push program' yet this time after 14 last time.
Speaking of qBlink example - I just cleaned one to this - it prints NOTHING on the IDE SerMon - even though it waits up to 4 seconds for Serial? unless you uncomment the print"." in the loop()? Then the expected output shows up including 984 to 1100 on millis() through the IDE SerMon. Closing that and using TYQT the number is 258 to 294 with 6 resets. This simple sample just showed another issue, following.
Note - using TYQT ( I said I wouldn't but ... for this test ) - TYQT cannot cause a BOOTLOADER update on the brand new OSH T_3.2! TYQT (most) always works to reboot - now it sees the device in some odd state, though can send a reset. I get this in the 1.26b2 Verbose - one of the other oddities I've posted - this
hit from 6 weeks back and was on T_3.1's. This persists even after repeated BUTTON hits, and the Teensy is OFFLINE/ASLEEP (no Blink) it is awaiting programming. Though TYQT can send a RESET to restart it with the old code.:
17:26:19: Device came online, code_size = 262144
17:26:19: Board is: Teensy 3.2 (MK20DX256), version 1.03
17:26:19: File "qBlinkWait.cpp.hex". 16368 bytes, 6% used
17:26:19: HID/win32: HidD_GetPreparsedData ok, device still online
I've closed TYQT and still a BUTTON just freezes the Teensy - and TLoader Verbose is the same: "17:34:45: HID/win32: HidD_GetPreparsedData ok, device still online

".
TYQT Closed and
I swapped the T_3.2 for a T_3.1 that has been active for days - plug it in and hit BUTTON and the same result. It was running Touch_ILI9341 code I suspect as the LED glows hitting SPI. I did a power off cycle and this behavior persists. This is usually when I closed TLoader, hit Verify in the IDE and all is well. I 'think' I hit verify - but when TLoader opened it went direct to Program and put qBlink over my TOUCH code. Back to T_3,2 and it is working again.
Anyhow - more questions than answers - this is the odd behavior I've been seeing show up on occasion and took some learning to figure out how to extricate and return the system to function. And this is not related to delay() before setup() AFAIK. I rely on TYQT for my multi Teensy fun - it makes Teensy even better and without it SerMon would not serve my purposes as it can only open one Teensy monitor window - and TYQT adds BOOTLOAD/UPLOAD and RESET that are needed things (versus repowering or button pushing). This is not normal behavior.
BACK TO Serial.print() - the behavior above repeats - without the "// Serial.print(".");" in loop() I get NO SerMon output! It is waiting for some event. Okay so I put the change in pins_teensy.c " delay(2100); // TODO: this is not necessary, right?" and it now displays about 50% of the time. and the millis number was 2400+. Taking the ".c" delay to 2500 still gives no USB 50% of the time. The problem is the SerMon, as TYQT was working with delay of (4) alone and showing up at under 900 typically. When I uncomment the print in loop() IDE SerMon works 100% at number 1000-1160 millis. The SerMon is not pushing the data it gets waiting for some event, even adding this to setup() " Serial.println("abcdefghijklmnopqrstuvwxyz");" does not prompt any USB data display three out of three times, unless I uncomment out the loop() print, the all the output shows with the FIRST '.' from loop().
Code:
#define qBlink() (digitalWriteFast(LED_BUILTIN, !digitalReadFast(LED_BUILTIN) )) // Pin13 on T3.x & LC
void setup() {
Serial.begin(38400);
digitalWrite(LED_BUILTIN, HIGH);
pinMode(LED_BUILTIN, OUTPUT);
qBlink();
delay(200);
while (!Serial && (millis() <= 4000))
qBlink();
Serial.println(millis());
Serial.println("OK");
}
elapsedMillis emilBlink;
void loop() {
if ( emilBlink > 1000 ) {
qBlink();
emilBlink = 0;
// Serial.print(".");
}
}