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

Problem with bootloader and dfu

Hi,

So I've been having a number of issues with getting OTA dfu and the ble secure bootloader working with the 132 softdevice, sdk 14.2 and nrf52832.

So a little context to where I am currently at and what I have tried, I'm currently running everything on a DK just to try get a grasp with everything before moving it to our custom board. So I began with trying the ble secure bootloader example following the instructions on the nordic siteI successfully built the bootloader files, created my own public and private keys, replaced the existing public key with my new one and using the blinky example I made a bootloader settings hex with nrfutil and merged that with the bootloader hex and flashed that to the device which worked fine. I continued to make the dfu package with the blinky example and my private key and transferred it to my phone which brings me to my first issue:

  • when sending the application through OTA dfu it completes fine but then will not actually start the application, LED 3 on the DK remains lit even after resetting the DK the only way to bring it out of this is to reset it while holding button 4 which of course returns it back to dfu mode.

After being stuck on this for a while I decided to just move on, which I realise sounds like i'm jumping the gun a little, and try to implement the buttonless dfu in a simple application that basically just advertises and connects, along with my own bootloader (which is just a copy of the secure ble bootloader without the button stuff), which brings me to my final couple of issues:

  • After flashing my bootloader hex and my application the bootloader seems to be completely ignored, for example I have added code to light LED 3 and wait abit, which has no effect and I can remove  nrf_bootloader_app_start function from main altogether and the application still runs and advertises fine, am I correct in thinking that it should get stuck in bootloader with this removed? I have verified with the nrf intel hex demo (here) that my bootloader and application files are in the correct place. Additionally, looking on nrfgo studio my bootloader isn't recognised as a bootloader, would there be something obvious i'm missing why this wouldn't work when its basically a copy?

  • My final issue is closely related to the previous one upon flashing my bootloader and running my application with buttonless dfu in debug, making sure that the board doesn't erase, the application crashes on the app error check at nrf_dfu_svci_vector_table_set(); with error code 4, meaning it cant find the bootloader.

I would very much appreciate any help,

Many thanks 

Parents
  • Hi,

    Thank you for your reply, so after testing with the RTT logs and debug bootloader I can confirm that the DFU completes fine on the nrf side. I've tested it with both my own application and the blinky example, both run fine when flashed without the bootloader, but fail to actually boot when transferred across with OTA DFU.

    Regarding the UICR register I will have a more in depth dig into it now that I have a better idea of what may be causing it.

  • The RTT log shows that the bootloader starts the application (at least it branches to where the application is supposed to be located). How do you know that the application is not running? Could it be that there is some error in the application that prevents it from working as you would expect? Have you done any debugging in the application? (It could be easier to test the application first without a bootloader so that you know it works properly before you flash the bootloader.)

Reply
  • The RTT log shows that the bootloader starts the application (at least it branches to where the application is supposed to be located). How do you know that the application is not running? Could it be that there is some error in the application that prevents it from working as you would expect? Have you done any debugging in the application? (It could be easier to test the application first without a bootloader so that you know it works properly before you flash the bootloader.)

Children
  • So all my application does at present is advertise and connect with a different name. I have tested this without the bootloader and it works as expected so I know its not working as when the dfu transfer finishes the device does not advertise. I have also tried a fresh OTA DFU setup with the blinky example, which also works without the bootloader, but does exactly the same thing as my application when I try using OTA DFU with the bootloader. Additionally I have tried this on multiple nrf52 DK boards, all of which show the same behaviour. 

  • I see. Can you verify that the application start address is indeed 0x23000? And just in case, can you also verify the SoftDevice is present in the flash?

  • Hi,

    Apologies for the late reply, I got pulled away from this issue. However after revisiting it I have managed to sort my DFU woes.

    The application skipping the bootloader and the bootloader not being recognised as a bootloader, was solved by editing the linker script to not build with the softdevice as when I built it using visual gdb it merged the file with the softdevice causing it to only be recognised as an application. By splitting the two then merging them using the mergehex command it created a hex file that worked correctly.

    The issue regarding the application not being passed to through the bootloader was solved by altering the bank valid app in bootloader_settings.c as mentioned in this thread.

    Many thanks for your time and help

Related