cancel
Showing results for 
Search instead for 
Did you mean: 

erase

spa
Associate II
Posted on January 28, 2009 at 09:54

erase

1 REPLY 1
spa
Associate II
Posted on May 17, 2011 at 13:01

Hi.

I’m making a bootloader and now I’m trying to erase the applications pages in the flash, but when I execute the erase “for loop� I lose the JTAG connection.

I’m sorry for the lag of information’s, I hope some of you have tried the same, and know a way around, thanks.

Best regards

Søren P.

Code:

<BR>define PAGE_SIZE 2048 //2048 For high-density <BR>define BOOTLOADER_PAGES 3 <BR>define TOTAL_FLASH_PAGES 255 <BR>define APPLICATION_ADDRESS ((BOOTLOADER_PAGES) * PAGE_SIZE) + 0x08000000 <BR> <BR> /* Unlock the Flash Program Erase controller */ <BR> FLASH_Unlock(); <BR> <BR> FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP|FLASH_FLAG_PGERR |FLASH_FLAG_WRPRTERR); <BR> <BR> /* Get pages write protection status */ <BR> WRPR_Value = FLASH_GetWriteProtectionOptionByte(); <BR> ProtectedPages = WRPR_Value & 0xFFFFFFFF; <BR> <BR> if (ProtectedPages == 0x00) <BR> {/* Pages are write protected */ <BR> <BR> /* Disable the write protection */ <BR> FLASHStatus = FLASH_EraseOptionBytes(); <BR> } <BR> <BR> /* Erase the FLASH pages */ <BR> for (EraseCounter = 200; (EraseCounter < (TOTAL_FLASH_PAGES - BOOTLOADER_PAGES )); EraseCounter++) <BR> { <BR> FLASHStatus = FLASH_ErasePage(APPLICATION_ADDRESS + (PAGE_SIZE * EraseCounter)); <BR> } <BR>

[ This message was edited by: spa1 on 28-01-2009 14:25 ]