Go Down

Topic: Messed up serial port on MKRZero (Read 387 times) previous topic - next topic

lenk

This should be easy. I was tired and for some unknown reason I changed Serial.begin(9600) and Serial1.begin(9600) to (19200) baud rate. My download failed, of course. I changed the baud rates back to (9600) but the damage was done. My download hangs up at the message "Forcing reset using 1200bps open/close on port COM 15" I tried my spare MKRZero with both serial and serial1 set to (9600) and it is fine. I'm talking to a Nextion display off pins 13,14 and was downloading via USB. How can I reset the first MKRZero?
Thanks,
Len

pert

I changed Serial.begin(9600) and Serial1.begin(9600) to (19200) baud rate. My download failed, of course.
First I should state that Arduino uses the term "upload". I know that there are different opinions on whether this is correct, but as long as we all use the same word and understand what is meant by it, we can be successful in communication. So, to avoid confusion, I would recommend that you use the term "upload" when talking  about flashing programs to microcontrollers with people in the Arduino world.

This will never cause a failed upload. You are welcome to set the serial baud rate in your sketch to any speed you like. It has no effect on uploads.

My download hangs up at the message "Forcing reset using 1200bps open/close on port COM 15"
Are you saying the upload never finishes or errors no matter how long you wait?

To start, I recommend restarting your computer. Sometimes a random glitch can cause a serial port to get stuck in an unusable state. Restarting fixes that.

lenk

Upload. Right, sorry.
I reinstalled Arduino 1.8.13 and changed cables.
I can see the board when I plug into USB and selected the port.
Tells me board info so I'm sure it sees it
I cannot even get "blink" to upload.
There is no problem seeing and uploading "blink" to a mini using the same cable so that isn't it.

The upload hangs up at "Forcing reset using 1200bps open/close on port COM12"
The green uploading bar and Uploading... never go away
I've tried a board reset during upload, nothing helps.
I like the size of the board and the fact it has two serial ports, which I need in my project.
It's just frustrating 
Thanks,
Len



pert

The way uploads work is:
  • The Arduino IDE (or the upload tool used by the Arduino IDE) sends a signal for the microcontroller to reset.
  • The microcontroller resets.
  • The bootloader runs and waits (normally only for a short time) for an upload to start.
  • The upload tool sends the program to the microcontroller, where the bootloader writes it to flash memory.

On the boards with native USB (like the one you're using), the way the IDE signals the microcontroller to reset is by opening a serial connection at 1200 baud. There is some special code running in the background on the microcontroller that does the reset when it detects that 1200 baud connection.

In some cases, the reset code that's supposed to be on the microcontroller could be missing or not working correctly, which will mean the bootloader never runs and the upload fails with the error you're seeing. The fix is to manually reset the board.

Try this:
  • Press and release the reset button on your board quickly twice. You should now see the LED on the board pulsing, which means the bootloader is running. The double press causes the bootloader to run indefinitely (until the board is reset, powered off, or an upload is done), which means you don't need to worry about the timing of the reset.
  • Select the port of your board from the Tools > Port menu. The port will be different when the bootloader is running so don't assume you already have the correct port selected.
  • Start an upload in the Arduino IDE.

The upload should now finish successfully. After this, you should be able to go back to doing normal uploads without needing to press the reset button. If you still need to do the reset trick to do uploads after this, the problem may be caused by your code. You can verify this by uploading a simple sketch like File > Examples > 01.Basics > BareMinimum.

Go Up