I have been working with the Arduino Uno R4 Minima board and observed a very strange behaviour. My reset button on the board stops the code abruptly and the execution just hangs.
Please find the code below
int i=0;
void setup()
{
Serial.begin(115200);
while(!Serial)
{
}
}
void loop()
{
Serial.println(i);
i++;
delay(2000);
}
Its basically incrementing a variable every two seconds. When the variable reached "18" (in screenshot) the reset button was pressed. Ideally, the code should have started incrementing again from 0, but it just got stuck.
Has anyone ever faced this? Kindly Help!
Close and restart the Monitor to see.
1 Like
Post your code following forum guidelines and use code tags, it is to hard to read in its existing format. From what I can tell it is doing what I would expect. This would put the problem on the PC side because it re-enumerates the ports.
@silentobserver : what you said does work. But what if I want to reset the system with the reset button without closing the serial monitor?
This type of reset does work with the Uno R3.
@gilshultz : How to fix this? Cant it be reset when the serial monitor is ON?
This happens with all processors that handle USB directly, not through a USB-to-serial chip.
On reset the connection is lost by Windows.
Try IDE 2.2.1; it seems to be able to reconnect, at least sometimes.
1 Like
@silentobserver In case if I use the other Serial Port (Serial1 Port) of the Uno R4 and use an UART to USB converter and connect to windows, I should not be facing this RESET issue right?
Let me try it out and post the results here
Yes, this is what I use when I desperately need diagnostic output.
The other quick remedy is to (temporarily) add a l o o o n g delay, e.g. 10 seconds in setup, to have enough time to start the Monitor when Windows has got the USB connection.
@silentobserver I added a seperate USB to UART Converter module to the GPIO 0 & 1 pins and this worked! Thank you for your help
I also saw that. The code has already started running when the serial monitor was opened. Isn't it possible to reset the controller automatically when the serial monitor is opened ?