cancel
Showing results for 
Search instead for 
Did you mean: 

Proper way to share peripherals between bootloader and UserApp in SBSFU. STM32WB CPU2 getting stuck.

MBuen.1
Senior

Hello guys, how are you?

Currently i have an interesting problem happening with my STM32WB5M. I have a project that uses SBSFU alongside with a firmware that uses the BLE peripheral with CPU2 and etc. I don't use the BLE loader, i developed i customize USB loader.

The only peripheral that is shared between bootloader and my user app are 3 GPIOS that i use for a RGB led. The thing is, when i share this resource, sometimes CPU2 get stuck in my main firmware and it doesn't initialize. I need my WDT to kick in and reset the firmware, then CPU2 initializes. The only way things work smooth is when i have my debug connected to the board (i tought this very very weird).

If i remove the GPIO from my bootloader, everything works fine with or without my debug probe. I think the CPU2 behaviour on STM32WB5M very strange. CPU2 get stuck sometimes because of a problem that is not even related to it.

Any suggestion about what this could be? Is there something relevant that i should do to "share" this GPIO's between bootloader and main firmware? Anyone would have a hint about why the CPU2 get stuck for somethings that it doesn't have anything to do with it?

Regards,

Matheus

11 REPLIES 11
Remy ISSALYS
ST Employee

Hello,

It would be interesting to look Flash memory status register (FLASH_SR).

Best Regards,

HI @Remy ISSALYS​ 

I know its been a long time but i'm facing this issue again. Its not relating to the GPIO sharing but my CPU2 is actually hardfaulting again and i would like to know why.

I debugged some FLASH Flags and here's what i have:

FLASH_FLAG_MISERR: 0

FLASH_FLAG_PGSERR: 1 (Is 1 with or without hardfault)

FLASH_FLAG_PGAERR: 1 (Is 1 with or without hardfault)

FLASH_FLAG_SIZERR: 0

FLASH_FLAG_FASTERR: 0

FLASH_FLAG_OPTNV: 0

FLASH_FLAG_RDERR: 0

FLASH_FLAG_OPTVERR: 0

FLASH_FLAG_BSY: 0

FLASH_FLAG_CFGBSY: 1 (When hardfault) 0 (when CPU2 boots normal)

FLASH_FLAG_WRPERR: 0

FLASH_FLAG_PROGERR: 0

FLASH_FLAG_OPERR: 0

FLASH_FLAG_EOP: 0

FLASH_FLAG_PESD: 0

FLASH_FLAG_ECCC: 0

FLASH_FLAG_ECCD: 0

A weird behavior is that if i add a static variable of 4 bytes during compilation, it changes binary size and these CPU2 hardfaults stop happening. Even with that 4 bytes adding to the binary and no more CPU2 hardfaulting happening, both FLASH_FLAG_PGSERR and FLASH_FLAG_PGAERR are still in 1.

Could you give me any hint?

Regards, Matheus