2024-04-20 12:58 PM
Hello,
On flash option byte I need to use only one sector. Only Edata bank1 is activate. No other option bytes are required.
CubeMx generate MX_FLASH_Init with Edata configuration commented. What other option byte is necessary to select to use Edata on bank1?
Can you help me?
target: STM32H563ZI
stm32CubeMx 6.11.0
stm32Cube MCU Package STM32H5 1.2.0
Regards
2024-05-03 02:11 AM
2024-05-06 07:44 PM - edited 2024-05-06 07:45 PM
Hi @CMAHM.1,
I have the similar question. My board is STM32H573I-DK. EData seems not be enabled after MX_FLASH_Init().
Here is the code generated by CubeMX.
static void MX_FLASH_Init(void)
{
/* USER CODE BEGIN FLASH_Init 0 */
/* USER CODE END FLASH_Init 0 */
FLASH_OBProgramInitTypeDef pOBInit = {0};
/* USER CODE BEGIN FLASH_Init 1 */
/* USER CODE END FLASH_Init 1 */
if (HAL_FLASH_Unlock() != HAL_OK)
{
Error_Handler();
}
/* Option Bytes settings */
if (HAL_FLASH_OB_Unlock() != HAL_OK)
{
Error_Handler();
}
pOBInit.OptionType = OPTIONBYTE_EDATA;
pOBInit.Banks = FLASH_BANK_BOTH;
pOBInit.EDATASize = 1;
if (HAL_FLASHEx_OBProgram(&pOBInit) != HAL_OK)
{
Error_Handler();
}
if (HAL_FLASH_OB_Lock() != HAL_OK)
{
Error_Handler();
}
if (HAL_FLASH_Lock() != HAL_OK)
{
Error_Handler();
}
/* Launch Option Bytes Loading */
/*HAL_FLASH_OB_Launch(); */
/* USER CODE BEGIN FLASH_Init 2 */
/* USER CODE END FLASH_Init 2 */
}
I tried to access 0x0900A800 by CubeProgrammer but it showed Data read failed.
But if checked the EDATA1_EN option by CubeProgrammer. It worked.
Is there any bug or what I missed?
P.S. I also uncommented
/*HAL_FLASH_OB_Launch(); */
but still not worked.