Serial bootloader / DFU without softdevice and crypto

Hello DevZone,

On my board I have a nRF52810 and a nRF52840. I want to implement a serial bootloader for the nRF52810 and have the nRF52840 program it.

I have looked for example projects for DFU over serial and found only projects that have encryption built into the library.

Is there a example project available where I can use the bootloader / DFU without encryption? 

The nRF52810 does not use the softdevice, both devices are using the SDK 17.0.2, the nRF52840 does use the softdevice.

I'd preferably would use an example project but it should not be a problem if I have to write the bootloader / DFU myself.

Kind regards

Parents
  • Hi,

    For the nRF52810 I think the easiest would be to start with the pca10040e_uart project in nRF5_SDK_folder \examples\dfu\secure_bootloader. To relax the security, modify the settings similar to the Open Bootloader. https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/ble_sdk_app_open_bootloader.html

    Currently we don't have an official DFU Master code running on embedded chip (for example updating an nRF52 from another nRF52 via BLE or UART/SPI), but we have some unofficial code at chapter 6 in this post:  Getting started with Nordic's Secure DFU bootloader, a step by step guide 

  • Okay I think I have the bootloader/DFU side running. I have modified the open variant of the example project to use the UART instead of USB. (exlude nrf_dfu_serial_usb.c and add nrf_dfu_serial_uart.c)

    I am now trying to get the host side working. I am building from one of the examples at the bottom of 

    To be precise, UART DFU Master code: DFUMaster_UART.zip is what I've used.  

    I dont know if you know anything about this code but I have a question about some addresses and stuff. I could not find any information regarding these addresses. 

    void start_DFU(void)
    {
        uint32_t data_size;
        uint32_t application_image_address = 0x30000;
        nrf_gpio_pin_clear(LED_1);
        data_size = find_image_size(0x9000,0x10000);
        NRF_LOG_INFO("Init data size: %d", data_size);
        uint8_t *data;
        data= (uint8_t *) 0x9000;
        NRF_LOG_INFO("Data : %x %x %d", *data, *(data+1),MAX_ACTUAL_PAYLOAD);
        nrf_delay_ms(5);
        uart_send_init_packet(&m_dfu,(uint8_t *) 0x9000,data_size);
        nrf_delay_ms(500);
        
        data_size = find_image_size(application_image_address,application_image_address+0x40000);
        NRF_LOG_INFO("Image size: %d", data_size);
        //Max object size is 4096 bytes.

    First, an init packet is sent from address 0x9000 to 0x10000 ish, I cannot find anything that resembles this init packet. Is this required as I use an open bootloader? Ive read that this is a signed packet to prevent malicious attacks.

    To protect the target device against malicious attackers trying to impersonate the rightful sender of the firmware update, the init packet of the firmware package must be signed.

    Second is the application_image_address = 0x30000. I guess this is the address in memory where the image is located that has to be programmed in the other microcontroller. 

    When I try and load a image I get the message 

    <error> nrf_dfu_req_handler: Cannot create data object without valid init command

    Is there a step by step tutorial on how to perform DFU as a master or are there better examples available?

Reply
  • Okay I think I have the bootloader/DFU side running. I have modified the open variant of the example project to use the UART instead of USB. (exlude nrf_dfu_serial_usb.c and add nrf_dfu_serial_uart.c)

    I am now trying to get the host side working. I am building from one of the examples at the bottom of 

    To be precise, UART DFU Master code: DFUMaster_UART.zip is what I've used.  

    I dont know if you know anything about this code but I have a question about some addresses and stuff. I could not find any information regarding these addresses. 

    void start_DFU(void)
    {
        uint32_t data_size;
        uint32_t application_image_address = 0x30000;
        nrf_gpio_pin_clear(LED_1);
        data_size = find_image_size(0x9000,0x10000);
        NRF_LOG_INFO("Init data size: %d", data_size);
        uint8_t *data;
        data= (uint8_t *) 0x9000;
        NRF_LOG_INFO("Data : %x %x %d", *data, *(data+1),MAX_ACTUAL_PAYLOAD);
        nrf_delay_ms(5);
        uart_send_init_packet(&m_dfu,(uint8_t *) 0x9000,data_size);
        nrf_delay_ms(500);
        
        data_size = find_image_size(application_image_address,application_image_address+0x40000);
        NRF_LOG_INFO("Image size: %d", data_size);
        //Max object size is 4096 bytes.

    First, an init packet is sent from address 0x9000 to 0x10000 ish, I cannot find anything that resembles this init packet. Is this required as I use an open bootloader? Ive read that this is a signed packet to prevent malicious attacks.

    To protect the target device against malicious attackers trying to impersonate the rightful sender of the firmware update, the init packet of the firmware package must be signed.

    Second is the application_image_address = 0x30000. I guess this is the address in memory where the image is located that has to be programmed in the other microcontroller. 

    When I try and load a image I get the message 

    <error> nrf_dfu_req_handler: Cannot create data object without valid init command

    Is there a step by step tutorial on how to perform DFU as a master or are there better examples available?

Children
Related