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

Firmware transfer over BLE for another MCU

Hi,

We've a custom board which has NRF52832 and Maxime. They are connected over UART. ( I'm using ble_app_uart)

What I want is transfer binary data between Phone and nRF52 over BLE.  Is there any application example?

After receiving binary data from Phone, we will store it to external EEPROM on our custom board, and doing Maxmie update further.

The binary data actually is for Maxime update.

I've tried using UART for transferring binary.

As I googled, TX characteristic of UART service(ble_app_uart) on Phone has 20 bytes payload, our binary file has about 4xx kbytes.

It takes too much time when nRF52 receive from Phone over UART and send binary over UART between 52832 soc and Maxime soc.

So maybe the better way is using BLE from Phone to nRF52.

I've read https://devzone.nordicsemi.com/f/nordic-q-a/29028/download-firmware-over-ble-for-another-mcu.  Still confusing.

Is there application sample or guide for receiving data over BLE from Phone? Once nRF52 receives binary data, how to send binary packet over UART to Maxime.

Thanks.

Vick

Parents
  • Hi,

    I have further question about this case.

    Should I create new case?

    Our MCU image is about 450 kb, can it be saved to bank1 ? Is bank1 storage enough?

    52832 has 512KB flash, my application occupy 245 KB. (including ble_app_hrs, nus, i2c)

    If there is no enough space, how do I store MCU image?

    Thanks.

  • Hi Vick, 
    Please clarify that the external image is 450kB. You should check the binary image, not the hex file. 
    If it's required larger space than the available space in bank1, you would need to think about using an external flash storage. For example we have an MX25R6435F 64Mb on the nRF52840DK. 


    Another option is to store the image directly on your MCU flash storage if you have enough free space there. The image is transferred on the go when you receive it on the nRF52832. 

  • Yes you can base it on ble_app_uart. But it's pretty much on your own. We don't have any example for it yet. You would need to define your own UART DFU protocol to forward the image from BLE to UART and then after the image is received you may want to verify CRC, verify hash and signature. Similar to what we did in our bootloader. 

    But note that then you would need to design your own app on the phone as it would be your own protocol. 

    If you want to re-use our DFU app, you can think of other scenarios:

    - Still use the same bootloader, only change the part that instead of storing the data to flash, it will send it via UART to the external MCU. The verification of the signature is on the nRF52 bootloader. This requires minimal modification on the bootloader but there is a risk that attacker can intercept the UART communication and send malicious firmware to the external MCU if you don't have a way to verify it on the external MCU. 

    - Modify the bootloader so that the verification is on the external MCU and the bootloader only take the task of receiving the image, signature, etc and forward it to the external MCU. You need to implement the verification on the external MCU. 

  • Hi Hung,

    Thanks for clearly reply. If possible, we want minimal modification on bootloader sample and DFU apps on phone.

    But note that then you would need to design your own app on the phone as it would be your own protocol. 

    About the zip generation, transfer zip, and unzip, is that possible we can follow same implementation for our MCU bin file?

    BTW, I have check our MCU sbin file size is about 450 KB.

    Thanks!!

  • Hi Vick, 
    Please be aware that the .zip file is not transferred via BLE. It's unzipped by the app on the phone (or nRFUtil/nRFConnect on PC) and only the init packet and the binary image is transferred. 

    I would suggest you to go for the option to implement the BLE receiving and forwarding on UART on the bootloader on the nRF52. And then implement a similar bootloader on the Maxime MCU that can also do verification and DFU update. Something similar to our UART DFU bootloader on the nRF5 SDK. 

    Note that this is not a simple task and requires a deep understanding of the code of the bootloader. I would suggest you to get very familiar with the code of the bootloader. 

  • Hi Hung,

    1. About zip:  I see

    2.

    I would suggest you to go for the option to implement the BLE receiving and forwarding on UART on the bootloader on the nRF52. And then implement a similar bootloader on the Maxime MCU that can also do verification and DFU update. Something similar to our UART DFU bootloader on the nRF5 SDK. 

     Thanks for the suggestion!! It's helpful.

    3. I have other question about app on phone, does DFU app on phone have source code for reference?

    We may need to know how to transmit  MCU bin file over BLE, and then bootloader can receive it.

    Thanks.

  • Hi again Vick, 
    You can find the source code of the DFU app here: https://github.com/NordicSemiconductor/Android-DFU-Library

    The implementation of how to use the library is in the nRF Toolbox: github.com/.../Android-nRF-Toolbox

Reply Children
Related