Skip to content

Commit

Permalink
[nrfconnect] Enabled BLE advertising for DFU despite being provisione…
Browse files Browse the repository at this point in the history
…d. (#7081)

Currently BLE advertising is stopped after provisioning Thread,
and it cannot be restarted again. In order to perform Device
Firmware Upgrade over BLE we need having BLE advertising started,
so for now it is impossible to update firmware after provisioning.

* Modified condition to allow starting BLE advertising despite
having Thread provisioned in case of having also DFU enabled.
  • Loading branch information
kkasperczyk-no authored and pull[bot] committed Aug 4, 2021
1 parent 5a603e8 commit f9b8863
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 10 deletions.
21 changes: 17 additions & 4 deletions examples/lighting-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,20 @@ CHIP-enabled Thread network.

### Testing Device Firmware Upgrade

Read the section about downloading the new image to a device on the
[FOTA upgrades](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_nrf52.html#fota-upgrades)
page in the nRF Connect documentation to see how to upgrade your device firmware
over Bluetooth LE using a smartphone.
> **_NOTE:_** Currently performing DFU over BLE is supported only using
> smartphone with dedicated Nordic application installed.
To upgrade your device firmware over Bluetooth LE using smartphone, complete the
following tasks:

1. Install on your smartphone
[nRF Connect for Mobile](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Connect-for-mobile)
or
[nRF Toolbox](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Toolbox)
application.
2. Push **Button 4** on the device to start Bluetooth LE advertising.
3. Push **Button 1** on the device to enable software update functionality.
4. Follow the instructions in the section about downloading the new image to a
device on the
[FOTA upgrades](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_nrf52.html#fota-upgrades)
page in the nRF Connect documentation.
3 changes: 2 additions & 1 deletion examples/lighting-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent)
if (aEvent->ButtonEvent.PinNo != BLE_ADVERTISEMENT_START_BUTTON)
return;

if (chip::DeviceLayer::ConnectivityMgr().IsThreadProvisioned())
// In case of having software update enabled, allow on starting BLE advertising after Thread provisioning.
if (chip::DeviceLayer::ConnectivityMgr().IsThreadProvisioned() && !sAppTask.mSoftwareUpdateEnabled)
{
LOG_INF("NFC Tag emulation and BLE advertisement not started - device is commissioned to a Thread network.");
return;
Expand Down
21 changes: 17 additions & 4 deletions examples/lock-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,20 @@ CHIP-enabled Thread network.

### Testing Device Firmware Upgrade

Read the section about downloading the new image to a device on the
[FOTA upgrades](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_nrf52.html#fota-upgrades)
page in the nRF Connect documentation to see how to upgrade your device firmware
over Bluetooth LE using a smartphone.
> **_NOTE:_** Currently performing DFU over BLE is supported only using
> smartphone with dedicated Nordic application installed.
To upgrade your device firmware over Bluetooth LE using smartphone, complete the
following tasks:

1. Install on your smartphone
[nRF Connect for Mobile](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Connect-for-mobile)
or
[nRF Toolbox](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Toolbox)
application.
2. Push **Button 4** on the device to start Bluetooth LE advertising.
3. Push **Button 1** on the device to enable software update functionality.
4. Follow the instructions in the section about downloading the new image to a
device on the
[FOTA upgrades](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_nrf52.html#fota-upgrades)
page in the nRF Connect documentation.
3 changes: 2 additions & 1 deletion examples/lock-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,8 @@ void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent)
if (aEvent->ButtonEvent.PinNo != BLE_ADVERTISEMENT_START_BUTTON)
return;

if (ConnectivityMgr().IsThreadProvisioned())
// In case of having software update enabled, allow on starting BLE advertising after Thread provisioning.
if (ConnectivityMgr().IsThreadProvisioned() && !sAppTask.mSoftwareUpdateEnabled)
{
LOG_INF("NFC Tag emulation and BLE advertisement not started - device is commissioned to a Thread network.");
return;
Expand Down

0 comments on commit f9b8863

Please sign in to comment.