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

  • Hi Vick Chang, 

    Have you tried to test with our BLE bootloader in nRF5 SDK ? 

    The bootloader by default will receive the image from the phone and replace the old image with the new image. 

    However, there is an experimental feature that if you turn on  , the bootloader will not replace the old image with the new image and instead just keep the image in Bank 1. In your application you then can write your own code to send the image in bank 1 to the Maxime. Here is the quotation from sdk_config.h about the feature: 

    // <q> NRF_DFU_SUPPORTS_EXTERNAL_APP - [Experimental] Support for external app.

    // <i> External apps are apps that will not be activated. They can
    // <i> e.g. be apps to be sent to a third party. External app updates
    // <i> are verified upon reception, but will remain in bank 1, and
    // <i> will never be booted. An external app will be overwritten if
    // <i> a new DFU procedure is performed. Note: This functionality is
    // <i> experimental and not yet used in any examples.

    #ifndef NRF_DFU_SUPPORTS_EXTERNAL_APP
    #define NRF_DFU_SUPPORTS_EXTERNAL_APP 0
    #endif

    I would suggest to get familiar with the DFU bootloader before you start the development of your own DFU protocol. 

  • Hi Hung,

    Have you tried to test with our BLE bootloader in nRF5 SDK ? 

    => Yes. I have just tried the flow, not look into the code yet.

    In your application you then can write your own code to send the image in bank 1 to the Maxime

    => That means after image saved into Bank 1,  I need to extract it and send to Maxmie over UART,  right?

    Could you share where is the point in code that I can handle the data from Bank1 ? Thank you! (I'm using SDK16.0.0)

    By the way, although image sending from Phone to nRF52 app over BLE should be fast.

    I saw the buffer in app_fifo_put  fifo is one byte, doesn't it take too much time to transfer 4xx Kbytes firmware from nRF52 app to Maxime over UART?

    Thanks.

    Vick

  • Hi Vick, 

    If you use NRF_DFU_SUPPORTS_EXTERNAL_APP = 1 the new image will be stored in bank 1 (right after the current application). After that the bootloader will simply switch to application. In your application you have full control of what you want to do with bank 1. In  your application you can check in the boodloader setting if bank 1 is assigned this flag: 

     s_dfu_settings.bank_1.bank_code = NRF_DFU_BANK_VALID_EXT_APP;

    Then you can start sending the image in bank 1 to the external IC. 

    Where do you find app_fifo_put () ? I'm not sure which application you are talking about ? Is it about UART communication ? 
    If you have a look at app_uart_put() in app_uart_fifo.c you can define the number of bytes you want to put into the fifo. 

  • 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.

Related