SMP OTA over BLE (Zephyr + nRF54L15) packet format for flutter

Hi,

we are implementing MCUmgr SMP OTA over BLE (Zephyr + nRF54L15) with flutter, and I want to confirm that I’m generating the correct SMP upload packet format before streaming firmware to the device.

What we have done so far,

1- Chunked the firmware into 120-byte blocks.

  • We tried chunkSize = 400, but this caused:

    GenericFailure<WriteCharacteristicFailure>(code: WriteCharacteristicFailure.unknown, message: "GATT exception from MAC='XX:XX:XX:XX:XX:XX', status 19 (GATT_CONN_TERMINATE_PEER_USER), type BleGattOperation{description='CHARACTERISTIC_WRITE'}.

    we reduced to chunkSize = 120, ( 120 bytes binary -> ~160 bytes Base64 -> ~180–200 bytes final SMP packet )
     

2- Built correct SMP Upload Packets (Header + CBOR + Base64)

  • for packet zero,
    {
      "off": 0,
      "data": "<base64>",
      "len": <full firmware size>
    }
    others,
    {
      "off": <offset>,
      "data": "<base64>"
    }
  • And header we use this format,
    [
        0x02,                // Operation: Write request
        0x00,                // Flags
        (cborBytes.length >> 8) & 0xFF, // Payload length (high byte)
        cborBytes.length & 0xFF,        // Payload length (low byte)
        0x00, 0x04,          // Group = 0x0004 (Image Management)
        seq & 0xFF,          // Seq number
        0x01,                // Command = 0x01 (Upload)
    ].

But the notification response from device shows: { "rc" = 8 }.

seq & 0xFF,   // Seq number

Should seq be always less than 256 ?

Can anyone help identify the fix for this problem or share the correct packet format (header + CBOR) that Zephyr/nRF MCUmgr expects?
 

Parents Reply Children
  • Hi Vidar,

    Thanks for pointing that out. Yes, we have tried using the mcumgr Flutter library earlier. However, our project relies on flutter_reactive_ble for BLE management, and we ran into compatibility issues between mcumgr and flutter_reactive_ble.

    We're now planning to test mcumgr together with Flutter Blue Plus to see if that resolves the problem. I will let you know.

    Best regards,
    Jishnu

Related