Adafruit_nRF52_Bootloader: Application can't trigger OTA DFU
Boards: mdk-usb-dongle, pca10059 Env: Linux, nRF52 15.3 SDK
I have a custom application I’ve written that I’ve added buttonless DFU to, however I can’t seem to get my application to actually flash an update over OTA. nRF Connect is able to initiate buttonless DFU (from both Android & nRF Connect on desktop), and I do see the board briefly go into DFU mode, however instead of flashing an update I simply get a GATT connection error and the board resets back into the application.
Looking at the bootloader code I should just be able to set gpregret to BOOTLOADER_DFU_START
then do a reset from the soft device to get the chip to enter OTA DFU and perform a flash, however that doesn’t seem to be working (which is what the default Nordic service does in ble_dfu
).
Buttonless DFU is pretty straightforward, but for thoroughness:
- Copied the relevant code sections from the buttonless DFU example in the SDK
- Updated
sdk_config.h
by enablingBLE_DFU_ENABLED
andNRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS
to support bondless behavior. - Adding the relevant code sections from the example project.
- Updated the linker
uicr_bootloader_start_address
in the linker configuration to match the bootloader start address for this bootloader (0x10001014
) (Board obviously won’t boot without this defined).
UART logging in my app confirms that ble_dfu_buttonless_bootloader_start_finalize
is called right before the board resets, so I’m confident that gpregret is set. It seems like the bootloader isn’t seeing that register being set when it goes into DFU on reset.
Short of throwing a debugger at the bootloader to see if the register is picked up properly I’ve thrown everything I can think of at it, including adjusting the timeouts on both the bootloader and application. I feel like I’m missing something obvious in getting OTA DFU to work with this bootloader, but can’t seem to figure it out myself so I’m looking for help. I’ve seen other users be able to get OTA DFU to work so I’m sure it’s an implementation change I need to make, I’m just not sure what at this point.
Questions
- Does this bootloader work with the ble_dfu service provided with Nordic out of the box, or do I need to make changes to the service itself?
- Is there anything obvious missing in the implementation that I need to add? On pca10059 with the secure bootloader/example provided by Nordic I’m able to get things to work, porting it to this bootloader seems to be the problem.
Thanks for your help!
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (6 by maintainers)
I wanted to add my experience with OTA on Adafruit nRF52840 Express.
I can successfully perform an OTA update using Adafruit’s Bluefruit mobile app (android). If I export the compiled binary hex file from Arduino IDE, then perform the following:
adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application sketch.ino.feather_nrf52840_express.hex package.zip
Then I unzip that file, and use the .hex file, and the .dat file (that’s the init file that Bluefruit requires).
The zip package that adafruit-nrfutil produces doesn’t work in the nRF Toolbox mobile app, it fails in exactly the way charlesportwoodii describes.