Handle OTA update on nRF52840 using an ESP32 with AT COMMANDS as Cloud Interface

Hi there, 

This topic coul be part of a BLOG POST called OTA updates of a Nordic Device I think Slight smile

Btw, my issue is this: Handle an OTA update of a Nordic Device, getting the firmware from cloud.

My actual system is composed by:

- ESP32 with AT-COMMANDS FW, which can GET from HTTP something, for example a .bin and store into its internal memory
- nRF52840 DK (it could be changed into 5340_DK in next months but we can deal on 52840 for now), which is connected to ESP32 and send over UART the AT-Commands for controlling ESP32
- nRF52840 Dongle as a Sensor System (BUT for NOW I'm not interested in OTA over BLE)

on every nRF52840 I'm using NCS 2.1.0, VScode extension.

So, basically, I  have to implement theese steps:


1) COMPILE the nordic project in order to be compatible with an OTA update (I don't know if it's necessary or just pick up .bin created by nRF connect for VSCode extension)
2) get this .bin from HTTP server using ESP32, and using UART it'll be received by nRF52840
3) once I have the .bin into RAM of nRF52840, I have to implement the ( ? CRC or Md5 ) to check if the .bin is okay and not corrupted during download
4) Copy to the internal FLASH memory of nRF52840_DK the .bin in a region empty (address for example 0x30000000)
5) Restart the microcontroller automatically,
6) enter a bootloader stage which picks-up from 0x30000000 and store into the program code memory zone
7) once it's finished to copy, start the new application

What I have to understand is how to implement theese parts, or if there's a quicker method to implement an update over the air in a semi-automatic way.

I suppose I have to implement an application part for points 1-5 and a bootloader for swapping the .bin

Can we make together a guide for this ? Open a blog post in order to give help to future guys who will be here at my same point, trying to update their magic devices?
Thank you guys, you rock it with your support!

  • Hello,

    What I have to understand is how to implement theese parts, or if there's a quicker method to implement an update over the air in a semi-automatic way.

    There some samples in the SDK that demontrate how to do firmware upgrades over the air. You can look at this sample, and port it to your device.

    Can we make together a guide for this ? Open a blog post in order to give help to future guys who will be here at my same point, trying to update their magic devices?

    If you want to write a blog post about this, that would be much appreciated and helpful to the community.

  • Hi Hakon, we talk with   in other posts about this issue.
    The example you quoted me is very interesting... 

    It seems to be something near my task... I have one question, as it's important:

    How much of that example and connected library can I re-use? 
    I mean, if I have to implement from scratch the 

    fmfu_fdev_load ( )

    Function ? 

    In that case, I have to re-implement also 
    nrf_modem_full_dfu_init ( ) 
    to put my nRF52840 in DFU mode ...? 

    It seems quite a huge work for something that is quite requested from the market, and that's why I asked if someone has implement already something to continue... I can and I'm happy to collaborate with someone in order to release a guide for FOTA updates with Nordic devs, but I'm not an extreme expert of Zephyr/NCS even if I had work on from some months ago... but alone, it could take months to make it from scratch.

    Thank you for your BIG support guys!
  • I'm assuming this is the post you are referring to.

    once I have the .bin into RAM of nRF52840, I have to implement the ( ? CRC or Md5 ) to check if the .bin is okay and not corrupted during download

    You don't need to implement this yourself, it will be handled by MCUboot. You will need to make sure that MCUboot uses the public key associated with the private key used to sign the .bin file.

    Also, have you tried to ask on this forum? It should be more helpful with ESP32 specific questions.

  • Hi  thank you so much, your help is really gold for me.

    That was not the post we discussed on with Simon, but it was quite exactly my situation.
    Uart connection between ESP32 and Nordic nRF52840 is implemented and working on my system, so the transfer of the bin should be quite easy.

    I have "only" to set up the transfer of the bin and the MCUboot settings for swapping the images. Smile

    I have to go deep into MCUBoot handling for understanding how to implement what you suggest. maybe this can help me...
    developer.nordicsemi.com/.../design.html

Related