This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

pca10059, replacing stock bootloader with Adafruit UF2, using USB dfua signature. I can generate a zip file with nrfutil, but what key should I use? I tried to use just a private key, and flash that generated packet with nrfutil, but nrfutil crashes when I

pca10059, replacing stock bootloader with Adafruit UF2, using USB dfu

Hi. I currently don't have a J-Link at hand, so I tried to flash the UF2 bootloader using the stock DFU bootloader over USB. nRF Connect can flash an application to the dongle, but when trying to overwrite the bootloader, it complains that the init packet does not contain a signature. I can generate a zip file with nrfutil, but what key should I use? I tried to use just a private key, and flash that generated packet with nrfutil, but nrfutil crashes when I try to flash it.
Any help?
Link to Adafruit bootloader is: github.com/.../Adafruit_nRF52_Bootloader

  • Hi Uhrheber, 

    Please be aware that we are not the people who make the Adafruit products or any toolchain software provided by the company. 

    I would suggest you to contact Adafruit to get their support. 

    I had a quick look at their documentation, it seems that you need to install adafruit-nrfutil instead of our nrfutil, and it seems that the tool doesn't require a private key to be provided when creating the .zip file. Most likely it's a non-secure bootloader. 

  • Sorry, I may have written this in a misleading way.

    My question is not about the Adafruit bootloader, this is merely an example.

    I wanted to know in general, how to overwrite the stock bootloader. And I'd like to know more about the stock bootloader. So far, I've not been able to generate a valid update packet, that your nrfutil accepts. I can flash pure hex files using the programmer app in nRF Connect, but I was never able to flash anything into the dongle using nrfutil.

    So I'd like to know a little bit more about the stock bootloader. Is it's source availabe anywhere? What is it's default security key? I assume that you must use this key to generate update packages, and that nRF Connect has this key built in?

    So, how do I flash the dongle using nrfutil? A working example would be highly appreciated. 

    Many thanks.

  • Hi Uhrheber, 

     I misread that you were using the Adafruit bootloader. It's my mistake.

    Regarding the stock bootloader on the PCA10059, it's an openbootloader. You can find it in the SDK at \examples\dfu\open_bootloader\pca10059_usb

    There isn't a key for the open bootloader, when you generate the .zip package for it you simply remove --key-file parameter when calling nrfjprog. 

    Then you can use nrfutil to update the dongle, however, I would suggest to use the nRFConnect Programmer app to do flashing for the PCA10059. You don't even need to create the .zip file, simply just choose the hex file and then flash it. 

    Please be aware that the PCA10059 comes with the MBR at address 0x0000  - 0x1000. And it's not possible to replace the MBR.

  • Many thanks, I see things more clearly now.

    I was able to generate a package with:

    nrfutil pkg generate --hw-version 52 --sd-req 0xAE --application-version 1 --application firmware.hex firmware.zip

    The softdevice was already flashed, so I could flash the package with:

    nrfutil dfu usb_serial -pkg firmware.zip -p /dev/ttyACM0

    And it worked.

    Then I tried to update the bootloader, and generated a package with:

    nrfutil pkg generate --hw-version 52 --sd-req 0xAE  --bootloader pca10059_bootloader.hex bootloader.zip --bootloader-version 1

    But when trying to flash it, I got the error:

    pc_ble_driver_py.exceptions.NordicSemiException: Extended Error 0x08: The init packet does not contain a signature, but this bootloader requires all updates to have one.
    

    So, how do I add a signature?

  • Hi Uhrheber, 

    As you can find here: http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/ble_sdk_app_open_bootloader.html?cp=4_0_0_4_3_2

    The bootloader update still requires signed package. 

    The reason we have this requirement is to avoid the device to be bricked by a bootloader update from untrusted source. 

    Please be aware that the dongle we created to be used as a development tool, not as a development kit. So the main purpose is to be used for nRFConnect and other app. So the bootloader is not supposed to be changed. I don't think we will distribute the private key we used for the stock bootloader. 

    However, if you want to change the flash it it's not too difficult, you just need to solder the same header you can find on the Debug Out P19 of the nRF52 DK on to the Dongle and then use the cable to erase the chip and flash your own program. 

Related