cancel
Showing results for 
Search instead for 
Did you mean: 

unable to erase flash stm32h7b0

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.

code.png

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

errors.png

how to fix it?

1 ACCEPTED SOLUTION

Accepted Solutions

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

6 REPLIES 6
TDK
Guru

FLASH_VOLTAGE_RANGE_3 is defined in the HAL library headers. In particular, here:

stm32h7xx-hal-driver/Inc/stm32h7xx_hal_flash_ex.h at 45c28d2982eb470621531e0d6223d5530af80fcf · STMicroelectronics/stm32h7xx-hal-driver

 

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.

If you feel a post has answered your question, please click "Accept as Solution".

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

@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) 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Good catch. I missed the #if defined there.

If you feel a post has answered your question, please click "Accept as Solution".

Hello dear @Tesla DeLorean. thanks, that's right. H7B doesn't have a PSIZE field in FLASH_CR.