Feather nrf52 - OTA Software Updates

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.
User avatar
jcscott
 
Posts: 20
Joined: Thu Jul 06, 2017 8:19 am

Feather nrf52 - OTA Software Updates

Post by jcscott »

I have been trying for the last while to determine if there is a way to upgrade the software I've mounted on the Feather nrf52 without connecting to the device using USB. I've encountered a scenario where I'd like to mount prototype I'm making out of reach (at the top of a flag pole), and I would rather not have to retrieve it to change the software.

Is it possible to tap into the DFU OTA update functionality to update the software I've loaded initially from the Arduino IDE?

I appreciate any insight anyone can provide!

-J

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Feather nrf52 - OTA Software Updates

Post by adafruit_support_mike »

It's possible, but only as an unsupported, at-your-own-risk option:

https://learn.adafruit.com/bluefruit-nr ... bootloader

User avatar
jcscott
 
Posts: 20
Joined: Thu Jul 06, 2017 8:19 am

Re: Feather nrf52 - OTA Software Updates

Post by jcscott »

Thanks for getting back to me! Unfortunately, I have been unable to figure out how to move forward to achieve this. I'll revisit in the future but if anyone has any ideas, I'm all ears!

User avatar
hathach
 
Posts: 1270
Joined: Tue Apr 23, 2013 1:02 am

Re: Feather nrf52 - OTA Software Updates

Post by hathach »

there is a couple of topics on this. Basically, you copy the .zip file generated by Arduino compilation. Then use Nordic nrf toolbox app on mobile phone to perform the upgrade.

User avatar
jcscott
 
Posts: 20
Joined: Thu Jul 06, 2017 8:19 am

Re: Feather nrf52 - OTA Software Updates

Post by jcscott »

Thanks for the helpful tip hathach. I'll keep working on this and post my solution when I figure this out!

User avatar
bojh
 
Posts: 30
Joined: Thu Sep 28, 2017 5:17 am

Re: Feather nrf52 - OTA Software Updates

Post by bojh »

Hello,
I just mentioned, that the nordic "nrf Toolbox"-App (-DFU) on Android does find the AdaDFU service in the devices OTA status, but the according iOS nordic App does can not find this "AdaDFU" service. Why is there something missing?
This seems a little bit surprising for me, because I allready had managed a directly modified/installed OTA-DFU bootloader based on the nRF_SDK_11.0.0/examples/dfu/bootloader example source on another board, which has already worked also unter iOS. Is ther something specific with the adafruit bootloader DFU service?
Is the bootloader source available? I couldn't find it at the moment.

User avatar
hathach
 
Posts: 1270
Joined: Tue Apr 23, 2013 1:02 am

Re: Feather nrf52 - OTA Software Updates

Post by hathach »

You need a ble sketch e.g bleuart. Dfu serive is auto added when Bluefruit.begin() is called. There should be no issue to ota via ios. I did it with ios everytime I test OTA.

The bootloader code is not available due to license restriction from Nodic sdk 11 though.

User avatar
bojh
 
Posts: 30
Joined: Thu Sep 28, 2017 5:17 am

Re: Feather nrf52 - OTA Software Updates

Post by bojh »

Hello Hathach,
Yes I have a sketch with the bluefruit buildin DFU-Service. With the android Nordic nRF Tool App (DFU Library version 1.3.0) I can see the advertising AdaDfu service, but with the iOS App not.
Don't know why? Did you have the same DFU library on your iOS App (iOS: DFU Library version 3.0.6)

Next I have tried to upload with the Android app a *.zip package: which was build as follows:
./nrfutil-v052.exe dfu genpkg \
--application-version 0xFFFFFFFF \
--application dist/$BASE_NAME.hex \
--dev-type 0xFFFF \
--dev-revision 0xFFFF \
--sd-req 0xFFFE \
dist/$BASE_NAME.zip
This is my current way (/wo versioning) to create a new sketch distribution package a s132 based app for update - but I have got an Error: Upload failed: "REMOTE DFU OPERATION FAILED"

User avatar
bojh
 
Posts: 30
Joined: Thu Sep 28, 2017 5:17 am

Re: Feather nrf52 - OTA Software Updates

Post by bojh »

OK a step further:
A reboot of my iPhone has solved the iOS scan problem finding the AdaDFU service: I can see it for now!
But trying to upload a distribution *.zip package on iOS ..... does finish very fast!. The device does reboot - but as I can see: No new app/sketch is installed!
Status for me: Something is not correct at all! .... but no error message.
Did somebody have an idea, if the package (see above) is not bootloader conform? versioning issue?

User avatar
bojh
 
Posts: 30
Joined: Thu Sep 28, 2017 5:17 am

Re: Feather nrf52 - OTA Software Updates

Post by bojh »

.... and another step forward:
using the Adafruit Bluefruit app Updates DFU (Center Mode) Service "Use custom firmware" functionality we need the *.hex and init *.dat file.
Providing that as extract from the distribution *.zip does produce a message: "Operation failed. Ensure the firmware target that device type and version."
So my question is now: where can I get the device type and version info to set up init data for generation with the nordic tool?

User avatar
bojh
 
Posts: 30
Joined: Thu Sep 28, 2017 5:17 am

Re: Feather nrf52 - OTA Software Updates

Post by bojh »

... and another step:
I have found at the Arduino-IDE log the location creating the distribution package for serial update - looks like:
"C:\Users\xxxx\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.7.5/tools/nrfutil-0.5.2/binaries/win32/nrfutil.exe" dfu genpkg --dev-type 0x0052 --application "C:\Users\xxxx\AppData\Local\Temp\arduino_build_974452/my_app.ino.hex" "C:\Users\xxxx\AppData\Local\Temp\arduino_build_974452/my_app.ino.zip"
Zip created at C:\Users\xxxx\AppData\Local\Temp\arduino_build_974452/my_app.ino.zip
So next, I will try to set the right ---dev-type 0x0052 info.

User avatar
hathach
 
Posts: 1270
Joined: Tue Apr 23, 2013 1:02 am

Re: Feather nrf52 - OTA Software Updates

Post by hathach »

I mentioned this multiple times before. All you need to do is enable the compile log from Arduino. Then use the zip file IDE created at the end of the compilation progress to perform the ota.

User avatar
bojh
 
Posts: 30
Joined: Thu Sep 28, 2017 5:17 am

Re: Feather nrf52 - OTA Software Updates

Post by bojh »

Thanks for your help and sorry I haven't red it exactly: Who reads is clearly in the advantage! I will test that.

User avatar
bojh
 
Posts: 30
Joined: Thu Sep 28, 2017 5:17 am

Re: Feather nrf52 - OTA Software Updates

Post by bojh »

Well testet OTA DFU! - Thanks for your very good work - great job!

User avatar
bojh
 
Posts: 30
Joined: Thu Sep 28, 2017 5:17 am

Re: Feather nrf52 - OTA Software Updates

Post by bojh »

Coming back with Adafruit nrf52832 feather (v2) with updated board manager environment (see below) re-testing OTA.
But OTA does hang and never end rebooting again, while Nordic-App does circle in: "Enabling DFU Bootloader".
The app.ino.zip is directly build by the Arduino IDE and taken from the (win10) user/AppData/Local\Temp/arduino_build_xxxxx
Does anybody have an idea or can confirm that behavior?
with bondstore enabled:

Code: Select all

BSP Library : 0.9.2
Bootloader  : s132 6.1.1 r0
Serial No   : A2B511779BB930E4

--------- SoftDevice Config ---------
Max UUID128     : 10
ATTR Table Size : 2048
Service Changed : 1
Peripheral Connect Setting
  - Max MTU         : 23
  - Event Length    : 3
  - HVN Queue Size  : 1
  - WrCmd Queue Size: 1

--------- BLE Settings ---------
Name            : SBS-53369
Max Connections : Peripheral = 1, Central = 0 
Address         : ED:53:3A:5E:38:79 (Static)
TX Power        : 4 dBm
Conn Intervals  : min = 20.00 ms, max = 30.00 ms
Conn Timeout    : 2000.00 ms
Peripheral Paired Devices: 
  bb0a : My iPhone (129 bytes)


[BLE   ] BLE_GAP_EVT_CONNECTED : Conn Handle = 0
[GAP   ] Conn Interval= 30.000000
[BLE   ] BLE_GAP_EVT_SEC_INFO_REQUEST : Conn Handle = 0
[BOND  ] Loaded keys from file /adafruit/bond_prph/bb0a
[BLE   ] BLE_GAP_EVT_CONN_SEC_UPDATE : Conn Handle = 0
[BOND  ] Loaded CCCD from file /adafruit/bond_prph/bb0a ( offset = 96, len = 32 bytes )
[BLE   ] BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP : Conn Handle = 0
BLE Connected to: My iPhone
... paired!
[BLE   ] BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST : Conn Handle = 0
[GAP   ] ATT MTU is changed to 23
[BLE   ] BLE_GATTS_EVT_WRITE : Conn Handle = 0
[BLE   ] BLE_GATTS_EVT_WRITE : Conn Handle = 0
[GATTS ] attr's cccd
000:  01 00                              

[BOND  ] Saved CCCD setting to file /adafruit/bond_prph/bb0a ( offset = 96, len = 32 bytes )
[BLE   ] BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST : Conn Handle = 0
[BOND  ] Loaded keys from file /adafruit/bond_prph/bb0a
- Init Bluefruit 
[CFG   ] SoftDevice's RAM requires: 0x20002530
- Init Command Line BLE/NUS ...
at this point feather does reboot again and again....

Without bondstore the nordic-tools App does break with: "Error: Operation failed"
Last LOG_2 messages:

Code: Select all

...
[BLE   ] BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST : Conn Handle = 0
[GAP   ] ATT MTU is changed to 23
[BLE   ] BLE_GATTS_EVT_WRITE : Conn Handle = 0
[BLE   ] BLE_GATTS_EVT_WRITE : Conn Handle = 0
[GATTS ] attr's cccd
000:  01 00                                           | ..

[BLE   ] BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST : Conn Handle = 0
OK saw that after restart the Arduino IDE(?) the Bootloader has changed new "0.2.5. (s132 6.1.1) and repeated test OTA w/o bonding, and the idetical FW (blueart.ino.zip) again - but no success!

Code: Select all

Bluefruit52 BLEUART Example
---------------------------

[CFG   ] SoftDevice's RAM requires: 0x20002FA0
Please use Adafruit's Bluefruit LE app to connect in UART mode
Once connected, enter character(s) that you wish to send

BSP Library : 0.9.2
Bootloader  : s132 6.1.1 r1
Serial No   : A2B511779BB930E4

--------- SoftDevice Config ---------
Max UUID128     : 10
ATTR Table Size : 2048
Service Changed : 1
Peripheral Connect Setting
  - Max MTU         : 247
  - Event Length    : 6
  - HVN Queue Size  : 3
  - WrCmd Queue Size: 1

--------- BLE Settings ---------
Name            : Bluefruit52
Max Connections : Peripheral = 1, Central = 0 
Address         : ED:53:3A:5E:38:79 (Static)
TX Power        : 4 dBm
Conn Intervals  : min = 20.00 ms, max = 30.00 ms
Conn Timeout    : 2000.00 ms
Peripheral Paired Devices: 


[BLE   ] BLE_GAP_EVT_ADV_SET_TERMINATED : Conn Handle = 65535
[BLE   ] BLE_GAP_EVT_CONNECTED : Conn Handle = 0
[GAP   ] Conn Interval= 30.000000
[BLE   ] BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP : Conn Handle = 0
Connected to iPhone
[BLE   ] BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST : Conn Handle = 0
[GAP   ] ATT MTU is changed to 185
[BLE   ] BLE_GATTS_EVT_WRITE : Conn Handle = 0
[BLE   ] BLE_GATTS_EVT_WRITE : Conn Handle = 0
[GATTS ] attr's cccd
000:  01 00                                           | ..

[BLE   ] BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST : Conn Handle = 0

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

Return to “Feather - Adafruit's lightweight platform”