Skip to main content
PCu1
Senior
December 22, 2024
Solved

After BLE OTA update, CPU2 stucks

  • December 22, 2024
  • 1 reply
  • 2011 views

Hi, I'm working on an OTA BLE bootloader for the STM32WB5MM module.
I created from scratch with STM32CubeMX the same code as the OTA example for NUCLEO-WB55.
I'm on BLE stack 1.21
So far so good, I can update with the smartphone app.

The problem I'm having is that at the end, after receiving the BLE reset in the OTA, the microcontroller reboots correctly in the customer firmware, but remains stuck at CPU2 initialization, when hci_reset() is called in the Ble_Hci_Gap_Gatt_Init() function.

The power supply must be removed for CPU2 to work. After this action, the customer firmware is working properly.

A reset via the RESET pin does not improve the situation.

I found several similar messages about this:
https://community.st.com/t5/stm32-mcus-wireless/issue-in-ble-stack-advertisement-after-jumping-with-bootloader/m-p/63165

https://community.st.com/t5/stm32-mcus-wireless/stm32wb-cpu1-stuck-waiting-cpu2-at-init/td-p/80505

https://community.st.com/t5/stm32-mcus-wireless/stm32wb5mmg-cpu2-stuck-in-non-discovery-state/m-p/677977

 


I tried several solutions, in the OTA firmware at the end of update:
- make a jump to the customer firmware without calling NVIC_SystemReset()
- add these lines before NVIC_SystemReset()

UTIL_SEQ_PauseTask(1<< CFG_TASK_SYSTEM_HCI_ASYNCH_EVT_ID); 
SHCI_CmdStatus_t shci_response = SHCI_C2_Reinit(); 

- add aci_hal_stack_reset() or hci_reset();

Of course without success.

Note: I use the same clock configuration for OTA and customer firmware.

 

Any idea?

Pierre

Best answer by PCu1

Yes, I've received some informations (and the solution) from the FAE but haven't had time to post it here yet...

 

See errata sheet ES0394 - Rev 15
2.3.1 RF system wake-up clock set to HSE/1024 cannot be changed

 

In fact, in my client firmware the RF clock source was RCC_RFWKPCLKSOURCE_LSE and in the OTA it was RCC_RFWKPCLKSOURCE_HSE_DIV1024.

Now I use RCC_RFWKPCLKSOURCE_LSE for both firmwares and CPU2 reboots correctly.

 

I hope this can help you.

Pierre

 

1 reply

STTwo-32
Technical Moderator
January 23, 2025

Hello @PCu1 

Could you please have a look at the Empty check paragraph of the RM0434 Rev 14. (page 74). It may be the same behavior you descripted.

Best Regards.

STTwo-32

PCu1
PCu1Author
Senior
February 3, 2025

Hi @STTwo-32,

Thank you for your answer.

I checked FLASH->ACR->EMPTY and it is 0x0 after the OTA update and after the NVIC_SystemReset() which seems normal because the address 0x08000 0000 is never read as 0xFFFF FFFF.

This location is used by the OTA firmware.

 

I also unchecked nRST_STOP, nRST_STDBY and nRSTSHDW, without success.

Pierre