Hi,
I would like to implement DFU for my device over BLE.
To test, i followed the tutorial Add DFU support to your application .
As I use the Zephyr 2.4.1, i had to make some change so i add this on my prj.conf
CONFIG_ZCBOR=y # Enable mcumgr. CONFIG_MCUMGR=y CONFIG_STREAM_FLASH=y # Enable most core commands. CONFIG_IMG_MANAGER=y CONFIG_MCUMGR_GRP_IMG=y CONFIG_MCUMGR_GRP_OS=y # Ensure an MCUboot-compatible binary is generated. CONFIG_BOOTLOADER_MCUBOOT=y # Allow for large Bluetooth data packets. CONFIG_BT_L2CAP_TX_MTU=256 CONFIG_BT_BUF_ACL_RX_SIZE=256 # Enable the Bluetooth (unauthenticated) and shell mcumgr transports. CONFIG_MCUMGR_TRANSPORT_BT=y CONFIG_MCUMGR_TRANSPORT_BT_AUTHEN=n # Some command handlers require a large stack. CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
Then I compile and erase/flash my board (nrf5340dk).
I retrieve the dfu_application.zip and with nrf connect i start the DFU process.
I select "Test and confirm" and i got the popup "Application has been sent successfully".
So for now everything seems to be working fine.
Then i erase/flash my board (nrf5340dk) again.
After i change my CONFIG_BT_DEVICE_NAME "Nordic_LBS" by "Nordic_LTS" in order to see that my DFU worked fine easily with advertising name.
So I make a pristine build, get the dfu_application.zip and start the DFU process with nrf connect.
I select "Test and confirm" and then the DFU not working.
I get this message [McuMgr] Error: IN_VALUE (3). I join you the log of failure.
nRF Connect, 2023-10-05 Nordic_LBS (68:00:F1:24:66:15) Client Characteristic Configuration (0x2902) D 09:43:46.406 gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true) D 09:43:46.407 gatt.setCharacteristicNotification(00001524-1212-efde-1523-785feabcd123, true) V 09:43:49.022 [McuMgr] Connecting... D 09:43:49.028 [McuMgr] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, LE 1M) D 09:43:49.074 [McuMgr] [Callback] Connection state changed with status: 0 and new state: 2 (CONNECTED) I 09:43:49.079 [McuMgr] Connected to 68:00:F1:24:66:15 D 09:43:49.085 [McuMgr] wait(1600) I 09:43:50.174 Connection parameters updated (interval: 40.0ms, latency: 0, timeout: 420ms) I 09:43:50.182 [McuMgr] Connection parameters updated (interval: 40.0ms, latency: 0, timeout: 420ms) V 09:43:50.692 [McuMgr] Discovering services... D 09:43:50.700 [McuMgr] gatt.discoverServices() I 09:43:50.712 [McuMgr] Services discovered V 09:43:50.718 [McuMgr] Primary service found V 09:43:50.834 [McuMgr] Requesting new MTU... D 09:43:50.841 [McuMgr] gatt.requestMtu(498) I 09:43:51.034 [McuMgr] MTU changed to: 252 D 09:43:51.043 [McuMgr] gatt.setCharacteristicNotification(da2e7828-fbce-4e01-ae9e-261174997c48, true) V 09:43:51.052 [McuMgr] Enabling notifications for da2e7828-fbce-4e01-ae9e-261174997c48 D 09:43:51.059 [McuMgr] descriptor.setValue(0x01-00) D 09:43:51.066 [McuMgr] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb) I 09:43:51.137 [McuMgr] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb I 09:43:51.144 [McuMgr] Notifications enabled V 09:43:51.324 [McuMgr] Waiting for value change... V 09:43:51.332 [McuMgr] Writing characteristic da2e7828-fbce-4e01-ae9e-261174997c48 (WRITE COMMAND) D 09:43:51.339 [McuMgr] characteristic.setValue(0x000000010000FF06A0) D 09:43:51.345 [McuMgr] characteristic.setWriteType(WRITE COMMAND) D 09:43:51.352 [McuMgr] gatt.writeCharacteristic(da2e7828-fbce-4e01-ae9e-261174997c48) I 09:43:51.363 [McuMgr] Data written to da2e7828-fbce-4e01-ae9e-261174997c48 I 09:43:51.541 [McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 01-00-00-06-00-00-FF-06-BF-62-72-63-08-FF I 09:43:51.552 [McuMgr] Wait for value changed complete A 09:43:51.573 [McuMgr] Received Header (Op: 1, Flags: 0, Len: 6, Group: 0, Seq: 255, Command: 6) CBOR {"rc":8} W 09:43:51.579 [McuMgr] Error: NOT_SUPPORTED (8) A 09:43:51.630 [McuMgr] Sending (10 bytes) Header (Op: 0, Flags: 0, Len: 2, Group: 1, Seq: 0, Command: 0) CBOR {} V 09:43:51.641 [McuMgr] Writing characteristic da2e7828-fbce-4e01-ae9e-261174997c48 (WRITE COMMAND) D 09:43:51.649 [McuMgr] characteristic.setValue(0x0000000200010000BFFF) D 09:43:51.656 [McuMgr] characteristic.setWriteType(WRITE COMMAND) D 09:43:51.664 [McuMgr] gatt.writeCharacteristic(da2e7828-fbce-4e01-ae9e-261174997c48) I 09:43:51.673 [McuMgr] Data written to da2e7828-fbce-4e01-ae9e-261174997c48 I 09:43:51.861 [McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 01-00-00-86-00-01-00-00-BF-66-69-6D-61-67-65-73-9F-BF-64-73-6C-6F-74-00-67-76-65-72-73-69-6F-6E-65-30-2E-30-2E-30-64-68-61-73-68-58-20-DA-28-66-C9-5A-F4-5B-81-4C-F2-4E-26-59-38-47-C1-00-F9-12-73-E0-B3-05-3A-3F-0D-08-97-5C-9F-74-36-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F5-66-61-63-74-69-76-65-F5-69-70-65-72-6D-61-6E-65-6E-74-F4-FF-FF-6B-73-70-6C-69-74-53-74-61-74-75-73-00-FF A 09:43:51.877 [McuMgr] Received Header (Op: 1, Flags: 0, Len: 134, Group: 1, Seq: 0, Command: 0) CBOR {"images":[{"slot":0,"version":"0.0.0","hash":"2ihmyVr0W4FM8k4mWThHwQD5EnPgswU6Pw0Il1yfdDY=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false}],"splitStatus":0} V 09:43:51.920 [McuMgr] Uploading firmware... A 09:44:25.039 [McuMgr] 139592 bytes sent in 32940 ms (4.24 kB/s) A 09:45:01.862 [McuMgr] 190472 bytes sent in 32601 ms (5.84 kB/s) A 09:45:01.880 [McuMgr] Sending (10 bytes) Header (Op: 2, Flags: 0, Len: 2, Group: 63, Seq: 214, Command: 0) CBOR {} V 09:45:01.888 [McuMgr] Writing characteristic da2e7828-fbce-4e01-ae9e-261174997c48 (WRITE COMMAND) D 09:45:01.896 [McuMgr] characteristic.setValue(0x02000002003FD600BFFF) D 09:45:01.903 [McuMgr] characteristic.setWriteType(WRITE COMMAND) D 09:45:01.911 [McuMgr] gatt.writeCharacteristic(da2e7828-fbce-4e01-ae9e-261174997c48) I 09:45:01.922 [McuMgr] Data written to da2e7828-fbce-4e01-ae9e-261174997c48 I 09:45:01.980 [McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 03-00-00-06-00-3F-D6-00-BF-62-72-63-08-FF A 09:45:01.991 [McuMgr] Received Header (Op: 3, Flags: 0, Len: 6, Group: 63, Seq: 214, Command: 0) CBOR {"rc":8} W 09:45:01.998 [McuMgr] Error: NOT_SUPPORTED (8) V 09:45:02.016 [McuMgr] New state: TEST A 09:45:02.027 [McuMgr] Sending (58 bytes) Header (Op: 2, Flags: 0, Len: 50, Group: 1, Seq: 215, Command: 0) CBOR {"confirm":false,"hash":"IoIth3T7x3ZfeXxi154BEUGyibortKgzmyEAjGU8a2Y="} V 09:45:02.035 [McuMgr] Writing characteristic da2e7828-fbce-4e01-ae9e-261174997c48 (WRITE COMMAND) D 09:45:02.043 [McuMgr] characteristic.setValue(0x020000320001D700BF67636F6E6669726DF46468617368582022822D8774FBC7765F797C62D79E011141B289BA2BB4A8339B21008C653C6B66FF) D 09:45:02.050 [McuMgr] characteristic.setWriteType(WRITE COMMAND) D 09:45:02.056 [McuMgr] gatt.writeCharacteristic(da2e7828-fbce-4e01-ae9e-261174997c48) I 09:45:02.068 [McuMgr] Data written to da2e7828-fbce-4e01-ae9e-261174997c48 I 09:45:02.140 [McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 03-00-00-06-00-01-D7-00-BF-62-72-63-03-FF A 09:45:02.151 [McuMgr] Received Header (Op: 3, Flags: 0, Len: 6, Group: 1, Seq: 215, Command: 0) CBOR {"rc":3} W 09:45:02.159 [McuMgr] Error: IN_VALUE (3) V 09:45:02.178 [McuMgr] Disconnecting... D 09:45:02.186 [McuMgr] gatt.disconnect() D 09:45:02.210 [McuMgr] [Callback] Connection state changed with status: 0 and new state: 0 (DISCONNECTED) I 09:45:02.235 [McuMgr] Disconnected D 09:45:02.243 [McuMgr] gatt.close()
Why cannot success my DFU procedure ?
Is there something am i missing ?
My configuration are :
-IDE : Visual Studio Code
-Zephyr: V2.4.1
-OS: Windows
-Board: nrf5340
Best Regards,
Julien