2023-05-04 07:02 AM
STM32CubeID, Ver 1.12.0
We are porting a project over from STM32F that uses STM's Standard Peripheral Drivers. The new chip is a STM32G0B which requires we a shift to the new STM LL drivers. Things have gone well until we hit the flash driver code. The HAL/Low Level driver documents say that there should be Low Level code that is separate from HAL but examination of the STM32Cube_FW_G0_V1.6.1 repository only shows driver flash operation in the stm32g0xx_ll_system.h for setting flash latency, nothing else. We do see more standard flash stuff in the HAL section of the repository but that requires we drag in HAL config files.
Does ST have a standard set of flash Low Level drivers(Flash_Lock, Flash_Unlock...) that is separate from HAL?
Thanks
2023-05-04 08:14 AM
I don't think so man
2023-05-04 08:23 AM
Welp. Guess we either gut the HAL code or try to make it work. The last failed attempt at making it work was when stm32g0xx_hal_flash.c did not see the HAL_FLASH_MODULE_ENABLED define that is over in stm32g0xx_hal_conf.h(the one we created.) It should be as all the include paths are correct and stm32g0xx_hal_flash.c includes stm32g0xx_hal.h which includes stm32g0xx_hal_conf.h.
Thanks.
2023-05-04 09:28 AM
Can't say I've looked at the G0, but for a host of others I just wrote assembler versions.
The programming mechanics have consistently been to enable access via the locks, and use the PG bit, and then move the data.
Historically here used the F1,F2 and F4 with SPL, migrated to HAL for L4 and L5
2023-05-04 01:13 PM
We are using a STM32G0B0RE which is a much larger chip than we normally use. The stm32g0xx_hal_flash.c file only contains a FLASH_Program_DoubleWord write function. They don't seem to have a 2/4 byte write function like the Standard Peripheral drivers. Have to dig into the Reference manual to see why they go with a minimum 8 byte writes(two four byte writes back to back.)
2023-05-04 01:47 PM
Reference manual says: "It is only possible to program a double word (2 x 32-bit data)."