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

How to implement DFU in NRF52 [BMD301] via BLE and UART Method simultaneously?

Hi,

  • I have used BMD301 BLE chip. I have connected one wifi chip "ESP02" with BMD301 chip via UART.
  • I am using nRF5_SDK_15.3.0_59ac345 for my ble application firmware.
  • Currently I have implemented DFU in my application firmware. I am able to update BMD301 firmware via NRF Connect app.
    It works fine. For that, I have used the below example for a bootloader.
    • Bootloader : nRF5_SDK_15.3.0_59ac345\examples\dfu\secure_bootloader\pca10040_ble 
    • Main application firmware : nRF5_SDK_15.3.0_59ac345\examples\ble_peripheral\ble_app_buttonless_dfu
  • Now I want to update BMD301 firmware via UART and BLE both.

As I have seen in SDK examples, There are some examples for bootloader.
nRF5_SDK_15.3.0_59ac345\examples\dfu\secure_bootloader\pca10040_ble,
nRF5_SDK_15.3.0_59ac345\examples\dfu\secure_bootloader\pca10040_uart

Can you guide me, How can I implement DFU in BMD301 via BLE and UART simultaneously?
What change I have to make in "sdk_config.h"? Please share all the required steps.

Thanks.

Parents
  • I'm out of time for today, but really quickly explained, you just need to add the transport .c and .h files to your bootloader project. Start with the ble bootloader project, and look for the .c/.h file that has the TRANSPORT_INIT or something function for uart in the serial bootloader project, then add these files to the ble bootloader project. Let me know if you can't find it.

    Best regards,

    Edvin

Reply
  • I'm out of time for today, but really quickly explained, you just need to add the transport .c and .h files to your bootloader project. Start with the ble bootloader project, and look for the .c/.h file that has the TRANSPORT_INIT or something function for uart in the serial bootloader project, then add these files to the ble bootloader project. Let me know if you can't find it.

    Best regards,

    Edvin

Children
  • Thanks Edvin.

    I have checked, there are different transport files in the library. Can you guide me on which transport file I  should use?

    If possible I want to check uart bootloader first. Can you guide me for that?

    How can I test the UART bootloader? 

    How can I upload firmware BMD301 via UART?

    Which tool or software required for that? Guide me.

  • Hello,

    If you want both UART and BLE, I suggest you start with the BLE bootloader, because there is a lot more work and a lot more places to do the wrong thing when you are adding the softdevice, than when you add the UART. 

    Start with the pca10040_ble project, and add the file: nrf_dfu_serial_uart.c to your project. This contains the function:

    DFU_TRANSPORT_REGISTER(nrf_dfu_transport_t const uart_dfu_transport) =
    {
        .init_func  = uart_dfu_transport_init,
        .close_func = uart_dfu_transport_close,
    };

    Which does some magic things, so that the function nrf_dfu_transports_init() will pick it up in DFU_TRANS_SECTION_ITEM_GET(i);

    From there is pretty much plug and play.

     

    VIJAY said:
    How can I test the UART bootloader? 

     If you have never used the bootloader before, I suggest you check out this guide. Test the BLE first. Then, when you are ready for UART, test the standalone UART bootloader, and use nrfutil to generate the packet as described in the guide, and use nrfutil dfu serial ... to send the packet.

    Use the command nrfutil dfu serial --help to get some input parameter help.

    You can also check out the documentation of nrfutil, and how to use it here.

     

    VIJAY said:
    How can I upload firmware BMD301 via UART?

     You need to program the bootloader on the BMD301 with a programmer first (unless the producers of BMD have already pre-programmed a bootloader, in that case, you need to check with them). 

    When you have programmed the bootloader, you can use "nrfutil dfu ble ..." to perform a DFU.

     

    VIJAY said:
    Which tool or software required for that? Guide me.

     nrfutil. Check out the DFU getting started guide (the first link) for how to install and use it.

    Best regards,

    Edvin

  • Thanks, Edvin.

    I have checked Secure DFU bootloader for BLE. I have created a private key and generated bootloader.hex file. I have created app.hex by merging bootloader, setting, soft device and main application code. Its work fine, I am able to DFU via NRF Connect app.

    Now I have seen same main.c for following project in my SDK.

    nRF5_SDK_15.3.0_59ac345\examples\dfu\secure_bootloader\pca10040_ble,
    nRF5_SDK_15.3.0_59ac345\examples\dfu\secure_bootloader\pca10040_uart

    To test BLE DFU, I have merged below project hex file.

    nRF5_SDK_15.3.0_59ac345\examples\ble_peripheral\ble_app_buttonless_dfu

    Now, I am able to compile above both project successfully. I haven't seen any differences in main.c for the above two project.

    So for uart dfu bootloader, Can I use "pca10040_uart" hex file?

    Will it make my solution if I only want to check uart bootloader?

    Which application project I should merge with uart bootloader to check DFU for UART? 

    this one?

    UART DFU Master code: DFUMaster_UART.zip

    https://devzone.nordicsemi.com/cfs-file/__key/communityserver-blogs-components-weblogfiles/00-00-00-00-14/DFUMaster_5F00_UART.zip

    Guide me.

    Thanks for your support.

  • VIJAY said:
    Guide me.

     I'll try Slight smile

     

    VIJAY said:

    Now I have seen same main.c for following project in my SDK.

    nRF5_SDK_15.3.0_59ac345\examples\dfu\secure_bootloader\pca10040_ble,
    nRF5_SDK_15.3.0_59ac345\examples\dfu\secure_bootloader\pca10040_uart

     Yes. The main.c file for all the bootloaders is the same, which is good when you want to merge bootloaders. The only thing you need to do is to add the .c file that sets the DFU transport. 

    In fact, they use the very same main.c file, located in SDK\examples\dfu\secure_bootloader\main.c. You will see that if you change something in the main.c file in one of the projects, that change is applied to all the other bootloaders as well. 

    To test the UART bootloader, you can use the pca10040_uart project, yes. Remember that you may need to change the board file, as you would with any project using the BMD module. 

    On the Nordic nRF52832 DK, the UART pins P0.08 and P0.06 are routed through the debugger, and translated to UART over USB. Is it the same on your DK? You can test this by testing some of the UART examples from SDK\examples\peripheral. Alternatively, if you see UART logging in e.g. the SDK\examples\ble_peripheral\ble_app_hrs example, this is through the UART. 

    So you need to check that that is the same on your development board. I am not familiar with it. It needs a debugger that routes UART traffic to the DK in order to use the UART bootloader.

    BR,

    Edvin

Related