Hi,
I am implementing the bank switching logic for STM32L476
Environment: Eclipse for code development
: ST-Link/V2 Debugger for flashing and debugging binaries:
Why below code gets stuck at the HAL_FLASH_OB_Launch(); ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2019-01-29 5:37 AM
FLASH_OBProgramInitTypeDef OBInit;
/* Set BFB2 bit to enable boot from Flash Bank2 */
/* Allow Access to Flash control registers and user Flash */
HAL_FLASH_Unlock();
/* Clear OPTVERR bit set on virgin samples */
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERR);
/* Allow Access to option bytes sector */
HAL_FLASH_OB_Unlock();
/* Get the Dual boot configuration status */
HAL_FLASHEx_OBGetConfig(&OBInit);
/* Enable/Disable dual boot feature */
OBInit.OptionType = OPTIONBYTE_USER;
OBInit.USERType = OB_USER_BFB2;
if (((OBInit.USERConfig) & (OB_BFB2_ENABLE)) == OB_BFB2_ENABLE) {
OBInit.USERConfig = OB_BFB2_DISABLE;
} else {
OBInit.USERConfig = OB_BFB2_ENABLE;
}
HAL_FLASHEx_OBProgram(&OBInit)
HAL_FLASH_OB_Launch();
HAL_NVIC_SystemReset();
- Labels:
-
Flash
-
STM32L4 Series
