I recently upgraded to Ubuntu 20.04. And all hell broke loose with my code. Or so I thought. Thought somehow all hardware went bad. None of my test/debug printouts would show up once the loop started! Tried everything I could think of, nothing. Or they would show up, then I stop pushing buttons for a split second and no more Serial output.
Eventually figured out that it wasn't my hardware. And it wasn't my code either. It was the damned IDE. For whatever reason, neither 2.3.4 nor 2.3.2 play nice with Ubuntu 20.04. The Serial monitor is the problem. It just freezes randomly. To unfreeze it, I have to change the baud rate to something other than current in the drop down menu, then I have serial output for a bit. Then it freezes again. That pretty much makes the Serial monitor absolutely and entirely useless. Which royally sucks because I am doing something COMPLICATED with I2C button interaction and I have to make sure that callbacks are tracking correctly.
Is there a fix for this? If not, has anyone had this happen when they moved to 20.04? Has anyone been able to get around this problem? The forum shows that there's something that looks similar to my issue, but I can't read German.
I don't recall having an issue with 20.04, but that was 4 years ago. I am running 24.04 LTS with version 2.3.4 of the Arduino IDE and have no problems.
In order to make all relevant information available to any who are interested in this subject, I'll share a link to the formal bug report submitted by @georgemichael2000:
So I installed the 1.8.9 IDE and the Raspberry PICO etc toolkit. Configured the board. And there is no serial monitor at all. I compile the sketch, just working with the basic_callback sketch from the examples, forget about my own code for a minute. I upload the sketch (which I have to do manually using sudo, because for whatever reason Ubuntu locks up external USB interfaces to read-only unless root. I have a number of policies that are not my own, so maybe that's a side effect. Anyways. As soon as I upload the complied sketch and it gets going, I try to click on "Serial Monitor" and get an error that "Board at null is not available", whatever that means, never seen that before as the 2.3.x IDE just automatically reconnects when the board gets going. So in 1.8.9 the serial monitor just plain doesn't even work, let alone randomly freeze. Or at least I don't know where the magic buttons are.
Okay, got the serial monitor aaaannd.... same exact problem. If I stop pressing the NeoKey buttons for like 2 seconds, the monitor freezes. If I use the pull-down menu and change the baud rate, even to the same one as it was before, basically just simply use the pull-down rate menu, the serial output starts working again. Mind you, this is a canned example, "basic_callback" it is called. Not my own code.
And no, I can't just go and upgrade my operating system because this is some kind of a strange interaction between the IDE and Ubuntu 20.04. I don't control when I upgrade my operating system. That well above my pay grade.
Here is a straightforward sketch that exercises the serial port:
uint8_t count = 0;
void setup() {
// start serial port at 9600 bps:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
}
void loop() {
Serial.println(count);
count++;
delay(1000);
}
If, with this sketch, the serial port is still causing you grief, I am out of ideas. If it works, post the code that is giving you grief.