You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
voidsetup() {
Serial.begin(115200);
while(!Serial) {}
delay(200);
Serial.println("This is a test!");
Serial.flush();
Serial.println("We survived!!");
}
voidloop() { Serial.println("alive.."); delay(1000); }
The output of which is
This is a test!
followed by a hangup of the serial monitor window (cannot be closed). The on-board LED starts blinking on the board in the pattern dictated by mbed_die(). The hangup persists until the Pico is physically removed from the USB port.
Now consider the same sketch, but comment out the Serial.flush();. The output is now
This is a test!
We survived!!
alive..
alive..
alive..
Conclusion: Your Serial.flush() implementation kills the Pico, instantly.
(You will have to put the Pico into bootloader mode when plugging it in and selecting a fake upload port, otherwise you cannot reprogramm the Pico).
This is using the latest-released 2.5.2 core on the latest Arduino IDE 1.8.16, selected board is the Raspberry Pi Pico.
The text was updated successfully, but these errors were encountered:
Yes, editing the file locally in C:\Users\<user>\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.4.1\cores\arduino\Serial.cpp with the fix and reuploading fixes the problem.
This is a test!
We survived!!
alive..
alive..
Serial.flush() crashing the board in the common Serial USB configuration seems pretty crucial to me, I'm sure some sketches and libraries rely on it. The RP2040_RTC library linked above e.g. does to print its debug output. Don't you want to do a re-release with the bugfix?
Consider the sketch
The output of which is
followed by a hangup of the serial monitor window (cannot be closed). The on-board LED starts blinking on the board in the pattern dictated by
mbed_die()
. The hangup persists until the Pico is physically removed from the USB port.Now consider the same sketch, but comment out the
Serial.flush();
. The output is nowConclusion: Your
Serial.flush()
implementation kills the Pico, instantly.(You will have to put the Pico into bootloader mode when plugging it in and selecting a fake upload port, otherwise you cannot reprogramm the Pico).
This is using the latest-released 2.5.2 core on the latest Arduino IDE 1.8.16, selected board is the Raspberry Pi Pico.
The text was updated successfully, but these errors were encountered: