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

Custom DFU bootloader

Hi,

I have a custom board with the nRF52840.

Is it possible to customize the DFU to be able to update the firmware through other interfaces than BLE or USB/UART?

I have a SD-card connected and would like to check for a flash image on the card and then update the firmware if there is an image.

Would that be possible?

  • Hi Morten,

    the Secure Bootloader in our nRF5 SDK is designed to be transport agnostic. so it should be able to create a custom transport layer, e.g. SPI, that interfaces with the bootloader. 

    I would recommend taking a look at the UART transport layer implementation in the nRF5_SDK_15.3.0_59ac345\examples\dfu\secure_bootloader\pca10056_uart example. Specifically, nrf_dfu_serial_uart.c and nrf_dfu_serial.c in the nRF5_SDK_15.3.0_59ac345\components\libraries\bootloader\serial_dfu folder.

    They show how the DFU_TRANSPORT_REGISTER macro to register the init and close functions used further up in the bootloader

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

    Best regards

    Bjørn

  • Hello, did you ever get it to work? 

    I have a similar problem for my pca10040/S132 (Laird BL652), and am getting really confused by the cryptic barely documented DFU interface.  I noticed that one example uses pstorage, is that the way to bypass all that?  I suddenly have clients breathing down my neck wanting a firmware update to allow SD-card firmware updates before end customer distribution.  ;-)  

    Thank you,

    -Erik

  • Hi,

    I did get it to work, but doing some reverse engineering.

    I made use of the Background DFU - that are running inside my application. So I have access to all my peripherals - including my SPI interface to my external sd-card running with FatFS.

    In my program I check the sd-card for a specific bootloader file, and if that exists I go to a state where I read the file 1 byte at a time.

    I added the UART bootloader to my code and commented out the interrupt routines and added my own function to call. Then I can pass the byte I read from the file to the UART bootloader.

    In order to get it to work I had to make a file-converter that actually reads the .zip package, that are normally used by the bootloader, and convert it to a new file that also contains the DFU package info (because this is normally handled by the interface program on the PC).

    Hope this helps a little - if you like I will be happy to share my code for the bootloader and the file-converter with you.

    -Morten

  • Marten,

    Oh!  Please!  Anything that helps.  I don't understand why I am having so much trouble with this when I had little problem with everything else (except for a library bug which I fixed), so anything that gives me a light bulb over my head is great.

    Thanks,

    -Erik

  • I have attached my main.c file and the nrf_dfu_serial_uart that I uses.

    I have removed most of the code from my main file, but you can see the state where I do the bootloader.

    nrf_dfu_serial_uart.zip

Related