cancel
Showing results for 
Search instead for 
Did you mean: 

Question of STM32WB OTA reboot problem

SKmin
Associate

Hello, I have a question about OTA in the stm32wb series.

I'm testing to add the OTA function to the board I'm developing.

After full erase of MCU, I succeeded in downloading application bin file to MCU with STBLE Toolbox application.

Afterwards, to update another bin file, I sent 01 07 FF  to the application service and tried to download another bin file by entering OTA application mode.

However, when entering OTA application mode, it was confirmed through debugging that it enter low power mode and did not operate normally, and entered low power mode while the shci_send function was operating inside the APP_BLE_Init function.

I don't know why this is happening.
I have modified the linker file, checked the magic keyword, and modified SCR->VTOR, but do I need to more modify other sources?

If there's anything you need to check, I'll capture it and upload it right away.

10 REPLIES 10
TBran.3
Associate III

I don't have a solution, but I believe I'm having the same issue: https://community.st.com/t5/wireless-mcu/stm32wb-fota-practical-questions/td-p/572725

And I think the same issue was seen here, but with no particular resolution shared: https://community.st.com/t5/wireless-mcu/stm32wb-cpu1-stuck-waiting-cpu2-at-init/m-p/580103#M16082

Really interested in understanding what's going on and how to fix it.

tester
Associate III

I can confirm this issue. Just to be clear, I am using a Nucleo-WB55 and tried OTA with the p2p example and the ST BLE Sensor App, which worked fine. However, when I send "01077F" with my own app, it boots to OTA but gets stuck somehow, doesn't delete the user code and also doesn't advertise.

SSher.3
Associate III

I'm also struggling, how did you even manage to get there "I send ""01077F" with my own app, it boots to OTA".
I have custom template, added ota reboot char, but whatever I send to the char it doesn't even reboot (do I have to process it in code?!). 

After sending "01077F" the board does something, but gets stuck somewhere. I know that because the LEDs toggle, and it doesn't advertise anymore. After power toggling, it starts advertising again (via the old firmware) which means user code isn't deleted.

edit:

Yep, you have to handle that write in custom_stm.c and custom_app.c, just like any other BLE data transaction. In custom_app.c, you should have a block that looks like this:

TBran3_0-1695956409887.png

(The while(1) isn't necessary)

tester
Associate III

@TBran.3I have that, and I think that is exactly where the problem lies. I noticed the flash isn't erased, because when I power toggle the board, the board loads the firmware I was trying to delete. And firmware should be deleted before rebooting, right?

Nope, the OTA loader application should erase the user application flash before writing the new program. 

If you think about it, you can't really erase the user application while you're still *in* it.

tester
Associate III

You're right, but the problem still is that the user code isn't even deleted. Am I the only one or do you also see this behavior? Do you have any updates on this?

Yeah I mean in my case (which IIRC is same as yours), the user app is never deleted because the OTA bootloader never makes it to the point of "erase and write". So on power cycle, the previous user FW indeed loads. It never makes it deep enough into the OTA application to do anything meaningful, it's just waiting for an event to be triggered by CPU2.

I haven't gotten anywhere with ST support yet, but the first zip file I sent them was missing files. Just pinged them again and hoping for an update soon.