Did I just brick my Nano 33 BLE?

Hi, so I have a project where I need some way to store a few bytes of non-volatile information like I would in EEPROM, but unfortunately the Nano 33 BLE doesn't have EEPROM at all (as a sub-question here, if anyone has a solution to that please let me know!)

During my exploring possible solutions to this, I discovered the Arduino-NVM library which claimed to use flash memory in a similar way to EEPROM. I loaded up the flash_erase_and_write example and it compiled (despite a warning of potential incompatibility with the mbed architecture), which is more than any other library I tried. I uploaded it, ran it, and the built-in LED started turning on and off at seemingly random intervals (the LED was never even called in the sketch, but maybe it was in the library idk), and when I tried to open the serial monitor it just froze up the IDE. I let it sit a few seconds, then unplugged the board which unfroze the IDE and of course got the typical "board not found on COM10" or whatever, but then when I plugged the board back in.... Nothing. Not even the green power indicator LED, and computer didn't see that I've connected anything.

I tried plugging it into a little USB battery bank and it did see that something was plugged into it, but still nothing on the board. Tried plugging into computer while holding reset button just for fun, nothing. Have I ruined it? Did I erase the bootloader or something? Any way I can undo this mistake? The 33 BLE isn't exactly as cheap as the old Nano boards :cold_sweat:

I do have some other various boards (one other BLE, some old Nanos, an Uno, and a Due) on hand if I need to use them to reprogram or upload a new bootloader via SPI or something like that. Any help is appreciated!!

Squirt_5432:
Have I ruined it?

No.

Squirt_5432:
Did I erase the bootloader or something?

Possibly.

Squirt_5432:
Any way I can undo this mistake?

Let's try the easy fix first:

The tricky thing about the boards with native USB functionality like your board is that 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.

Fortunately, there is an easy way to 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 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 number may 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.

pert:
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.

Yeah, I was worried about something like that. I just tried double-pressing the reset button a few times at various speeds and still seeing no lights at all.

An alternative to using the flash memory as EEPROM would be to add an i2c EEPROM chip like AT24C256.

PaulRB:
add an i2c EEPROM chip like AT24C256.

Thought something like that might be possible, thanks for pointing me in the right direction - that chip looks like it'll do nicely.

Still not seeing any sign of life on the board... I tried the double-press thing on my other BLE board which still works and that did exactly what it was supposed to, with the LED pulsing, but the problematic one still appears like it's not even plugged in at all.

Squirt_5432:
I just tried double-pressing the reset button a few times at various speeds and still seeing no lights at all.

OK, if you're not getting a pulsing "L" LED after the double reset then it means the sketch overwrote your bootloader. So the fix is to replace the bootloader.


You'll need:

ARM CMSIS-DAP compatible programmer/debugger

Here's a reasonably priced one that's all open source: https://www.tindie.com/products/ataradov/cmsis-dap-compliant-swd-debugger.
But you're welcome to use whatever CMSIS-DAP programmer you prefer, that's just the one I happen to own.

In addition to allowing you to recover bricked boards, this programmer can be used for ICE debugging. I've used it with the Arduino SAMD boards and the Arduino Pro IDE and it works great.

There is a cool library that allows you to turn a spare Arduino board into a DAP programmer, but I haven't figured out whether it's possible to use it with the Nano 33 BLE.

Breakout board to allow you to easily make the connections between the debugger's 0.05" pitch connector and the Nano 33 BLE

Here's one: SWD (2x5 1.27mm) Cable Breakout Board : ID 2743 : $2.95 : Adafruit Industries, Unique & fun DIY electronics and kits

Some way to make the connections to the SWD test pads on the Nano 33 BLE

Here's a handy pogo adapter: SparkFun ISP Pogo Adapter - KIT-11591 - SparkFun Electronics
(Also good for programming AVR boards via the ICSP footprint when you haven't added a header.)
Even with this adapter, it's a bit challenging to get the pogo pins aligned with the small test pads on the Nano 33 BLE, but if you keep at it you'll get it eventually.

Better would be to have a jig like this, but if you're not going to be doing this regularly then that's probably overkill.

Some people have managed to use a regular 0.1" pitch 2x3 male header pressed down on the test pads to make the connections. I think that would be a bit more challenging, but it's cheap enough and something you might already have on hand.

You also have the option of just soldering wires to the test pads on the Nano 33 BLE.


Process:

Start the Arduino IDE.

Tools > Board > Arduino Nano 33 BLE

Tools > Programmer > ARM CMSIS-DAP Compatible

Make the connections between the debugger/programmer and the Nano 33 BLE:

| Programmer | | Target |
| - | - |
| ----------- | |------- |
| VCC | | +3V3 |
| ----------- | |------- |
| SWDIO | | SWDIO |
| ----------- | |------- |
| SWCLK | | SWCLK |
| ----------- | |------- |
| GND | | GND |
| ----------- | |------- |
| RESET | | RESETN |
| ----------- | |------- |

Here's the pinout of the test pads on the Nano 33 BLE:

Nano-33-BLE-SWD.jpg

Connect the USB cable of the programmer to your computer.

Power the Nano 33 BLE (you can do this via the USB connector on the board). The debugger doesn't power the board.

Tools > Burn Bootloader

Wow, thanks for all the useful info! I was hoping to be able to use another board as my interface because I know I've done that using my Uno to flash bootloaders to my old Nano clones, but that was a long time ago and I forget how I did it. Something about using the SPI pins and changing the programmer in tools menu (maybe "Arduino as ISP"? Or "Parallel Programmer"?), then using the burn bootloader tool. I tried the Adafruit DAP library you linked to, but it's showing up as incompatible since it apparently only runs on samd architectures.

If there's any way to do it with a board I've already got it'd be preferable to spending about the same amount of money on those components as another Nano BLE would cost, but otherwise if that stuff saves me stuff like this in the future I guess it'd be worth it.

I'm still a bit concerned that the power LED doesn't come on at all, I haven't checked the schematic but I thought that would be hard-wired directly to 5V or 3.3V. All the similar stuff I've found of people bricking their boards the power light is at least on; does that mean anything?

Squirt_5432:
I know I've done that using my Uno to flash bootloaders to my old Nano clones, but that was a long time ago and I forget how I did it. Something about using the SPI pins and changing the programmer in tools menu (maybe "Arduino as ISP"?

That was it, but that will only work for the AVR architecture Arduino boards like your classic Nano. It will never work for you Nano 33 BLE. Despite the name, this is a very different board from the classic Nano.

Squirt_5432:
I tried the Adafruit DAP library you linked to, but it's showing up as incompatible since it apparently only runs on samd architectures.

I notice the readme says this:

Tested with a Metro M0 / Arduino Zero as the 'host' and with ATSAMD21's as the client but in theory any 3.3V Arduino board will work as host (just slower)

but I've only tried it using a SAMD board as a programmer, so I can't say whether it works on an Uno or classic Nano. Note that you could get around the "3.3V" requirement with a level shifter.

Squirt_5432:
If there's any way to do it with a board I've already got it'd be preferable to spending about the same amount of money on those components as another Nano BLE would cost, but otherwise if that stuff saves me stuff like this in the future I guess it'd be worth it.

Personally, I love my CMSIS-DAP programmer. I even bought a spare just because I like to feel free to experiment without being so worried that I'll brick the only tool or part or board I have on hand.

But for someone with no intention to use that programmer again, it might seem like a bad investment.

Squirt_5432:
I'm still a bit concerned that the power LED doesn't come on at all, I haven't checked the schematic but I thought that would be hard-wired directly to 5V or 3.3V. All the similar stuff I've found of people bricking their boards the power light is at least on; does that mean anything?

The Nano 33 BLE is fairly unique in that it has the power LED connected to a digital pin. This is handy for low power applications because you can easily turn that LED off. Otherwise, that LED drawing a few mA would completely ruin the otherwise uA range power consumption. On the Arduino boards like the Pro Mini, I have to desolder the LED just to get low power. So the answer is that no, the dark LED doesn't necessarily mean anything bad.

pert:
That was it, but that will only work for the AVR architecture Arduino boards like your classic Nano. It will never work for you Nano 33 BLE. Despite the name, this is a very different board from the classic Nano.

Ah got it, noted.

pert:
I notice the readme says this:
Tested with a Metro M0 / Arduino Zero as the 'host' and with ATSAMD21's as the client but in theory any 3.3V Arduino board will work as host (just slower)
but I've only tried it using a SAMD board as a programmer, so I can't say whether it works on an Uno or classic Nano. Note that you could get around the "3.3V" requirement with a level shifter.

Oh ok, I saw that too but was a bit confused. I'll mess around with it when I get some more time. I do have some level shifters on hand which will probably come in handy (for the actual project too since it uses 5V components).

pert:
Personally, I love my CMSIS-DAP programmer. I even bought a spare just because I like to feel free to experiment without being so worried that I'll brick the only tool or part or board I have on hand.

But for someone with no intention to use that programmer again, it might seem like a bad investment.

Yup same here, hence I bought 2 Nanos originally lol. I can't think of many situations in the near future where I'd use the programmer besides this one, however I like to think someday I'll design my own PCBs based on Arduino for projects in which case I imagine I'd need such a thing to program the chips from the factory. If the library ends up not working easily I'll probably buy it.

pert:
The Nano 33 BLE is fairly unique in that it has the power LED connected to a digital pin. This is handy for low power applications because you can easily turn that LED off. Otherwise, that LED drawing a few mA would completely ruin the otherwise uA range power consumption. On the Arduino boards like the Pro Mini, I have to desolder the LED just to get low power. So the answer is that no, the dark LED doesn't necessarily mean anything bad.

Ahhh interesting, did not know that. That makes me feel better and could be useful for future projects!