cancel
Showing results for 
Search instead for 
Did you mean: 

Nucle STM32L031: EEPROM write protection ?

duybienle
Associate II
Posted on August 09, 2016 at 13:09

Hi,

I want to implement read/write functions as well as write protection for EEPROM memory in Nucleo STM32L031K6.

From STM examples, I see that:

    - For Flash memory, the write protection can be set using OptionsBytes: e.g OB_WRP_Pages0to31,

OB_WRP_Pages32to63. Each of thess OB_WRP_Pages correspond to a specified Section.

 

    - However for Data EEPROM, there is no such a ''Section''.

So my question is: Is it possible to configure Data EEPROM to be write protected ? And if it is, then how to do that (and example code would be great) ?

Thanks

Bien

 

#stm32l031 #eeprom #flash
1 REPLY 1
slimen
Senior
Posted on August 30, 2016 at 17:38

Hi,

As mentioned in the 

http://www.st.com/content/ccc/resource/technical/document/reference_manual/21/bd/0f/bd/1c/88/40/f0/DM00108282.pdf/files/DM00108282.pdf/jcr:content/translations/en.DM00108282.pdf

- The user can protect part of the NVM (Flash program memory, data EEPROM and Option bytes areas) 

- In the Flash program memory, it is possible to add another write protection with the sector granularity. When PcROP is disabled (WPRMODE = 0), the bits of WRPROT are used to enable the write protection on the sectors. 

For more details, you can refer to this manual

http://www.st.com/content/ccc/resource/technical/document/reference_manual/21/bd/0f/bd/1c/88/40/f0/DM00108282.pdf/files/DM00108282.pdf/jcr:content/translations/en.DM00108282.pdf

, in section 3 Flash program memory and data EEPROM (FLASH) and in section 3.4 Memory protection.

You can have a look to this example under

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubel0.html

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubel4.html

0, which describes how to configure and use the Flash to enable and disable the write protection of the internal FLASH memory:

STM32Cube_FW_L0_V1.7.0\Projects\STM32L031K6-Nucleo\Examples\FLASH\FLASH_WriteProtection

You can inspire from this example to achieve your goal and modify it or add your own code.

Regards