cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB15 BLE OTA Custom Application Never Boots

ironduck
Associate

I am building an application which needs to be updated over BLE OTA.  I have followed the getting started videos and AN5247.  I have flashed the BLE_Ota example to address 0x0800 0000 as instructed, and I can successfully connect to the device using the ST BLE Sensor mobile application.

For my custom application, I am trying to simply load the .bin file from the BLE Sensor application and have the STM32 reboot into that program.  I have modified the linker file to start my flash address at 0x0800 7000, and I have marked the .ota_region_start and .ota_region_end, copying from the BLE_HeartRate_ota example.  When I build my firmware file and open the .bin output in a hex viewer, I can verify the magic keyword is placed at the correct location:

ironduck_0-1731443257728.png

Above, you can see that at address 0x0800 7140 (or 0x140 from start of custom application), the magic keyword address is 0x0800FE54 (little endian).

When looking at this address, we can see the magic keyword:

ironduck_1-1731443361837.png

This is value 0x94448A29 (little endian).

However, when I load the BLE Sensor application and send this same .bin file, the application never boots, and simply starts advertising the BLE OTA application again instead of switching to the user application.  When I try to read the flash memory, everything after 0x0800 7000 is completely blank (all 0xFF).

I tried interrupting the BLE OTA process and read the flash memory right before the firmware file was done uploading, and I see that the flashed data is consistently different from my uploaded file.  For example, where the magic keyword address was 0x0800FE54, it has been changed to 0x08010794:

ironduck_2-1731443522168.png

There are numerous other differences, and these differences are consistent between flashes, which indicates to me that it's not a BLE connection issue.  Is there any way to start to debug why the STM32 isn't loading the user application and instead clears the flash and restarts the BLE OTA service?

I should also note that I can successfully flash the BLE_HeartRate_ota example without issue; the issue only arises when I try to upload my custom application .bin file.

1 REPLY 1
ironduck
Associate

Upon further testing, it appears that I am completely unable to boot to my application if it is build as a Debug build, but I have more success when built as a Release build. Should this be the case? I'm trying to understand what differences between the two builds which would result in the firmware upload being unsuccessful.