I have lost the COM port of my Arduino nano 33 BLE after a donwload. The IDE and COM port works fine on other arduino boards.
So I guess I got a problem with the donwload and my nano BLE bootloader get corrupted.
Is there a way to re-load a basic bootloader so that he nano BLE can re-work properly with the IDE ?
Hi @fbd38. The tricky thing about the boards with native USB capability like your Nano 33 BLE is the USB code that creates the CDC serial port is running on the same microcontroller as your sketch. This means your sketch code can break the USB code, or stop it from running. When that happens, it no longer presents a port.
This can be unexpected to those who previously mainly worked with the boards like Uno and Mega with a dedicated USB chip that can never be affected by the sketch code.
The missing port makes it so you can't upload normally any more. However, the situation is really not so bad because there is an independent program called the bootloader in a separate section of memory from your sketch, and that program has its own USB CDC code. So even if the sketch is completely broken, you only need to activate the bootloader and you will get a port back and be able to upload.
Fortunately, there is an easy way to activate the bootloader and recover from this situation:
- 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 reset causes the bootloader to run until the board is reset normally, powered off, or an upload is done. - Select the port of your board from the Tools > Port menu in Arduino IDE.
The port number may be different when the bootloader is running so don't assume you already have the correct port selected. - Start an upload in Arduino IDE.
The upload should now finish successfully.
After this, you should be able to go back to doing normal uploads without needing to use the reset button technique.
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.
Thanks Pitillisch.
It solved my problem.
But this lead to my second concern. How to execute outside the IDE.
When I supply the board by an external supply on Vin, it does not start, even if I press the reset button.
Is there someting I miss ?
Regards,
fbd38
You are welcome. I'm glad the port problem is solved.
Please post the sketch code that has this problem.
Hi Pitillish,
I have found the consern.
On this type of board, if you have serial print in your code, for debug purpose for example, you need a serial port to start (else you stay in the serial.beging loop). This is the difference with the other boards that have their own USB COMP chip.
Thanks for your support.
This is not quite correct.
You'll often see something like this in Arduino sketches:
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
This will make your code stay in an infinite loop until the serial port is opened in Serial Monitor. The reason that is useful is because on native USB boards like yours, the board is not reset when you open Serial Monitor. That means any serial output printed between the time the program starts running and when you get Serial Monitor open will be lost.
In applications where missing that serial output would be a problem, it's useful to add this code to the sketch in order to make the program wait for the Serial Monitor before running.
However, if you are wanting to run your program when the board is not connected to Serial Monitor, you must remove that while
loop to allow the rest of the sketch to run.
So the program stays in this while
loop if you don't have a serial connection to the board. There is no problem with Serial.begin()
.
thanks
You are welcome. I'm glad if I was able to be of assistance.
Regards,
Per
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.