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

DFU can not work right some times


Chip nrf51822 S110 nrf51_sdk_v6_1_0_b2ec2e6 Softdevice s110_nrf51822_7.0.0_softdevice.hex


I use "nrf51_sdk_v6_1_0_b2ec2e6\nrf51822\Board\pub\device_firmware_updates" for dual dfu update. It works will most of time. But sometimes when I finish dfu updata I get different m_image_crc from when update is success.

code:(dfu_dual_bank.c)

            m_image_crc = crc16_compute((uint8_t *)mp_storage_handle_active->block_id,
                                        m_image_size,
                                        NULL);
            received_crc = uint16_decode((uint8_t *)&m_init_packet[0]);

            if ((m_init_packet_length != 0) && (m_image_crc != received_crc))
            {
                return NRF_ERROR_INVALID_DATA;
            }

I found that m_init_packet_length = 0, it means during dfu update I had not receive "m_init_packet" and can not compare crc with Android or iOS APP

So how can I make my owm m_init_packet[16] and send it from App to ble device when it works under dfu mode?

  • Hi GootooMoon,

    On SDK v6.x DFU bootloader the init packet is optional and we don't send the init packet in the app. On SDK v7.x DFU bootloader the init packet is obligated, however the init packet is not the same as on SDK v6.x where the init data is only CRC. On SDK 7.x what in the init packet is defined here.

    On SDK v6.x the init packet is basically 2 bytes CRC. So you can simply send opcode 2 to the DFU control point characteristic, and send the 2 bytes CRC to the DFU packet characteristic. This shoudl be done before you send the image (Opcode 3). Please have a look here.

Related