Hi Mayank:
I had a similar requirement, also without a button on the same Nordic chip. I simply copied this file into my project, and called smp_svr_init() from my main() after bluetooth was up and running
zephyrproject/zephyr/samples/boards/nrf52/mesh/onoff_level_lighting_vnd_app/src/smp_svr.c
This creates a Bluetooth advertisement for OTA update, and I can push new images from mu Ubuntu system with:
Use mcumgr to upload the new version over Bluetooth
-----------------------------------------
sudo bash # must run as root to access the Bluetooth device
mcumgr conn add zephyr type=ble connstring=peer_name="My Device" # make a symbolic name for the device
mcumgr -c zephyr image list # Query device for its current image list.
mcumgr -c zephyr image upload build/zephyr/zephyr.signed.bin # Upload new image to device.
mcumgr -c zephyr image test <image-hash> # Tell the device to run the new image on its next boot ("test" the new image).
mcumgr -c zephyr reset # Reboot the device.
mcumgr -c zephyr image list # Query device for its current image list; ensure new image is running.
mcumgr -c zephyr image confirm # Make the image swap permanent.
You do need to get the right bits in your prj.conf file, I think these are all you need, but there may be more…
# mcuboot
CONFIG_IMG_MANAGER=y
CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_MCUBOOT_TRAILER_SWAP_TYPE=y
CONFIG_IMG_BLOCK_BUF_SIZE=512
# Allow for large Bluetooth data packets.
CONFIG_BT_L2CAP_TX_MTU=260
CONFIG_BT_RX_BUF_LEN=260
# Enable the Bluetooth and shell mcumgr transports.
CONFIG_MCUMGR_SMP_BT=y
#CONFIG_MCUMGR_SMP_SHELL=y
#CONFIG_MCUMGR_SMP_UART=y
# Required by the `taskstat` command.
#CONFIG_THREAD_MONITOR=y
# Enable statistics and statistic names.
#CONFIG_STATS=y
#CONFIG_STATS_NAMES=y
# Enable all core commands.
#CONFIG_MCUMGR_CMD_FS_MGMT=y
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y
#CONFIG_MCUMGR_CMD_STAT_MGMT=y
Unfortunately you will need to reflash your units with JTAG/SWD to get the smp_svr in, but after that you can do OTA.
Lawrence King
Principal Developer
+1(416)627-7302
Sent: Tuesday, December 3, 2019 6:47 AM
To: devel@...
Subject: [Zephyr-devel] DFU OTA by using mcuboot bootloader in serial recovery mode #ble #hci #nrf52480 #uart
Hello All,
Right now I'm exploring the best way to do DFU OTA.
I would like to ask that how i can do the DFU by booting the mcuboot bootloader in serial recovery mode.
I have one nrf52840_pca10056 chip integrated on my custom board, which has mcuboot as a bootloader. I don't have any direct pin access to the nrf chip.
I'm doing an OTA for zephyr's hci_uart sample application.
My aim is:
- Flash mcuboot
- Flash hci_uart application one time using Jlink segger (For beacon scanning)
- After that i should be able to do DFU OTA on field, without having any Jlink kind of wired connection.
Thanks,
Mayank