cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L431 brown out.

LeventF16
Associate II

Hello.

How can we enable brown out for this processor and the brown out voltage?

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

Some mechanics along the lines of..

    // Read the option byte
    FLASH_OBProgramInitTypeDef OBInit;
    HAL_FLASHEx_OBGetConfig(&OBInit);

    // Check bitwise if the brownout level is not 3
    if ((OBInit.USERConfig & OB_BOR_LEVEL_3) != OB_BOR_LEVEL_3)
    {
        // Set the brownout level to 3
        OBInit.OptionType = OPTIONBYTE_USER;
        OBInit.USERType = OB_USER_BOR_LEV;
        OBInit.USERConfig |= OB_BOR_LEVEL_3;

        HAL_FLASH_Unlock();
        HAL_FLASH_OB_Unlock();
        HAL_FLASHEx_OBProgram(&OBInit);
        // This function needs to be called Unlocked Flash and OB state.
        HAL_FLASH_OB_Launch();
        HAL_FLASH_OB_Lock();
        HAL_FLASH_Lock();
        HAL_FLASH_OB_Launch();
    }
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

3 REPLIES 3

Perhaps it's covered in the Reference Manual, or there are examples in the code trees of CubeL4 ?

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

Some mechanics along the lines of..

    // Read the option byte
    FLASH_OBProgramInitTypeDef OBInit;
    HAL_FLASHEx_OBGetConfig(&OBInit);

    // Check bitwise if the brownout level is not 3
    if ((OBInit.USERConfig & OB_BOR_LEVEL_3) != OB_BOR_LEVEL_3)
    {
        // Set the brownout level to 3
        OBInit.OptionType = OPTIONBYTE_USER;
        OBInit.USERType = OB_USER_BOR_LEV;
        OBInit.USERConfig |= OB_BOR_LEVEL_3;

        HAL_FLASH_Unlock();
        HAL_FLASH_OB_Unlock();
        HAL_FLASHEx_OBProgram(&OBInit);
        // This function needs to be called Unlocked Flash and OB state.
        HAL_FLASH_OB_Launch();
        HAL_FLASH_OB_Lock();
        HAL_FLASH_Lock();
        HAL_FLASH_OB_Launch();
    }
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TDK
Guru

You can adjust it in STM32CubeProgrammer along with other option bytes.

TDK_0-1725644023758.png

 

If you feel a post has answered your question, please click "Accept as Solution".