2021-09-30 08:11 AM
The STM32L5 reference manual states that there are "4 Kbytes of option bytes for user configuration" accessible via the Flash register interface (section 6.3.1), but no further details are provided on how to access that space for user data storage.
I found a question here, which answers this question for another chip (STM32F0): https://community.st.com/s/question/0D50X00009XkfPkSAJ/simple-example-program-to-read-and-write-option-bytes-on-stm32f042k6-using-hal-libraries
My problem is, the STM32L5 HAL code (1.4.0) doesn't define the HAL_FLASHEx_OBGetUserData function, or even the OPTIONBYTE_DATA type.
How is the option byte flash page for user configuration accessed on the L5? Is this actually a supported feature?
Thanks!
Solved! Go to Solution.
2021-09-30 08:41 AM
The description is terribly misleading and should be changed. It reads:
4 Kbytes of option bytes for user configuration. Unlike user Flash memory and system memory, it is not mapped to any memory address and can be accessed only
through the Flash register interface.
Although the hardware has a 4kB area used to store option bytes, only those option bytes listed in the RM are able to be accessed, which is a small subset of the 4kB technically available in the hardware. Keep in mind that option bytes are stored in flash, but you interface with them via registers. You're not writing to them directly.
The L5 and most (all?) other families have no area within the accessible option bytes which can be used for user data.
The F0 has areas within the option bytes which can be used for user data and are accessible via the flash interface. This is the reason it has HAL_FLASHEx_OBGetUserData and the L5 does not.
This is a recurring question:
2021-09-30 08:41 AM
The description is terribly misleading and should be changed. It reads:
4 Kbytes of option bytes for user configuration. Unlike user Flash memory and system memory, it is not mapped to any memory address and can be accessed only
through the Flash register interface.
Although the hardware has a 4kB area used to store option bytes, only those option bytes listed in the RM are able to be accessed, which is a small subset of the 4kB technically available in the hardware. Keep in mind that option bytes are stored in flash, but you interface with them via registers. You're not writing to them directly.
The L5 and most (all?) other families have no area within the accessible option bytes which can be used for user data.
The F0 has areas within the option bytes which can be used for user data and are accessible via the flash interface. This is the reason it has HAL_FLASHEx_OBGetUserData and the L5 does not.
This is a recurring question:
2021-09-30 08:44 AM
Understood, thank you!