My setup include a nRF52840-DK board that has an ESP32 WiFi module connected to it via UART. The idea is to source the new firmware from a server located in the cloud.
I am getting really confused after reading all the information on DFU and how I should be doing it. Simon also recently posted an article on DFU using Connect SDK https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/ncs-dfu
However, we are not using NCS at the moment.
Questions that I asked myself or still confused about are:
- Should I be using background DFU or should I be modifying the bootloader to perform the DFU?
- Where do I get the bin file from? I have a .zip package from the build output. Is that the bin file to use?
- What is an init packet? Is that the .dat file that comes in the .zip package? How do you trigger the init packet? Via application or bootloader?
- What is this bootloader settings file?
- If I am using dual bank update, how do I specify the flash address for the second bank where the updated firmware gets written to?
- How to let the bootloader knows that there is a new firmware in the second bank for validation and swap over?
- What transport should I be looking at? I assume serial - UART?
My initial approach is to write my own in a simplified manner.
The application will issue HTTP GET to the server and retrieve data chunks of the binary until the whole bin file is received. As it receives the chunks, it writes to a flash location.
After the whole bin file is received, the CPU reboots and the application copies the new firmware, overriding the old firmware in place.
Will that "upset" the bootloader when it reboots next time seeing that the firmware signature is different from the one being overwritten?
This is not foolproof as there is no validation and checks for data corruption. It's also not the "proper" way that Nordic perform DFU.
I hope someone can help with those questions and shed some light on the best method to approach this (given my setup, NRF52-ESP32-cloud).
What are the articles that I should focus reading up on.