2025-04-24 10:04 AM - edited 2025-04-24 10:07 AM
hi. i want to write a variable into stm32h7b0vbt6 flash memory and all of the hal source and header files are added to project. so i have used FLASH_EraseInitTypeDef to erase flash first.
but when i call that, the program not build and shows this error and warning:
error: FLASH_VOLTAGE_RANGE_3' undeclared
warning: variable 'EraseInitStruct' set but not used
how to fix it?
Solved! Go to Solution.
2025-04-24 10:33 AM
The H7Ax and H7Bx don't have a PSIZE field in FLASH_CR (FLASH_CR_PSIZE undefined)
STM32Cube_FW_H7_V1.12.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include\stm32h7b0xx.h
Present in the H74x, H75x, H72x, H73x forks
2025-04-24 10:18 AM
Find a MCU appropriate example
2025-04-24 10:21 AM
FLASH_VOLTAGE_RANGE_3 is defined in the HAL library headers. In particular, here:
Ensure the flash module is being included in the hal_conf*.h file.
Ensure libraries are updated.
If this is code generated directly from an IOC file, include the IOC file here.
2025-04-24 10:33 AM
The H7Ax and H7Bx don't have a PSIZE field in FLASH_CR (FLASH_CR_PSIZE undefined)
STM32Cube_FW_H7_V1.12.1\Drivers\CMSIS\Device\ST\STM32H7xx\Include\stm32h7b0xx.h
Present in the H74x, H75x, H72x, H73x forks
2025-04-24 10:48 AM
@Mike_ST @RomainR. @STTwo-32 Can someone double check that this code isn't still auto-generated by CubeMX
Or that there's some observation in the source / examples that the different H7 die have some reasonably significant IP changes. I recollect the IP and AF pin mux for QSPI/OSPI aren't totally coherent either. Not that it's the issue here, but does mean I've got multiple forks as the H7 aren't code compatible across the range
Much of the library source / include have #if defined (FLASH_CR_PSIZE)
2025-04-24 12:40 PM
Good catch. I missed the #if defined there.
2025-04-24 1:02 PM
Hello dear @Tesla DeLorean. thanks, that's right. H7B doesn't have a PSIZE field in FLASH_CR.