Hello,
Dev board: nRF52840 development board.
OS: Zephyr (NCS v2.6.0).
My requirement and What I am using...
- I want to perform DFU for application core & bootloader.
- I am using NSIB+MCUBoot+Application.
- I have custom DFU characteristic in BLE peripheral to receive .bin file data in chunks from BLE central device.
What I have performed so far (for application DFU)...
- In application firmware:
- I am successfully able perform the DFU for application core by receiving the .bin file data (using app_update.bin) in chunk from BLE central device over custom DFU characteristic.
- Then I am able to write those chunks in secondary slot (PM_MCUBOOT_SECONDARY_ID) using following code...
struct flash_img_context fic; flash_img_init_id(&fic, PM_MCUBOOT_SECONDARY_ID); boot_erase_img_bank(PM_MCUBOOT_SECONDARY_ID); flash_img_buffered_write(&fic, &data[0], FILE_SIZE, true); boot_request_upgrade(BOOT_UPGRADE_PERMANENT);
- Then I soft reset the BLE peripheral device and MCUBoot will successfully validate & swap the new application image from secondary slot to primary slot and then new application image gets started onwards.
What I have performed so far (for bootloader DFU)...
- I know that, I should use *_b0_s1_image_update.bin file for slot1 and *_b0_s1_image_update.bin file for slot0.
- In application firmware:
- I am using signed_by_mcuboot_and_b0_s1_image_update.bin file and successfully able to receive the chunk of it from BLE central device over custom DFU characteristic.
- I am using following code to write those chunks in slot1 (PM_S1_ID)...
struct flash_img_context fic;
flash_img_init_id(&fic, PM_S1_ID);
boot_erase_img_bank(PM_S1_ID);
flash_img_buffered_write(&fic, &data[0], FILE_SIZE, true);
- Now the problem is, I get bus fault and BLE peripheral device gets restarted during the use of the function flash_img_buffered_write(&fic, &data[0], FILE_SIZE, true).
- My question is, How can I successfully write .bin file data in slot1 using flash_img_buffered_write?. Is there any other way to do so?. Is there any other way to perform bootloader DFU?.