This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NCS OTA DFU failed in nrf52832

Hi,

 I am trying to test and develop the DFU-OTA in nRF CONNECT SDK for nRF52832

I followed these link to develop  i am using NCS v1.4.2

1. I have copied the peripheral_lbs code to my workspace

2. Based on the link i have added few things and here i attached the related files

main.c

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
* Copyright (c) 2018 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
*/
#include <zephyr/types.h>
#include <stddef.h>
#include <string.h>
#include <errno.h>
#include <sys/printk.h>
#include <sys/byteorder.h>
#include <zephyr.h>
#include <drivers/gpio.h>
#include <soc.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/conn.h>
#include <bluetooth/uuid.h>
#include <bluetooth/gatt.h>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

prj.conf

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
#
CONFIG_NCS_SAMPLES_DEFAULTS=y
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Nordic_Blinky"
# Enable the LBS service
CONFIG_BT_LBS=y
CONFIG_BT_LBS_POLL_BUTTON=y
CONFIG_DK_LIBRARY=y
# Added for FOTA
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUMGR=y
CONFIG_MCUMGR_CMD_OS_MGMT=y
CONFIG_MCUMGR_CMD_IMG_MGMT=y
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

also added full .zip file here

1447.dfu_app.zip

3. After successful compilation of the code uploaded to the Empty nRF52 DK (there is no bootloader separately added before )

4. Successfully showing the services in the nRF connect APP while entering into DFU

5. On the other-side i have just changed the device name to dfu_nrf_blinky

6. taken the build and app_update.bin is taken to mobile device

7. While initialize the DFU it asked for pairing and also paired with the device with valid key.

8. And on entering to start DFU it was disconnected like this and video is linked below with respective log

Log in the serial

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
*** Booting Zephyr OS build v2.4.0-ncs2 ***
[00:00:00.528,289] [0m<inf> mcuboot: Starting bootloader[0m
[00:00:00.534,576] [0m<inf> mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3[0m
[00:00:00.545,043] [0m<inf> mcuboot: Boot source: none[0m
[00:00:00.550,781] [0m<inf> mcuboot: Swap type: none[0m
[00:00:00.844,512] [0m<inf> mcuboot: Bootloader chainload address offset: 0xc000[0m
[00:00:00.852,508] [0m<inf> mcuboot: Jumping to the first image slot[0m
*** Booting Zephyr OS build v2.4.0-ncs2 ***
Starting Bluetooth Peripheral LBS example
Application build time: Mar 15 2021 14:36:28
I: 2 Sectors of 4096 bytes
I: alloc wra: 0, ff0
I: data wra: 0, 0
I: SoftDevice Controller build revision:
I: cf 5c 0f 11 88 9c d7 02 |.\......
I: 15 27 c7 c3 ca 60 19 85 |.'...`..
I: b7 c4 50 e3 |..P.
I: No ID address. App must call settings_load()
Bluetooth initialized
Advertising successfully started
Connected
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Log from the nrf connect APP

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
nRF Connect, 2021-03-15
Nordic_Blinky (FB:B4:FA:11:EB:63)
V 14:54:14.912 Connecting to FB:B4:FA:11:EB:63...
D 14:54:14.912 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
D 14:54:15.042 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
D 14:54:15.096 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
I 14:54:15.097 Connected to FB:B4:FA:11:EB:63
D 14:54:15.099 wait(1600ms)
D 14:54:15.360 [Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDING (11)
D 14:54:15.421 [Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDED (12)
I 14:54:15.421 Device bonded
I 14:54:15.616 Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
I 14:54:16.023 Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms)
V 14:54:16.700 Discovering services...
D 14:54:16.700 gatt.discoverServices()
D 14:54:16.713 [Callback] Services discovered with status: 0
I 14:54:16.714 Services discovered
V 14:54:16.737 Generic Attribute (0x1801)
- Service Changed [I] (0x2A05)
···Client Characteristic Configuration (0x2902)
- Client Supported Features [R W] (0x2B29)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
nRF Connect, 2021-03-15
Nordic_Blinky (FB:B4:FA:11:EB:63)
V 15:07:18.490 [McuMgr] Connecting...
D 15:07:18.500 [McuMgr] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, LE 1M)
D 15:07:18.520 [McuMgr] [Callback] Connection state changed with status: 0 and new state: 2 (CONNECTED)
I 15:07:18.534 [McuMgr] Connected to FB:B4:FA:11:EB:63
D 15:07:18.548 [McuMgr] wait(1600)
V 15:07:20.167 [McuMgr] Discovering services...
D 15:07:20.176 [McuMgr] gatt.discoverServices()
I 15:07:20.198 [McuMgr] Services discovered
V 15:07:20.229 [McuMgr] Primary service found
I 15:07:20.257 [McuMgr] Service Changed characteristic found on a bonded device
D 15:07:20.268 [McuMgr] gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
V 15:07:20.290 [McuMgr] Enabling indications for 00002a05-0000-1000-8000-00805f9b34fb
D 15:07:20.299 [McuMgr] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x02-00)
I 15:07:20.379 [McuMgr] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 02-00
I 15:07:20.390 [McuMgr] Service Changed notifications enabled
V 15:07:20.417 [McuMgr] Requesting new MTU...
D 15:07:20.427 [McuMgr] gatt.requestMtu(515)
I 15:07:20.514 [McuMgr] MTU changed to: 65
D 15:07:20.525 [McuMgr] gatt.setCharacteristicNotification(da2e7828-fbce-4e01-ae9e-261174997c48, true)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX