Other Parts Discussed in Thread: EK-TM4C1294XL
Tool/software:
I am writing a bootloader and writing the program data into flash starting at address 0x0001 0000 this works fine until I hit address 0x0002 0000 and then the program detects an Access Error in the raw interrupt status register. I have examined the FMPREn and FMPPEn registers and found all the bits set. I have also examined the flash address where the write was supposed to happen and found it to be all 0, which is not the data to be written. Here is the code used to write to Flash.
BOOL amd_WriteWord(volatile ULONG* pulDest, ULONG* pulSource) { BOOL bOK = TRUE; union { UBYTE ubByte[4]; ULONG ulWord; } atTemp; MAP_IntMasterDisable(); patFlash->FCMISC = (FLASH_FCMISC_AMISC | FLASH_FCMISC_VOLTMISC | FLASH_FCMISC_ERMISC); patFlash->FMA = pulDest; atTemp.ubByte[0] = *((UBYTE*)pulSource); atTemp.ubByte[1] = *((UBYTE*)pulSource+1); atTemp.ubByte[2] = *((UBYTE*)pulSource+2); atTemp.ubByte[3] = *((UBYTE*)pulSource+3); patFlash->FMD = atTemp.ulWord; patFlash->FMC = FLASH_FMC_WRKEY | FLASH_FMC_WRITE; while (patFlash->FMC & FLASH_FMC_WRITE) {} //wait for the write to complete if (patFlash->FCRIS & (FLASH_FCRIS_ARIS | FLASH_FCRIS_VOLTRIS | FLASH_FCRIS_INVDRIS | FLASH_FCRIS_PROGRIS)) { bOK = FALSE; } MAP_IntMasterEnable(); return(bOK); }
This error happens when pulDest = 0x0002 0000. The data passed to the function is also valid.
Any Help debugging is appreciated.