cancel
Showing results for 
Search instead for 
Did you mean: 

How to read/write to STM32L071B flash memory using LL/Registers ?

migmel
Senior

Hello, I am trying to find LL functions parallel to those in HAL library that support Flash programming and it looks like there is not support in LL for r/w flash. As HAL library is not an option for me, I am wondering if it is possible <writing directly to registers> achieve this goal, not so easy for me though.

Any help/suggestion in how to go about it would be greatly appreciated

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

The RM would be the best reference to use for writing to the FLASH. It is more complicated than RAM, but should be quite manageable. There are even code examples for how to do this in the RM. See "A.3.9 Program a single word to Flash program memory code example". Note that flash needs unlocked first.

https://www.st.com/resource/en/reference_manual/rm0377-ultralowpower-stm32l0x1-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

Reading flash memory should be a trivial task. There are no special considerations here, read it the same as yo would RAM.

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

View solution in original post

4 REPLIES 4
TDK
Guru

The RM would be the best reference to use for writing to the FLASH. It is more complicated than RAM, but should be quite manageable. There are even code examples for how to do this in the RM. See "A.3.9 Program a single word to Flash program memory code example". Note that flash needs unlocked first.

https://www.st.com/resource/en/reference_manual/rm0377-ultralowpower-stm32l0x1-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

Reading flash memory should be a trivial task. There are no special considerations here, read it the same as yo would RAM.

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

Thank you @TDK

mrx23
Associate III

Still, LL should be provided.

Well, Cube is open source, so you can "translate" the Cube/HAL based examples into register accesses, and then "reverse translate" those to the Cube/LL macros/functions.

JW