OTA firmware updates failing on nRF52840

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
sminogue
 
Posts: 46
Joined: Sun Oct 04, 2020 9:35 am

OTA firmware updates failing on nRF52840

Post by sminogue »

I am trying to do an OTA firmware update on my device but I'm getting failure. I started with: https://github.com/adafruit/Adafruit_nR ... leuart.ino which uses BLEDfu.

When I try and use the "update" feature on the Bluefruit Connect application it says its not compatible with my legacy bootloader. When clicking the info option on bluefruit connect Device info shows it to be:
Firmware Revision: s140 6.1.1
Software Revision: 0.22.0

I came across a post saying this feature of the bluefruit connect isnt actually working and I should use nRF Toolbox instead. Pulling down nRFToolBox onto my iphone works and its able to see my device. I loaded the map.ino.zip which is created during compile onto a location my phone can see and attempted to use nRFToolBox to push my compiled sketch to the device.

It reads the zip properly and nrfToolBox seems happy with the file I am trying to flash: After selecting my package it reads it and gives me a screen showing it recognizes the package to be an application (for grins I grabbed another random zip and it caused an error as expected). It shows my device and a status of Disconnected and gives me a button to "Update".

When I click update it says its connecting to the device, then says its enabling DFU mode (at which point a small redlight starts flashing on the board just like when doing an upload over usb). Then the nrfToolBox fails and gives me an error that it failed to connect to the device. (The little red light stays flashing after this btw).

What exactly am I doing wrong here?


EDIT: Used nRFConnect and it gave me some logs while giving me the same behavior as nRFToolbox. Logs here:

Code: Select all

File Name: map.ino.zip
Parts: 1
Size: 165 KB
Soft Device Size: Zero KB
Bootloader Size: Zero KB
[Callback] Central Manager did update state to: Powered ON
Connecting to Dewdrop...
centralManager.connect(peripheral, options: nil)
[Callback] Central Manager did connect peripheral
Connected to Dewdrop
Discovering services...
peripheral.discoverServices(nil)
Services discovered
Starting Legacy DFU...
Connected to Dewdrop
Services discovered
Legacy DFU Service found
Discovering characteristics in DFU Service...
peripheral.discoverCharacteristics(nil, for: 00001530-1212-EFDE-1523-785FEABCD123)
DFU characteristics discovered
Reading DFU Version number...
peripheral.readValue(00001534-1212-EFDE-1523-785FEABCD123)
Read Response received from 00001534-1212-EFDE-1523-785FEABCD123, value (0x): 0100
Version number read: 0.1
Enabling notifications for 00001531-1212-EFDE-1523-785FEABCD123...
peripheral.setNotifyValue(true, for: 00001531-1212-EFDE-1523-785FEABCD123)
Notifications enabled for 00001531-1212-EFDE-1523-785FEABCD123
DFU Control Point notifications enabled
Application with buttonless update found
Writing to characteristic 00001531-1212-EFDE-1523-785FEABCD123...
peripheral.writeValue(0x0104, for: 00001531-1212-EFDE-1523-785FEABCD123, type: .withResponse)
[Callback] Central Manager did disconnect peripheral
Disconnected by the remote device
Connecting to Dewdrop...
centralManager.connect(peripheral, options: nil)
Connection timeout!
centralManager.cancelPeripheralConnection(peripheral)
[Callback] Central Manager failed to connect to peripheral (timeout)


User avatar
Gatze
 
Posts: 12
Joined: Tue Sep 28, 2021 2:59 am

Re: OTA firmware updates failing on nRF52840

Post by Gatze »

If I connect with my device it say's:

Software Revision:
1.0.0

So probably you have to update the bootloader, can be done with Arduino IDE -> Tools -> Programmer -> Bootloader DFU for Bluefruit nRF52
and then Tools -> Burn Bootloader

User avatar
sminogue
 
Posts: 46
Joined: Sun Oct 04, 2020 9:35 am

Re: OTA firmware updates failing on nRF52840

Post by sminogue »

ok I have done that... still getting the same behavior. I will note the version showing up for the burn boot loader is 0.3.2 s140 6.1.1 not 1.0.0. How do I give Arduino IDE a later version to burn?

Well kind of... it still fails but its wiped my sketch from the board after it has failed but didnt put the new sketch on it. Error behavior appears the same but I am ending up with apparently a blank board.

Any other diagnostic I should do to see what is going on in this thing?

User avatar
Gatze
 
Posts: 12
Joined: Tue Sep 28, 2021 2:59 am

Re: OTA firmware updates failing on nRF52840

Post by Gatze »

I'm probably wrong about the version number, sorry for that. Here is my log for upgrading the bootloader:

Code: Select all

C:\Users\Gatze\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\1.0.0/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe --verbose dfu serial -pkg C:\Users\Gatze\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\1.0.0/bootloader/feather_nrf52832/feather_nrf52832_bootloader-0.6.1_s132_6.1.1.zip -p COM3 -b 115200 --touch 1200 
Upgrading target on COM3 with DFU package C:\Users\Gatze\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\1.0.0\bootloader\feather_nrf52832\feather_nrf52832_bootloader-0.6.1_s132_6.1.1.zip. Flow control is disabled, Dual bank, Touch 1200
Touched serial port COM3
Opened serial port COM3
Starting DFU upgrade of type 3, SoftDevice size: 147792, bootloader size: 21736, application size: 0
Sending DFU start packet
Sending DFU init packet
Sending firmware file
########################################
########################################
########################################
########################################
########################################
########################################
########################################
########################################
############
Activating new firmware

Device programmed.
It states version number 0.6.1, so that is probably the most recent.

No it isn't, the newest one is 0.6.2
https://github.com/adafruit/Adafruit_nR ... r/releases:

The 1.0.0 is the version of the nRF52 add-on

If I update in the Board Manager:
update.png
update.png (79.56 KiB) Viewed 195 times
Then I get the newest 0.6.2 bootloader when burning it:

Code: Select all

C:\Users\Gatze\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\1.1.0/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe --verbose dfu serial -pkg C:\Users\Gatze\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\1.1.0/bootloader/feather_nrf52832/feather_nrf52832_bootloader-0.6.2_s132_6.1.1.zip -p COM3 -b 115200 --touch 1200 
Upgrading target on COM3 with DFU package C:\Users\Gatze\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\1.1.0\bootloader\feather_nrf52832\feather_nrf52832_bootloader-0.6.2_s132_6.1.1.zip. Flow control is disabled, Dual bank, Touch 1200
Touched serial port COM3
Opened serial port COM3
Starting DFU upgrade of type 3, SoftDevice size: 147792, bootloader size: 21704, application size: 0
Sending DFU start packet
Sending DFU init packet
Sending firmware file
########################################
########################################
########################################
########################################
########################################
########################################
########################################
########################################
############
Activating new firmware
So probably updating the nRF52 library's from Adafruit in the Boards Manager will solve it.

User avatar
sminogue
 
Posts: 46
Joined: Sun Oct 04, 2020 9:35 am

Re: OTA firmware updates failing on nRF52840

Post by sminogue »

Awesome the bootloader looks like it went in just fine.

Code: Select all

C:\Users\Suzanne\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\1.1.0/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe --verbose dfu serial -pkg C:\Users\Suzanne\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\1.1.0/bootloader/feather_nrf52840_express/feather_nrf52840_express_bootloader-0.6.2_s140_6.1.1.zip -p COM5 -b 115200 --touch 1200 
Upgrading target on COM5 with DFU package C:\Users\Suzanne\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\1.1.0\bootloader\feather_nrf52840_express\feather_nrf52840_express_bootloader-0.6.2_s140_6.1.1.zip. Flow control is disabled, Dual bank, Touch 1200
Touched serial port COM5
Opened serial port COM5
Starting DFU upgrade of type 3, SoftDevice size: 151016, bootloader size: 39000, application size: 0
Sending DFU start packet
Sending DFU init packet
Sending firmware file
########################################
########################################
########################################
########################################
########################################
########################################
########################################
########################################
########################################
############
Activating new firmware

Device programmed.
DFU upgrade took 20.869709968566895s
After burning it my device mounts like an external flashdrive names FTHR840BOOT and I see there is a file INFO_UF2 containing:

Code: Select all

UF2 Bootloader 0.6.2 lib/nrfx (v2.0.0) lib/tinyusb (0.10.1-293-gaf8e5a90) lib/uf2 (remotes/origin/configupdate-9-gadbb8c7)
Model: Adafruit Feather nRF52840 Express
Board-ID: nRF52840-Feather-revD
SoftDevice: S140 version 6.1.1
Date: Sep 10 2021
So my laymans read of this is it looks like the bootloader has been updated. The board manager no longer shows the Adafruit nRF52 as being updatable (v1.1.0) and the version numbers and date in that INFO_UF2 file make me believe that I have indeed updated the bootloader.

It also appears that the sketch which was on my Adafruit was blown away during the process of burning a bootloader. So now I am launching Nordic Semiconductor's: nRF Connect and scanning for a device I can update. I dont see any devices which support DFU.

I went ahead and pushed my sketch to the device using the Arduino IDE and now I see my UART service advertised. When I connect to my device with nRF Connect and look at its "Advertisement" information I see:

Code: Select all

Connectable: Yes
Device Type: UART
Services: Nordic UART Service
DFU: No
MTU: 23 bytes
Tx Power: 4 dBm
Going back to the scanner and refreshing and searching the list shows me no bluetooth devices advertising they support DFU.

Any idea what I can try next? I was hoping that my problem was just an old version of the bootloader but it looks like there is something more I am missing.

User avatar
Gatze
 
Posts: 12
Joined: Tue Sep 28, 2021 2:59 am

Re: OTA firmware updates failing on nRF52840

Post by Gatze »

Just to be sure, you are using nRF Connect for Android ? There is also one for desktop and recently found out that the desktop version can not do legacy OTA.

Just tried with mine feather, altough the difference is that I'm using the nRF52832, I don't have native USB just like you, only serial to usb.

With my feather I can do OTA update with the new bootloader via nRF Connect for Android.
Screenshot_20211010-205318.png
Screenshot_20211010-205318.png (170.26 KiB) Viewed 184 times
Screenshot_20211010-205353.png
Screenshot_20211010-205353.png (99.07 KiB) Viewed 184 times
I hope it is the desktop or android thing of the nRF connect, otherwhise I'm almost out of thoughts what the problem could be.

The last thing I tried was to ground DFU and F.RST and push the reset button, it starts then as DFU OTA (first time I tried) and advertising as ADADFU, also then I can use OTA DFU:
Screenshot_20211010-210419.png
Screenshot_20211010-210419.png (91.69 KiB) Viewed 184 times

User avatar
Gatze
 
Posts: 12
Joined: Tue Sep 28, 2021 2:59 am

Re: OTA firmware updates failing on nRF52840

Post by Gatze »

Screenshot_20211010-210438.png
Screenshot_20211010-210438.png (142.66 KiB) Viewed 184 times
Hope it helps....

User avatar
sminogue
 
Posts: 46
Joined: Sun Oct 04, 2020 9:35 am

Re: OTA firmware updates failing on nRF52840

Post by sminogue »

Sorry for not getting back, kinda gave up on the OTA update... The only thing I can see different from what you're doing and what I am is I am using iOS rather than the Android version you are using. Maybe like the desktop version not supporting it maybe the iOS version isn't either.

Anyway, just too fragile and too much hassle for me to continue beating my head on it. Thanks for all the time and help on this! Maybe I will circle back to it someday, but its not a big enough win for me to spend more time on this now.

User avatar
Gatze
 
Posts: 12
Joined: Tue Sep 28, 2021 2:59 am

Re: OTA firmware updates failing on nRF52840

Post by Gatze »

You are welcome, hopefully it will succeed one day....;)

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”