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

nRF52 simple SPI bootloader problems

Hi,

I've managed to code an app for nRF52382 (S132, SDK14) which works properly. Also, I've taken "bootloader_secure_serial" and removed a lot of stuff to code a simple SPI bootloader which reads data from external SPI data flash.

So in short, what I did... I know the addresses: MBR: 0x0 - 0x1000, SoftDevice: 0x1000 - 0x23000, Application: 0x23000 - 0x79000, Bootloader: 0x79000 - 0x7E000, MBR data(?): 0x7E000 - 0x7F000, Empty(not used): 0x7F000 - 0x8000

Windows app is coded which splits MBR from SoftDevice hex (removes data from 0x0 to 0x1000), takes that data, takes application and bootloader and merges it into one binary file. It also adds CRC checks to data so it can be verified later.

Using mobile device, data is transferred and copied via nRF52 application to SPI data flash. When all data is copied, bootloader flags are raised and NVIC_SystemReset() is called so bootloader is started. In bootloader flags are checked, and if stored data(crc check) is valid data is flashed: 1.) First SoftDevice is copied using nvmc functions. 2.) Second is Bootloader, it's copied using MBR, command SD_MBR_COMMAND_COPY_BL. 3.) Third and final, application is copied using nvmc.

All that is completed without errors.

But, when everything is flashed and default function "nrf_bootloader_app_start" is called, code hangs(stucks, freezes!) at "nrf_dfu_mbr_init_sd()" call. I've read that this is because SoftDevice is already initialized. According to that, removing the call to "nrf_dfu_mbr_init_sd()" function results in another error from "sd_softdevice_vector_table_base_set()" function. It returns NRF_ERROR_SVC_HANDLER_MISSING.

This concept works flawlessly on nRF51, so I guess I'm missing some information for it to work on nRF52.

How to start the app correctly? Is there some other data which must be preserved(which I missed implementing this)?

Thanks!

Parents Reply Children
No Data
Related