2015-01-26 02:25 AM
Hey there,
today i wanted to change the brownout level from 1 to 4, but i failed. I'm using the STM32L151VDT6 and the following code at startupif
((FLASH_OB_GetBOR() & 0x0F) != OB_BOR_LEVEL4){
/* Unlocks the option bytes block access */
FLASH_OB_Unlock();
/* Clears the FLASH pending flags */
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR |
FLASH_FLAG_PGAERR | FLASH_FLAG_SIZERR | FLASH_FLAG_OPTVERR);
/* Select The Desired V(BOR) Level------------------------*/
FLASH_OB_BORConfig(OB_BOR_LEVEL4);
/* Launch the option byte loading and generate a System Reset */
FLASH_OB_Launch();
}
It seems that i cannot change the BOR level this way so i tried the ST-Link Utility in which i can access the Option Bytes, too. Result: ''Could not set Option bytes''
In the description of the controller i found this:
''Low power, ultrasafe BOR (brownout reset) with 5 selectable thresholds''
but in reference manual in section ''Status register'' i found at the end of the ''User option byte'' the note ''These bits are read only''... so now i'am a little #confused
Is it possible to change the brownout level or not?
If possible, what am i doing wrong? #help
#stm32l #brownout-level #brownout
2015-02-02 09:34 AM
No one using/changing the brownout level? #helpless
2015-02-02 10:48 AM
Apparently not...
You've got an FLASH_Unlock(); in there prior, right?2015-02-04 08:02 AM
Uh, shame on me. #oops
The following code works fine for setting the brownout level to level 4:if ((FLASH_OB_GetBOR() & 0x0F) != OB_BOR_LEVEL4){
FLASH_Unlock();
/* Unlocks the option bytes block access */
FLASH_OB_Unlock();
/* Clears the FLASH pending flags */
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR |
FLASH_FLAG_PGAERR | FLASH_FLAG_SIZERR | FLASH_FLAG_OPTVERR);
/* Select The Desired V(BOR) Level------------------------*/
FLASH_OB_BORConfig(OB_BOR_LEVEL4);
/* Launch the option byte loading and generate a System Reset */
FLASH_Lock();
FLASH_OB_Launch();
}
@clive1: Thank you very much for your help.