Ported the hrs_rscs relay central-peripheral app with peer mgr to custom platform with mutliple peripheral devices, and it has been working very well. The last step is to add OTA DFU support. So, first got the dfu bootloader working. With that I am able to DFU the example app BleHrsRscs with DFU using the bootloader and the same app again using the app DFU.
I am also able to dfu the custom app using the dfu BL. However, when the bootloader launches the custom app, it fails after running just for several seconds and the BL and app loading repeats on and on.
One key difference between the examples BleHrsRscs app (small) and the custom app (large) is the size of the images -- about 32 kB vs 114 kB.
I have 7 ble services including the dfu (all vendor specific). All these services and characteristics get added with no errors. The crashing seems to be about when the app starts to physically do scan or advertise.
I am using the zip packages of the application for dfu.
(Created with "nrfutil.exe dfu genpkg --application EVT_REVB_Beta_DFU.hex --sd-req 0x0081 CollarEvtBetaDfu.zip")
The image download completes successfully as seen by:
nrfjprog -s 203201034 --memrd 0x10001000 --w 32 --n 20
0x10001000: 0001C000 FFFFFFFF FFFFFFFF FFFFFFFF |................|
0x10001010: FFFFFFFF 00075000 0007E000 FFFFFFFF |.....P..........|
-boot settings:
nrfjprog -s 203201034 --memrd 0x0007f000 --w 32 --n 20
0x0007F000: 00000001 000000FF 0001AC38 00000000 |........8.......|
0x0007F010: 00000000 00000000 00000000 FFFFFFFF |................|
nrfjprog -s 203201034 --memrd 0x0001c000 --w 32 --n 100
0x0001C000: 20003B00 0003654D 0001FE37 00020537 |.;. Me..7...7...|
0x0001C010: 00021273 00021F37 00022027 00000000 |s...7...' ......|
0x0001C020: 00000000 00000000 00000000 000235DF |.............5..|
nrfjprog -s 203201034 --memrd 0x00075000 --w 32 --n 100
0x00075000: 20004758 0007D17D 000765E7 0007664B |XG. }....e..Kf..|
0x00075010: 00076717 0007678F 0007696F 00000000 |.g...g..oi......|
BTW, my bootloader is a debug build and I had to move the start address to 0x75000.
I am suspecting:
-
The application image larger than 65 kB causing some issues with saving in flash?
-
Bootloader leaves softdevice interface in some incorrect/unstable state when starting the app?
-
Potential issue with bootloader_util_reset(uint32_t start_addr). I am using ICCARM version. I see the correct address (0x1c000) passed in to the function.
Also, I have a timer delay (15 seconds) setup to start BLE advertising, but scanning starts after about 5 seconds.
Is there any special conditions or precautions I need to take when starting scanning or advertising when the bootloader transfers control to the app?
Also, noticed that the bootloader main code never reaches the final
Any suggestions or pointers are very much appreciated.
Thanks,
Milton