int main(void) {
uint32_t signature1,signature2;
char buffer[1024];
int i;
uint8_t Result;
SystemCoreClockUpdate();
for (i=0;i<1024;i++)
buffer=i;
Chip_FMC_ComputeSignature(0x3c00,0x3fff);
while (Chip_FMC_IsSignatureBusy());
signature1=Chip_FMC_GetSignature(0);
Result=Chip_IAP_PreSectorForReadWrite(15,15);
Result=Chip_IAP_EraseSector(15,15);
Chip_FMC_ComputeSignature(0x3c00,0x3fff);
while (Chip_FMC_IsSignatureBusy());
signature1=Chip_FMC_GetSignature(0);
Result=Chip_IAP_PreSectorForReadWrite(15,15);
Result=Chip_IAP_CopyRamToFlash(15*1024,buffer,1024);
Chip_FMC_ComputeSignature(0x3c00,0x3fff);
while (Chip_FMC_IsSignatureBusy());
signature2=Chip_FMC_GetSignature(0);
return 0 ;
}
|
Check out this thread, possibly this was the problem: LPC4337 IAP erase flash hang
In one version of LpcOpen, LPC_FMC is being declared as a pointer to a pointer but it is not. It is a pointer to a struct.
#define LPC_FMC ((LPC_FMC_T * *) LPC_FMCA_BASE)
Let me know if this has helped, as I was facing some similar issues.