FLASH_Unlock(); //解锁FLASH后才能向FLASH中写数据。 FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR|FLASH_FLAG_PGSERR); StartSector = GetSector(FLASH_USER_START_ADDR); //获取FLASH的Sector编号 EndSector = GetSector(FLASH_USER...
FLASH_Unlock(); //解锁FLASH编程擦除控制器 FLASH_ClearFlag(FLASH_FLAG_BSY|FLASH_FLAG_EOP|FLASH_FLAG_PGERR|FLASH_FLAG_WRPRTERR);//清除标志位 /*** // FLASH_FLAG_BSY FLASH忙标志位 // FLASH_FLAG_EOP FLASH操作结束标志位 // FLASH_FLAG_PGERR FLASH编写错误标志位 // FLASH_FLAG_WRPRTERR FL...
/* 清空所有标志位 */ FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR); /* 按页擦除*/ for(EraseCounter = 0; (EraseCounter < NbrOfPage) && (FLASHStatus == FLASH_COMPLETE); EraseCounter++) { FLASHStatus = FLASH_ErasePage(WRITE_START_ADDR + (FLASH_PAGE_SIZE...
FLASH_Unlock(); FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR|FLASH_FLAG_PGSERR); 通过工具写数据,就是我们量产时说的下载数据,正式一点说法叫编程。 3.擦除数据 擦除数据通常分擦除页、扇区、整块,擦除时间也因型号不同、速度不同...
FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR); FLASH_ErasePage(ERROR_PROCESS_CODE_ADDR); FLASH_Lock(); } void(*boot_jump2App)(); void boot_loadApp(uint32_t addr) { uint8_t i; ...
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR); /* 擦除FLASH 页*/ for(EraseCounter = 0; (EraseCounter < NbrOfPage) && (FLASHStatus == FLASH_COMPLETE); EraseCounter++) { FLASHStatus = FLASH_ErasePage(WRITE_START_ADDR + (FLASH_PAGE_SIZE * EraseCounter));...
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR); /* 擦除FLASH 页*/ for(EraseCounter = 0; (EraseCounter < NbrOfPage) && (FLASHStatus == FLASH_COMPLETE); EraseCounter++) { FLASHStatus = FLASH_ErasePage(WRITE_START_ADDR + (FLASH_PAGE_SIZE * EraseCounter));...
FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);//清除所有标志 FLASHStatus = FLASH_ErasePage(WriteFlashAddress);//扇区擦除 if(FLASHStatus == FLASH_COMPLETE) { for(k=0;(k<len) && (FLASHStatus == FLASH_COMPLETE);k++) ...
1. 在擦除和写入操作后,检查FLASH_FLAG_EOP标志位,确保操作已经完成。2. 检查错误标志位,如FLASH_...
(WRITE_END_ADDR - WRITE_START_ADDR) / FLASH_PAGE_SIZE; /* 清除所有挂起标志位 */ FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR); /* 擦除FLASH 页*/ for(EraseCounter = 0; (EraseCounter < NbrOfPage) && (FLASHStatus == FLASH_COMPLETE); EraseCounter++) {...