cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F0 Stop Debugging

eng23
Senior
Posted on October 11, 2016 at 18:41

Hey all,

I have a problem when I'm debugging the STM32F091RC the firmware doesn't work. I break and the address is so high, about 0x1fffda7c.

I've tried the demo examples and the same thing happens. Initialy, the firmware works, but after it goes to the  address above.

WDT is not active.

3 REPLIES 3
Posted on October 11, 2016 at 18:53

Make sure BOOT0 is pulled low in your design.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Walid FTITI_O
Senior II
Posted on October 11, 2016 at 20:11

Hi xarada, 

It is an address in the system memory region ( check table.2 in reference manual RM0091). In order to boot from Flash memory, you should connect the Boot0 to GND and ensure BOOT_SEL bit is set in the user option byte ( see Table3. Boot modes). 

Another case that may be the root cause , is the empty check flag that can be set.

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.

(page 52-53 in RM0091)

-Hannibal-

eng23
Senior
Posted on October 13, 2016 at 15:02

Hi Hannibal and Clive1,

Thank you for answer. The problem is really the BOOT0 pin, I'm using as an output and I need this because I have all pins used. I've read that I can use the option byte to configure the boot and leave the BOOT0 pin free to IO purpose. I if configure with ST-LINK Utility this bit the debug works correctely (so you are right), but I'm trying to configure by firmware this bit and it doesn't work. Below I put the code to write at BOOT_SEL [bit 23] from Option Byte address 0x1FFFF800.

/* Unlock the Flash to enable the flash control register access *************/
HAL_FLASH_Unlock();
 
 /* Unlock the Options Bytes *************************************************/
HAL_FLASH_OB_Unlock();

/* Get pages write protection status ****************************************/
HAL_FLASHEx_OBGetConfig(&OptionsBytesStruct);

OptionsBytesStruct.USERConfig = 0x7F;
 OptionsBytesStruct.OptionType = OPTIONBYTE_USER;

HAL_FLASHEx_OBProgram(&OptionsBytesStruct);

Is there anything wrong? Thank you