Hi @all,
i’am trying to store some data in the internal flash memory (see code below). Unfortunately the ARM runs into a prefetch abort error after the write operation. After reset i check the programmed flash page and the content is correctly written. MCK is 48MHz and as the uarts are working correctly i’am sure to have it set up correctly.
wrptr=(unsigned long *)(CONFIGADDR); // #define CONFIGADDR (uint32_t)0x03C000
// dump contents of memory section
for(l=0;l<512;l+=4)
{
sprintf(buf,"%d: %08X : %8X\r\n",l, (unsigned long)(wrptr),*(wrptr));
write_str_USART1(buf);
wrptr++;
}
// write flash page
wrptr=(unsigned long *)(CONFIGADDR);
for(l=0;l<256;l+=4)
{
*(wrptr++) = 0x12345681;
}
AT91C_BASE_MC->MC_FMR = (((75)<<16) & AT91C_MC_FMCN) | AT91C_MC_FWS_1FWS;
// wait for flash done/ready
while(!(AT91C_BASE_MC->MC_FSR & AT91C_MC_FRDY));
AT91C_BASE_MC->MC_FCR = (0x5A<<24) | (((CONFIGADDR/AT91C_IFLASH_PAGE_SIZE)<<8)&AT91C_MC_PAGEN) | AT91C_MC_FCMD_START_PROG;
// ==== PREFETCH ABORT ERROR, following code never reached ============================
// wait for flash done/ready
while(!(AT91C_BASE_MC->MC_FSR & AT91C_MC_FRDY));
Right now i’m a little bit clueless so any suggestions are welcome.