cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L5 - User Option Byte Access

MBand.3
Associate III

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!

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

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.

0693W00000FB5IWQA1.png 

This is a recurring question:

https://community.st.com/s/question/0D53W00000mm98U/how-to-write-nonreserved-option-bytes-on-stm32h750xx-mcu

https://community.st.com/s/question/0D53W000003NVH1SAO/how-can-i-program-the-option-byte-on-stm32h750-for-my-device-uuid8-bytes

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

View solution in original post

2 REPLIES 2
TDK
Guru

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.

0693W00000FB5IWQA1.png 

This is a recurring question:

https://community.st.com/s/question/0D53W00000mm98U/how-to-write-nonreserved-option-bytes-on-stm32h750xx-mcu

https://community.st.com/s/question/0D53W000003NVH1SAO/how-can-i-program-the-option-byte-on-stm32h750-for-my-device-uuid8-bytes

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

Understood, thank you!