Skip to main content
jki79ros81
Associate III
November 7, 2008
Question

Flash ReadOut Protection Problem

  • November 7, 2008
  • 15 replies
  • 2127 views
Posted on November 07, 2008 at 02:49

Flash ReadOut Protection Problem

    This topic has been closed for replies.

    15 replies

    jki79ros81
    Associate III
    May 17, 2011
    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?

    jki79ros81
    Associate III
    May 17, 2011
    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!

    heavelove1
    Associate II
    May 17, 2011
    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 III
    May 17, 2011
    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
    May 17, 2011
    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();

    }

    jilisegiar
    Associate III
    May 17, 2011
    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

    jki79ros81
    Associate III
    May 17, 2011
    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
    May 17, 2011
    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 III
    May 17, 2011
    Posted on May 17, 2011 at 12:49

    Oh, good friend, heavelove!

    Thank you very much for your continuos help.

    I tried to erase by using ISP (both eispV02 ,eispV04), but it is fail in connecting.

    The error message is ''Time over, not able to connect.''

    Is there other method?

    Please help to a finish.

    I am sorry for giving you trouble.

    [ This message was edited by: jki79ros81 on 03-11-2008 14:29 ]

    heavelove1
    Associate II
    May 17, 2011
    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