2008-11-06 05:49 PM
Flash ReadOut Protection Problem
2011-05-17 03:49 AM
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?2011-05-17 03:49 AM
I think you should reset the mcu, let the mcu load new read protech option to OBR.RDP
2011-05-17 03:49 AM
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!2011-05-17 03:49 AM
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#Firmware2011-05-17 03:49 AM
Maybe check status first is better:
if(FLASH_GetReadOutProtectionStatus() == SET){ //...reach this point is ok. } else{ FLASH_ReadOutProtection(ENABLE) ; __delay_cycles(100000); NVIC_GenerateSystemReset(); }2011-05-17 03:49 AM
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.2011-05-17 03:49 AM
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!2011-05-17 03:49 AM
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 ]2011-05-17 03:49 AM
You can erase the chip use ISP.
A chinese version ISP program can download from www.mcuisp.com