cancel
Showing results for 
Search instead for 
Did you mean: 

Problem Erasing Bank 0 (Boot Bank)

broeder
Associate
Posted on November 13, 2007 at 06:51

Problem Erasing Bank 0 (Boot Bank)

1 REPLY 1
broeder
Associate
Posted on May 17, 2011 at 09:47

I am having trouble erasing Bank 0 which the code text of my program is in. I have configured the FMI as in the example provided by ST:

Configure bank 0 as 512KB and bank 1 as 32KB */

/* Configure bank 0 at address 0x0 and bank 1 at address 0x80000

SCU_AHBPeriphClockConfig(__FMI, ENABLE);

SCU_AHBPeriphReset(__FMI, DISABLE);

FMI_BankRemapConfig(0x4, 0x2, 0x0, 0x80000);

I put the following code in RAM (using __ramfunc) to erase the code text of my program from Bank 0 but my program resets when this is called and the sector has not been erased. I disable interrupts before executing this code.

// Disable write protection on the specified sector

FMI_WriteProtectionCmd(CODE_SECTOR1, DISABLE);

// Erase the specified sector

FMI_EraseSector(CODE_SECTOR1);

if (FMI_WaitForLastOperation(FMI_BANK_0) == FMI_TIME_OUT_ERROR) {

return(false);

}

// Enable write protection on the specified sector

FMI_WriteProtectionCmd(CODE_SECTOR1, ENABLE);

I have verified I can erase sectors in Bank 1. Are there additional steps necessary to erase code text from Bank 0?