cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F030RCT6 and STM32F030CCT6 don't reset after being programmed from blank flash.

guillem
Associate II

Hi guys, We have 2 different boards with STM32F0 processors, STM32F030RCT6 and STM32F030CCT6. Both boards work well, we are able to program, reset, run the code etc. However there is 1 conditions that leave the board in a unknown state and it's reproducible 100%.

1) Full chip erase

2) Power cycle the unit (if the unit is not powered off the problem is not seen)

3) Program the board

4) Reset the board. We have tried to reset the board via ST-link. Scoping the signal, the reset line goes low (as per other times when the reset works). Also we have directly grounded the reset line manually, with no successful result.

5) It seems that the SWCLK is left at 1V, that makes us think that the processor programming/debug interfaces is left in a funny state.

When the unit is power cycled this state is cleared, the code run just as expected, reset line produces reset, etc. As I mentioned, if the board is blanked but it doesn't loose power the issue doesn't occur.

Anybody has seen similar behaviour? Are we talking about a silicon bug?

Bonus Track: I have just tried the same sequence in a stm32f091RC nucleo board and the same issue happens. Because of that It becomes pretty clear to me that this is a chip issue.

Many thanks

0690X000006C2dVQAS.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
guillem
Associate II

Hi guys,

After contacting ST and reviewing the manual, this is the explanation: Basically there is a empty flash check flag that is set if the flash is empty and after programming keeps the uP in the bootloader area until you power cycle or write an OB.

It seems quite particular of this device and it's described in the manual... but a bit tricky in my opinion.

Detailed explanation.

from Ref Man (44/779 DocID025023 Rev 4)

Empty check

On STM32F070x6 and STM32F030xC devices only, internal empty check flag is implemented to allow easy programming of the virgin devices by the boot loader. This flag is used when BOOT0 pin is defining Main Flash memory as the target boot area. When the flag is set, the device is considered as empty and System memory (boot loader) is selected instead of the Main Flash as a boot area to allow user to program the Flash memory.

This flag is updated only during Option bytes loading: it is set when the content of the address 0x08000 0000 is read as 0xFFFF FFFF, otherwise it is cleared. It means a power on or setting of OBL_LAUNCH bit in FLASH_CR register is needed to clear this flag after programming of a virgin device to execute user code after System reset.

Note:If the device is programmed for a first time but the Option bytes are not reloaded, the device will still select System memory as a boot area after a System reset. In the STM32F070x6, the boot loader code is able to detect this situation. It then changes the boot memory mapping to Main Flash and performs a jump to user code programmed there. In the STM32F030xC, a POR must be performed or the Option bytes reloaded before applying the system reset.

Hope this is useful.

View solution in original post

9 REPLIES 9

Make sure BOOT0 pin is pulled LOW

If you suspect chip level issues you should discuss with the FAE assigned to your account.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
guillem
Associate II

0690X000006C2dQQAS.jpgHi Clive,

Thanks for answering. BOOT0 is pulled low.

I'll try to establish communication with somebody in ST.

Thanks.

> It seems that the SWCLK is left at 1V, that makes us think that the processor programming/debug interfaces is left in a funny state.

With STLink connected? If yes, try to disconnect STLink without removing power, and then reset by grounding NRST - does it run then?

JW

guillem
Associate II

Hi JW,

Thanks for your suggestion.

Yes, we did try that and no, it didn't run. Removing the st-link makes the 1V in the SWCLK go away (so the peripheral in the MCU is fighting the ST-link) but when the reset is grounded the MCU still not resetting.

Cheers.

Guillem,

That's then hummm....

I'd suggest also to ground BOOT0 hard, and remove the NRST pullup (there's an internal one); but I suspect neither of these would help anyway.

Please let us know if you find out something.

Jan

guillem
Associate II

Hi guys,

After contacting ST and reviewing the manual, this is the explanation: Basically there is a empty flash check flag that is set if the flash is empty and after programming keeps the uP in the bootloader area until you power cycle or write an OB.

It seems quite particular of this device and it's described in the manual... but a bit tricky in my opinion.

Detailed explanation.

from Ref Man (44/779 DocID025023 Rev 4)

Empty check

On STM32F070x6 and STM32F030xC devices only, internal empty check flag is implemented to allow easy programming of the virgin devices by the boot loader. This flag is used when BOOT0 pin is defining Main Flash memory as the target boot area. When the flag is set, the device is considered as empty and System memory (boot loader) is selected instead of the Main Flash as a boot area to allow user to program the Flash memory.

This flag is updated only during Option bytes loading: it is set when the content of the address 0x08000 0000 is read as 0xFFFF FFFF, otherwise it is cleared. It means a power on or setting of OBL_LAUNCH bit in FLASH_CR register is needed to clear this flag after programming of a virgin device to execute user code after System reset.

Note:If the device is programmed for a first time but the Option bytes are not reloaded, the device will still select System memory as a boot area after a System reset. In the STM32F070x6, the boot loader code is able to detect this situation. It then changes the boot memory mapping to Main Flash and performs a jump to user code programmed there. In the STM32F030xC, a POR must be performed or the Option bytes reloaded before applying the system reset.

Hope this is useful.

Stabilo
Associate III

Hi guys,

This topic really interest me ! 🙂

To you know how I can retrieve the information "empty check flag is set" ? So if this flag is set, I can reload the options bytes (POR is not an option here :( )

Thanks !

The issue posed by the OP is that you have to power cycle the ICs if you program them from blank, as the ROM System Loader starts if the device is blank, and this is not changed by a simple NRST, but requires the power to be removed.

I don't think you get to check the flag directly, but you could check what memory is mapped at address zero.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

https://community.st.com/s/question/0D53W000003Nl5hSAC/empty-check-flag-on-stm32f030-option-bytes

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..