|
  
- 帖子
- 1073
- 精华
- 0
- 威望
- 2382
- 资源筹码
- 20 元
- 在线时间
- 446 小时
|
读保护解除的方式
在RAM中執行後 OK!
int main (void) {
FLASH_Status status = FLASH_COMPLETE;
Chip_Init();
UnlockFlash();
status = WaitForLastOperation(10);
FLASH->OPTKEYR = FLASH_KEY1;
FLASH->OPTKEYR = FLASH_KEY2;
FLASH->CR |= CR_OPTER_Set;
FLASH->CR |= CR_STRT_Set;
status = WaitForLastOperation(10);
if(status == FLASH_COMPLETE)
{
/* if the erase operation is completed, disable the OPTER Bit */
FLASH->CR &= CR_OPTER_Reset;
/* Enable the Option Bytes Programming operation */
FLASH->CR |= CR_OPTPG_Set;
OB->RDP = RDP_Key;
}
/* Wait for last operation to be completed */
status = WaitForLastOperation(10);
if(status != FLASH_BUSY)
{
/* if the program operation is completed, disable the OPTPG Bit */
FLASH->CR &= CR_OPTPG_Reset;
}
while(1);
} |
在路上 我们一起奋斗
淘宝平台:http://shop60442272.taobao.com/ |
|