FOTA Using BLE with python

Hi All,

I am implementing BLE-based FOTA for the application core on an nRF5340 using MCUboot. The update works successfully when using the nRF Connect mobile app, but when I attempt the update using my Python script with Bleak, the firmware does not apply after reboot.

Issue Details:

  • The firmware file is sent chunk by chunk over BLE.
  •  I am not receiving any notifications for data transfer.
  • The device does not reboot into the new firmware after the upload.
  • Manually rebooting does not apply the update.
  • The same firmware file updates correctly using the nRF Connect mobile app.

My Setup:

  • Device: nRF5340
  • Bootloader: MCUboot
  • BLE Library: Bleak (Python)
  • Firmware Update Protocol: SMP over BLE
  • MTU Size: Detected as 512 bytes
  • Chunk Size: 200 bytes

Observations & Debugging Attempts:

  1. Notifications: Notifications are never received for chunk transfer but got notifications for reading image list attribute.
  2. Timing: I added small delays (0.05s) between chunks, but it did not resolve the issue.
  3. Confirm Command: I send an SMP_IMG_CONFIRM command, but the update does not apply.
  4. Manual Reboot: Even after a manual reboot, the new firmware is not active.
  5. Logging: I have not seen any errors in my Python script, but I suspect the device is not fully processing the uploaded chunks.
Related