nRF51822 & Zephyr - OTA DFU

Hello, everyone!

We have nRF51822 SoC running Zephyr OS. We would like to have the ability to perform OTA DFU. Given the fact that nRF51822 has only 256KB of flash memory, we have separated the Zephyr part from the application code so that we can update only the application part and leave the Zephyr part intact. Here is how our memory is partitioned:

As you can see, App Slots 1 and 2 are used for storing the application code. Scratch partition helps during the image swap process (link). We flash the Zephyr partition just once and don't touch it during the OTA DFU process.

It seems that we can successfully perform OTA DFU only if the new image is very similar to the one running on the Heart device. For example, if we just change the content in one line of the debug log and create a .bin file for OTA DFU, we can successfully update the FW and a new version of it will run properly.

On the other side, if we add a new function in the code, or if we add some additional small CPU activity in the existing function, a new version of the FW will cause HardFaults after OTA DFU. We can transfer the image over BLE, detect it on the device side, confirm it, and restart the device, but the new version of the FW will cause the HardFaults.

Do you have any idea about what we are missing here?

Thanks in advance for your time and efforts.

Sincerely,
Bojan.

Related