Issue with BLE advertising after software reset - STM32WB55RG
Hello,
I am working on a custom application with BLE OTA on the Nucleo WB55RG. The OTA loader is placed at 0x08000000. My main application is linked to start at 0x08007000.
In normal mode, the main application runs an ADC test and continuously prints ADC values. I added a hardware OTA trigger on pin PC2. When PC2 is driven high, the application prepares the BLE OTA request and then calls NVIC_SystemReset(). The OTA request is passed to the loader at the start of SRAM.
After this, the OTA loader starts correctly. The loader detects the OTA request from SRAM.
The loader erases the application flash area starting from sector 7, corresponding to address 0x08007000. The loader then attempts to initialize the BLE stack and start advertising.
The issue is that BLE advertising does not start when entering OTA mode after the NVIC_SystemReset(). Pressing the on-board reset button also does not make BLE advertising start. However, if I completely power cycle the board by removing USB power and reconnecting it, BLE advertising starts correctly.
After the full power cycle, I can see the device advertising and can connect using the ST BLE Sensor app. A full power cycle appears to reset the STM32WB wireless core into a clean state, while NVIC_SystemReset() or the on-board reset button does not.
CFG_HW_RESET_BY_FW is enabled.
My question is:
What is the correct STM32WB55 sequence to fully reset or reinitialize CPU2 / the wireless stack before starting BLE OTA advertising?
When jumping from the main application to the BLE OTA loader using NVIC_SystemReset(), should the loader call any specific CPU2 reset, SHCI_C2_Reinit() or other wireless-stack cleanup sequence before calling BLE initialization?
