cancel
Showing results for 
Search instead for 
Did you mean: 

What does the STM32G474 do when powered on and it is erased?

DavidNaviaux
Senior

I designed a product that uses the STM32G474 MCU and found that if the BOOT0 pin is left floating, the MCU randomly appears to be running wild code when power is first applied.  In my design, this could cause serious damage to the hardware.  Although, I can program the nSWBOOT0 options bit so that the external BOOT0 pin is ignored, the initial application of power will always observe this pin (i.e., this pin must be tied low to ensure that execution start from the main Flash memory). 

When the STM32G474 is initially unprogrammed, if the external BOOT0 pin is tied low and execution starts from the main Flash memory, what will the MCU be doing (e.g., executing NOPs, continually jumping to address 0, etc.)?

1 ACCEPTED SOLUTION

Accepted Solutions

> When the STM32G474 is initially unprogrammed, if the external BOOT0 pin is tied low and execution starts from the main Flash memory

At that point, there are a couple of option bits to check: BOOT_LOCK and BFB2; see AN2606 (pattern 14 applies to 'G47x).

But assuming BFB2=0 which is the default, execution starts with loading the first word from 0x0000'0000 i.e. 0xFFFF'FFFF into stack pointer, and also 0xFFFF'FFFF into PC. Then the processor attempts to fetch from that address and that leads to Lockup, i.e. repeated execution from the same address with no other outward activity.

In other words, in that case, all external pins remain in their reset state.

JW

View solution in original post

2 REPLIES 2

> When the STM32G474 is initially unprogrammed, if the external BOOT0 pin is tied low and execution starts from the main Flash memory

At that point, there are a couple of option bits to check: BOOT_LOCK and BFB2; see AN2606 (pattern 14 applies to 'G47x).

But assuming BFB2=0 which is the default, execution starts with loading the first word from 0x0000'0000 i.e. 0xFFFF'FFFF into stack pointer, and also 0xFFFF'FFFF into PC. Then the processor attempts to fetch from that address and that leads to Lockup, i.e. repeated execution from the same address with no other outward activity.

In other words, in that case, all external pins remain in their reset state.

JW

Thank you!