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

Upgrading Legacy Bootloader (SDK V11) to Secure Bootloader (SDK v17)

I am attempting to update firmware on hardware already in the field. The firmware in the field is based of sdk v11 and has the legacy bootloader for OTA DFU. After some digging I found this post:

and felt it was possible to upgrade the old bootloader to the new secure bootloader in sdk v17. I applied the fix required by this link: 
and have still not been able to DFU the secure bootloader and corresponding soft device. I have been able to upload the Custom Bootloader from a SDK v11 build but every time I attempt to program a new bootloader + softdevice package the DFU Service on the device returns with (Op Code = 2, Status =6).
Does anyone have any guidance for this issue? Thanks.
Parents Reply Children
  • Hi ,

    I am using the custom bootloader from that post.

    I carried out the following steps to in an attempt to upgrade my bootloader:

    • I rebuilt the bootloader I was previously using on my project based on sdk v11 by replacing the dfu_dual_bank.c file with the one created by Bjorn with the additional fix.
    • I built a dfu .zip package containing this new custom bootloader's .hex file using the old version nrfutil program that works with sdk v11 projects.
    • After connecting to my previously working project via nRF Connect app on an Android tablet I OTA DFU'd it with the new custom bootloader.

    All of this seemed to work and my custom bootloader and project were operating as normal.

    • Next I built the secure bootloader project from sdk v17 for the proper chip (nRF52832).
    • I built another dfu .zip package containing this new bootloader and corresponding SoftDevice: s132 v7.2.0
      • I did not know whether or not to implement keys so I have tried this process from start to finish with this package containing keys and not.
    • I attempted to OTA DFU this new upgraded bootloader and softdevice .zip package using the nRF Connect app on an Android tablet.
    • The mobile app seemed to initiate DFU parameter properly but did received the response indicated earlier: (Op Code = 2, Status = 6)

    In short, I am stuck attempting to use the custom bootloader to OTA DFU the new sdk v17 Secure Bootloader & Soft Device Package. Here is the output from the logs within nRF Connect.

    I hope this clears things up, thanks for the help.

    Sam

  • Hi Sam, 

    Could you tell how did you generate the .zip packet for the image of the SDK v17 bootloader and the S132 v7.2.0  ? Please provide the script you used to generate the .zip file. 

    From my understanding you should use the old nrfutil and generate it the same way as you generated the custom bootloader. 

    The error Op Code = 02 means OP_CODE_RECEIVE_INIT

    And status = 06 means BLE_DFU_RESP_VAL_OPER_FAILED. 
    This suggested that there could be an issue with the init packet. You may want to put a breakpoint inside on_ctrl_pt_write() and check how it handles OP_CODE_RECEIVE_INIT in the custom bootloader. 

    I would suggest to try testing just updating the same custom bootloader (simply change bootloader version) just to check if the custom bootloader actually can DFU update itself. 

  • Ahh this clears things up for me. I was using the new nrfutil package to generate the SDK v17 bootloader and softdevice package. I used this command:

    nrfutil pkg generate --hw-version 52 --bootloader secure_bootloader_ble_s132_pca10040.hex --bootloader-version 0 --softdevice s132_nrf52_7.2.0_softdevice.hex --sd-req 0x0081 --output upgraded_bl_sd.zip

    This did not work. However, after using the same, old nrfutil tool package as I had used to create the custom bootloader, I was able to upload the new package containing SDK v17 bootloader and softdevice. That command was this:

    nrfutil.exe dfu genpkg --bootloader secure_bootloader_ble_s132_pca10040.hex --dev-revision 0xffff --softdevice s132_nrf52_7.2.0_softdevice.hex --dev-type 0xffff --sd-req 0xfffe dfu_bl_sd_sdk17.zip
    Zip created at dfu_bl_sd_sdk17.zip

    Once I created this package using the old nrfutil tool package I was able to complete the following steps successfully:

    1. Upload the .zip package containing the custom bootloader to legacy based application.
    2. Upload another .zip package containing the new SDK v17 based secure bootloader and corresponding softdevice
    3. Upload the new application .zip package with updated firmware built with SDK v17
    4. I also confirmed that I was able to upload another version of the application with the same keys in order to prove the secure bootloader is operating realiably.

    Thank you so much for the help! I hope others are able to find this post helpful as well.

Related