I am trying to set the SECURITY bit on a STM32H7B3ZITX using STM32CubeProgrammer (v2.10.0). But it fails, see attached screenshot.
I also tried setting the bit using the firmware. This does not produce any errors, but the bit is still not set. Following code is used for that:
/* Set the security bit if needed */
/* ------------------------------ */
if ((sFlashOptionBytes.USERConfig & FLASH_OPTSR_SECURITY) == RESET)
sFlashOptionBytes.Banks = FLASH_BANK_1;
sFlashOptionBytes.OptionType = OPTIONBYTE_USER;
sFlashOptionBytes.USERType = OB_USER_SECURITY;
sFlashOptionBytes.USERConfig = OB_SECURITY_ENABLE;
if (HAL_FLASHEx_OBProgram(&sFlashOptionBytes) == HAL_OK)
printf("Security bit set.\n");
printf("Cannot set the security bit - ERROR\n");
I have now tested with multiple boards. We have boards with different batches of the STM32H7 chip (same version but different production dates). Some chips report bootloader version 0x92 (see attached image), this are also the chips where setting the SECURITY bit fails.
All other boards that report bootloader version 0x91 work properly.