Unable to flash Arduino Nano 33 BLE Rev2 with bossac runner in Zephyr (Flash erase failed)

Hi all,

I’m running into issues flashing an Arduino Nano 33 BLE Rev2 (nRF52840) using Zephyr and the bossac runner. I consistently hit a “Flash erase failed” error and can’t get past it. Please note that I've used ChatGPT to help me format this post but I have verified all information present. 


Development Setup

  • Host OS: Windows 11

  • Tooling:

    • west v1.4.0

    • Zephyr v3.1.0

    • Toolchain from nRF Connect SDK installation

    • Visual Studio Code (Nordic extension installed), but I am invoking west from the command line (PowerShell)

  • bossac binary: Arduino-provided build

    C:\Users\...\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino2\bossac.exe

Hardware

  • Board: Arduino Nano 33 BLE Rev2

  • Target MCU: nRF52840

  • Connection: USB, COM4 (bootloader mode confirmed via Device Manager)


Command

west flash --bossac=C:\Users\luke.trusheim_nzxt\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino2\bossac.exe --bossac-port=COM4

Output

-- west flash: rebuilding
[0/5] Performing build step for 'blinky'
ninja: no work to do.
[4/5] cmd.exe /C "cd /D C:\ncs\v3.1.0\zephyr\samples\basic\blinky\b...sysbuild && C:\ncs\toolchains\b8b84efebd\opt\bin\cmake.exe -E true"
-- west flash: using runner bossac
Write 21856 bytes to flash (6 pages)
[ ] 0% (0/6 pages)
Flash erase failed
FATAL ERROR: command exited with status 1: 'C:\Users\...\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino2\bossac.exe' -p COM4 -R -w -v -b 'C:\ncs\v3.1.0\zephyr\samples\basic\blinky\build\blinky\zephyr\zephyr.bin'

What I’ve Tried / Verified

  • Board is definitely in bootloader mode (double-tap reset, correct COM port confirmed).

  • Using Arduino’s 1.9.1-arduino2 bossac, not Zephyr SDK’s version.

  • west flash --help lists bossac as a supported runner for this board.


Help please!

At this point I’m stuck. I haven’t been able to get bossac to successfully erase or flash the board. Any help, insights, or suggestions from others who’ve dealt with this issue would be greatly appreciated.

Thanks,
Luke

  • That 3rd party software is not supported here. 

    If you wanted to do serious development, get a nordic DK board and use the included JLink debugger over the SWD connection. That way would be supported here.

    Pretty sure you can't use zephyr samples unmodified with a bootloader present.

  • Hi Luke,

    I don’t have experience with programming through the Arduino bootloader, so it’s a bit hard for me to say what might be causing the flash erase failure. Are you able to flash the firmware by running bossac.exe directly from the command line or through another programming app or does that also fail? 

    Note: you can run 'west -vvvv flash' to get a verbose output from the west runner. It will show all the arguments that is passed to the bossac executable.

    Best regards,

    Vidar

  • I am just following the steps outlined by this official Nordic doc: https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/boards/arduino/nano_33_ble/doc/index.html

    If possible, I would love to make my project work this way, but if that fails I do have a nrf52480 dongle. My goal is to have two Arduino Nano 33 BLEs simultaneously read data over BLE from a "central device". I just don't know if the dongle is capable of being that device.  

  • I get the same results when I try to run bossac directly (without west) through CLI. 

    PS C:\ncs\v3.1.0\zephyr\samples\basic\blinky> C:\Users\...\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino2\bossac.exe -p COM4 -R -w -v -b C:\ncs\v3.1.0\zephyr\samples\basic\blinky\build\blinky\zephyr\zephyr.bin
    Write 21856 bytes to flash (6 pages)
    [ ] 0% (0/6 pages)
    Flash erase failed

    The Arduino IDE (which I believe uses BOSSAC to flash devices) Is perfectly capable of flashing my Arduino Nano 33 BLE. But it seems I'm unable to through west. I am following the steps laid out in this Nordic doc: docs.nordicsemi.com/.../index.html

  • It sounds like it’s just a matter of finding the bossac arguments used by the Arduino IDE then. Have you tried adding the -a argument mentioned in this blog post: https://shanesnover.com/2023/12/18/zephyr-flash-nano-33-ble.html ?

    Please note that our SDK documentation includes a copy of the official Zephyr Project documentation, which means it is not limited to Nordic products.

    ltrush said:
    If possible, I would love to make my project work this way, but if that fails I do have a nrf52480 dongle.

    Both the dongle and this board support this BLE role, but the nRF52840 dongle is generally not recommended for development. It was not designed for that purpose (You need to connect an external J-link probe and solder a connector to the SWD lines to get debug access.). Our development kits (e.g. nRF52840 DK) comes with an on-board Jlink debugger and are better suited for this.

Related