cancel
Showing results for 
Search instead for 
Did you mean: 

I have problem with the stm32f030k flash memory protection

SRouz.1
Associate

Hi.

I am working with a mcu stm32f030k6

.

My problem is that I can not protect my memory reading.

I used a few code samples but got no results.

Is there a solution?

Using with writing code of the the main mcu or 

This can be done through the programmer J-link

Thank you very much for your help.

An example of my code that That did not work and does not run mcu

main{

 ReadProtectionConfig (1) 

}

uint8_t ReadProtectionConfig(uint8_t ProtectionLevel)

{

 uint8_t status = 0;

 FLASH_OBProgramInitTypeDef OB_Init;

 HAL_FLASH_Unlock();

 HAL_FLASH_OB_Unlock();

 OB_Init.OptionType = OPTIONBYTE_RDP;

 if (ProtectionLevel == 0) {

 OB_Init.RDPLevel = OB_RDP_LEVEL_0;

 } else if (ProtectionLevel == 1) {

 OB_Init.RDPLevel = OB_RDP_LEVEL_1;

 } else if (ProtectionLevel == 2) {

 OB_Init.RDPLevel = OB_RDP_LEVEL_2;

 } else {

 status = 1;

 return status;

 }

HAL_FLASHEx_OBProgram(&OB_Init);

 HAL_FLASH_OB_Launch();

 HAL_FLASH_OB_Lock();

 HAL_FLASH_Lock();

 return status;

}

0 REPLIES 0