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

Workaround for bricked DFU over BLE that can only update application.

Hi 
I have been put into at task with a nrf52832 device (Mesh) that can only update the application.
This is a big problem because we already have multiple device all over the world and now want to update to  SDK 15.2 (softdevice 6.1.0) for use with latest Mesh version, new app and offcourse a new bootloader.
Because of this situation I have created application that embeds 3 part
1) MBR + Softdevice (6.1.0)
2) New bootloader + MBR + Settings
3) A copy program that is placed to just below the new bootloader address and runned after changing the UICR->NRFFW[0] pointing at my copy program and NVIC_SystemReset(). 

The first 2 part are taken from at running device with SDK 1.52 and bootloader, without any application. And it is offcourse verified to be able to update softdevice/Bootloader/application :-) 

I have used the Segger JLink command savebin to get the 2 part, convert from bin to c-array and finally embedded them into my application.

The new bootloader includes debug info, so the default address are changed and my memory map look like this:

UICR->NRFFW[1] (0x10001018) = 0x0007 E000 (Address of MBR parameter storage)
UICR->NRFFW[0] (0x10001014) = 0x0006 A000 & 0x0007 0000 (Address of Bootloader )

Bootloader settings                          0x0007 F000 - 0x0008 0000 (4 kB)
MBR parameter storage                  0x0007 E000 - 0x0007 F000 (4 kB)
Bootloader                                       0x0007 0000 - 0x0007 E000 
RECOVERY_COPY_APP               0x0006 A000 - 0x0007 6FFF
RECOVERY_INFO                          0x0006 9000 - 0x0006 9FFF


RECOVERY_MAIN_APP                0x0002 6000 - 0x0007 1000 

SoftDevice                                       0x0000 1000 - 0x0002 6000 (148 kB)
Master Boot Record (MBR)             0x0000 0000 - 0x0000 1000 (4 kB)

For the moment I can update the device with my recovery application and run RECOVERY_MAIN_APP and RECOVERY_COPY_APP where i change the UICR->NRFFW[0] before each NVIC_SystemReset(). The leftover from RECOVERY_MAIN_APP is also erased, so it is not recognized as an application.  

Finally I ends up with a device that contains "exactly" the same as the running device with softdevice 6.1.0 and my new bootloader, but it is not running (going info DFU mode). 

Any idea of what I'm doing wrong ? 

Additional questions:
1) Will the device go into DFU mode if the MBR and Settings data is erased with only MBR+SD+BL flashed ?
2) I have noticed that the MBR also contains default data/references to Bootloader address and MBR data as placed in the UICR->NRFFW[1] and UICR->NRFFW[0].
    Should I only be concerned about UICR->NRFFW[..] ?
3) Is there a way to jump directly into another application without doing the UICR->NRFFW[0] / NVIC_SystemReset() ?

Thanks :-) 

  

Related