STM32L15xx microcontroller can internal FLASH Read Protection be enabled inside flashed SW?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-01 4:21 AM
Hi,
My project is based on STM32L15xx microcontroller. I know, that internal FLASH Read Protection may be enabled during programming an image by STMFlashLoader with --erp option. My question is: can I compile my image with internal FLASH read protection enabled by some tweak so that I don't have to use "--erp" option on downloading my image to the target?
Thanks in advance!
Solved! Go to Solution.
- Labels:
-
Flash
-
RDP
-
STM32L1 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-01 6:24 AM
Hello @DLyum.1​ ,
You need to Unlock the Flash and OB to enable the flash control register access.
Here is an example:
FLASH_OBProgramInitTypeDef obProgram = { 0 };
obProgram.OPTIONBYTE_RDP = OB_RDP_LEVEL_1;
FLASH_OB_RDPConfig
HAL_FLASHEx_OBGetConfig(&obProgram);
...
if (obProgram.RDPLevel == OB_RDP_LEVEL_1)
...
The function FLASH_OB_RDPConfig(); could be used.
Hope this helps!
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-01 5:42 AM
Should be able to check the state of the option bytes, and change them.​
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-01 6:02 AM
Thank you!
The Option Bytes are described in PM0062 (Flash and EEPROM Programming Manual) application notes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-01 6:24 AM
Hello @DLyum.1​ ,
You need to Unlock the Flash and OB to enable the flash control register access.
Here is an example:
FLASH_OBProgramInitTypeDef obProgram = { 0 };
obProgram.OPTIONBYTE_RDP = OB_RDP_LEVEL_1;
FLASH_OB_RDPConfig
HAL_FLASHEx_OBGetConfig(&obProgram);
...
if (obProgram.RDPLevel == OB_RDP_LEVEL_1)
...
The function FLASH_OB_RDPConfig(); could be used.
Hope this helps!
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-01 6:32 AM
Thank you!
