How does Arduino IDE reflash xiao nrf52840 without the boot mode?

I am trying to reflash the board using uf2 without entering the boot mode, as I don’t have access to the reset button, the MCU is in a case. I can reflash from Arduino IDE, but of course the xiao board does not show up as a volume on the system.

If Arduino IDE is able to reflash, I have a reason to think it’s also possible to reflash with uf2 without access to the reset button. Could someone point me to do more reading on how this works?

Hi there,
UF2 is a file format designed by Microsoft that stands for USB Flashing Format. This format was designed for PXT (also known as Microsoft MakeCode) and allows for programming boards over the Mass Storage Class (removable drive). The bootloader is also compatible with BOSSA which is what the Arduino IDE uses.
Look into the BOSSA spec to learn more.
The UF2 file is meant to drag and drop when already in BL mode.
The Flash tool interacts directly with the device, not through the Bootloader.
Just use the Nrf_connect for desktop and programmer to Flash the HEX version of the Uf2 file. Straight away.
Check out the thread for Uf2 files, to get some insight.
HTH
GL :slight_smile: PJ

just tried the connect programmer, it seems to require a dev kit to enable JLink, otherwise it gives “no operation possible” when trying to connect to a device. I am trying to figure out how to reflash without any devkit, no access to reset button, etc.

Arduino IDE seems to use nrfutil to flash the device, which is in /Users/x/.local/lib/python3.7/site-packages/nordicsemi/main.py:serial, but from the command line that results in the following. Do you have any ideas why Arduino IDE makes it work, but directly using nrfutil code does not?

raise NordicSemiException("No data received on serial port. Not able to proceed.")
nordicsemi.exceptions.NordicSemiException: No data received on serial port. Not able to proceed.

Possible causes:
- Selected Bootloader version does not match the one on Bluefruit device.
    Please upgrade the Bootloader or select correct version in Tools->Bootloader.
- Baud rate must be 115200, Flow control must be off.
- Target is not in DFU mode. Ground DFU pin and RESET and release both to enter DFU mode.

Hi there,
Yes, You are correct, To use programmer Device needs to be in BL mode.
Ok so, one thing I had work for me when the REST button took the Thumbnail Temperature Challenge and flew the coop. What I did was Hit the Upload button and it took several tries but I got it finally to go, by connecting the Xiao as the progress bar reached the end, Kind of Glitching it or catching the Reset to Upload. YMMV
HTH
GL :slight_smile: PJ

You have to get the timing down to get it to connect and upload. (as it resets) :v:

Ok, I figured it out. Apparently there is a way to send a reset signal (16 null characters, any idea why?) over Serial:

ser = serial.Serial('/dev/cu.usbmodem101', 1200)
ser.write(b'\x00' * 16)
ser.close()

And then I use adafruit-nrfutil dfu serial to reflash it with a binary.

1 Like

Hi there,
Yes, that is for the adafruit Bootloader, custom for there stuff , AFAIK.
might work with BSP 1.1.x but not with the mbed is what I’m thinking.

I like my tech better(easier) :smile: but requires finesse and patients… :face_with_hand_over_mouth: LOL
Glad you got it though , nice find.
GL :slight_smile: PJ :v: