cancel
Showing results for 
Search instead for 
Did you mean: 

Flash ReadOut Protection Problem

jki79ros81
Associate II
Posted on November 07, 2008 at 02:49

Flash ReadOut Protection Problem

15 REPLIES 15
jki79ros81
Associate II
Posted on May 17, 2011 at 12:49

I want my code in Flash to be protect from downloading by anybody.

I useed FLASH_ReadOutProtection(ENABLE),but this function no acted.

FLASH_ReadOutProtection(ENABLE);

if(FLASH_GetReadOutProtectionStatus() == SET){

.......

}

else{

.......

}

What is the problem?

heavelove1
Associate II
Posted on May 17, 2011 at 12:49

I think you should reset the mcu, let the mcu load new read protech option to OBR.RDP

jki79ros81
Associate II
Posted on May 17, 2011 at 12:49

Thank you heavelove!

I had so,but it is the same.

FLASH_ReadOutProtection(ENABLE) ;

if(FLASH_GetReadOutProtectionStatus() == SET){

????????????

why not reach to this point ?

????????????

.........

}

else{

............

}

Please advice me!

jilisegiar
Associate II
Posted on May 17, 2011 at 12:49

did you use the following function to reset the CPU:

NVIC_GenerateSystemReset();

for more details, see the \FWLib\examples\FLASH\Write_Protection example

STM32F10xFWLib:

http://www.st.com/mcu/modules.php?name=mcu&file=familiesdocs&FAM=110#Firmware

heavelove1
Associate II
Posted on May 17, 2011 at 12:49

Maybe check status first is better:

if(FLASH_GetReadOutProtectionStatus() == SET){

//...reach this point is ok.

}

else{

FLASH_ReadOutProtection(ENABLE) ;

__delay_cycles(100000);

NVIC_GenerateSystemReset();

}

jki79ros81
Associate II
Posted on May 17, 2011 at 12:49

Thank you heavelove!

I had so,but it is too the same.

When I debug,always it reach in the same as follwing.

if(FLASH_GetReadOutProtectionStatus() == SET){

........

}

else{

//. Here is breakpoint.

???????????????

//. Always reach in this point. Why?

FLASH_ReadOutProtection(ENABLE) ;

for(i = 0; i< 50000; i++){};

NVIC_GenerateSystemReset();

??????????????????????

}

Please help me.

heavelove1
Associate II
Posted on May 17, 2011 at 12:49

I've tested on these code, and it worked ok:

Led_Config();

if(FLASH_GetReadOutProtectionStatus() == SET)

{

Led1_ON();Led2_OFF();Led3_OFF();Led4_OFF();

}

else

{

FLASH_Unlock();//This MUST done first

FLASH_ReadOutProtection(ENABLE) ;

Led1_ON();Led2_ON();Led3_ON();Led4_ON();

NVIC_GenerateSystemReset();

}

Good luck to you!

jki79ros81
Associate II
Posted on May 17, 2011 at 12:49

Dear heavelove,a person from the same province.

Thank you very much.

It's OK.

But,Ah,unfortunately,I am hurried into an error.

I protect my flash and run erase flash. So I can't flash download. I use STM32F103RD,Keil.

I can use it after?

Please help me.

[ This message was edited by: jki79ros81 on 03-11-2008 02:56 ]

heavelove1
Associate II
Posted on May 17, 2011 at 12:49

You can erase the chip use ISP.

A chinese version ISP program can download from www.mcuisp.com