You shouldn’t need to sign anything if you’re replacing the bootloader. You can use
pyocd to program the UF2 bootloader by itself, rather than
nrfutil, though both should work.
nrfutil is trying to actually use the DFU functionality of the bootloader that’s already present when you see that second error you speak of. The first error is more of the clue though, because I see you’re trying to actually use the
dfu command in that. You’ll want to use
SWD to flash at least the bootloader, because that will write to the raw flash of the NRF52840. The bootloader’s DFU mode is designed to just write the “user application” area, not the bootloader itself, (if I recall correctly, it’s been a good bit since I’ve looked at that code.) Do you have a Pitaya Link or other similar SWD programmer?
Here’s how you can flash the NRF52 with
nrfutil over SWD:
$ adafruit-nrfutil -f nrf52 --eraseall # wipe the NRF52840
$ adafruit-nrfutil --program "pitaya_go_bootloader_0.6.1_s140_6.1.1.hex" -f nrf52 --sectorerase --reset
After that, you should be able to boot up in the bootloader mode (it should boot there automatically, blinking the LED red while it is), and drop your CircuitPython UF2 file on the ‘Drive’.
One last thing that can be a real gotcha:
Adafruit’s bootloader will look for specific bits for checksum verification before it’ll launch your application image too, so you’ll want to write a value that says “my app is valid” to the UICRs. I’m not sure of what exactly the arguments are to do it with
nrfutil, but here’s how I do it with
$ pyocd cmd -t nrf52840 --command w32 0xFF000 0x00000001 --command reset
nrfutil has a similar functionality, but the gist is you want to write the 32 bit value of
0xFF000. After that value is there, the UF2 bootloader will skip the checksum verification of the application image, and boot right to it regardless.
Hope this helps.