2018-01-15 05:11 AM
Is it possilbe to check(and may be write)the DB1M option byte from the firmware? I am using an STMF4427IG (1MB with double bank via DB1M option byte)?
thanks
2018-01-15 06:14 AM
Yes, the options bytes are accessible with the normal address space of the processor.
2018-01-15 06:31 AM
Hello Henry,
If you use HAL in your application, there is a function inside Flash driver library (stm32f4xx_hal_flash_ex.c) to read Option Bytes:
void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);�?
So in your code you need to create a C structure and call a function with this structure as an argument:
FLASH_OBProgramInitTypeDef flashOptionByte;
HAL_FLASHEx_OBGetConfig(&flashOptionByte);�?�?
Writing to Option Bytes is a bit more complex. You need to unlock access to Flash, unlock access to Option Bytes, write to Option Bytes and finally confirm your modification. In terms of code it looks like below:
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
if (HAL_FLASHEx_OBProgram(&flashOptionByte) != HAL_OK)
{
Error_Handler();
}
HAL_FLASH_OB_Launch();�?�?�?�?�?�?�?
After last function call MCU will make a reset.
Regards
Szymon2018-01-15 10:22 AM
Thanks Sir, is not clear to me the reason of two different functions:
HAL_FLASHEx_AdvOBGetConfig
and
HAL_FLASHEx_OBGetConfig