Cannot upload to Nano 33 BLE Sense

I've been having fun testing out the new Sense board and didn't have any problems for a few days, until I tried to test out the Chirp integration that was recently revealed (https://create.arduino.cc/projecthub/ChirpDevs/send-data-with-sound-bf7024).

I was too hasty in clicking upload and forgot to edit the Credentials.h file so when I opened the serial monitor I was greeted with a message telling me that.

However, since then I have been unable to upload another sketch to the board!
I have tried the Chrip example from the link above, the Blink example, and a couple of other minimal sketches. I've tried a different computer and cable and the issue is definitely with the board.

Below is the verbose output when attempting the Blink sketch, the error message is very vague:

Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "Arduino Nano 33 BLE"

Sketch uses 72492 bytes (7%) of program storage space. Maximum is 983040 bytes.
Global variables use 1408 bytes (0%) of dynamic memory, leaving 260736 bytes for local variables. Maximum is 262144 bytes.
Forcing reset using 1200bps open/close on port COM9
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
PORTS {COM3, COM4, COM9, } / {COM3, COM4, COM9, } => {}
Uploading using selected port: COM9
C:\Users\Nick\Documents\ArduinoData\packages\arduino\tools\bossac\1.9.1-arduino1/bossac.exe -d --port=COM9 -U -i -e -w C:\Users\Nick\AppData\Local\Temp\arduino_build_288053/Blink.ino.bin -R 
An error occurred while uploading the sketch

Any ideas would be useful. If it was the normal board i'd probably be thinking about flashing the bootloader but I'm unsure how it works with the Mbed core.

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 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 get the timing of the reset just right.
  • 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.

That's fixed it thanks!

I knew that could be an issue with cloned boards and have had to manually reset while uploading before, but didn't realise that could have been going one here.
The double reset is a useful tip too :slight_smile:

1 Like

You're welcome. I'm glad to hear it's working now. Enjoy!
Per

Thank you, pert!

Your solution worked for me too! I was getting panicky about my brand new Nano33 Sense BLE when I have never corrupted any UNO/MKR boards in the last five years. I've cut and pasted your steps into my notes.

Kind regards.

You're welcome.

The reason you'll never corrupt an Uno like this is because it uses a separate dedicated USB chip (ATmega16U2 on the official boards or CH340 on the Uno derivatives). The reason they do that is because the ATmega328P doesn't have the necessary native USB functionality to do that on its own. However, it does have the additional benefit that no matter how buggy your sketch is on the the Uno, it can never break USB.

Native USB does have its own advantages though. The most common that an Arduino user will notice is the ability to emulate a keyboard or mouse. The chance of "bricking" the board by breaking the USB is an unfortunate downside, but luckily Arduino has supplied this nice recovery system of the double reset so it's really not such a big deal once you know how to do it. Tracking down which part of your code broke USB and fixing it can be a big project though!

I think you probably got a bit lucky to have avoided this occurrence on your MKR board because I've certainly done it with mine before. I don't have any experience with the Nano 33 BLE boards yet so I can't say whether it's easier to break USB on those boards for some reason.

@pert

Can you provide a pointer to the bootloader source running on the Nano 33 BLE?

I have this problem. Followed the procedures.
It displays.... At processing.app.serial.touchforcdcreset(serial.java:101) ...... 6 more
The yellow light does blink
Is the problem the usb ports . tried the other two.

bradjc:
Can you provide a pointer to the bootloader source running on the Nano 33 BLE?

I see the .hex, .elf, and .bin files in the Arduino nRF528x Boards (Mbed OS) hardware package's bootloaders/nano33ble folder, but I don't know where the source code is for them. I see there is source code for bootloaders in multiple subfolders of cores/arduino/mbed, but I don't find any indication of which of those (if any) are used. I'd expect a makefile for generating the bootloader somewhere, but I didn't see it.

Unfortunately, I don't really know much about the Nano 33 BLE boards, and even less about Mbed. Hopefully someone else here will be able to answer your question.

vadaxradio:
I have this problem. Followed the procedures.
It displays.... At processing.app.serial.touchforcdcreset(serial.java:101) ...... 6 more
The yellow light does blink
Is the problem the usb ports . tried the other two.

Is this about the same problem you reported in your other topic?:
https://forum.arduino.cc/index.php?topic=637002