Hi,
I try to program the ECC flash after flashing successfully sectors B to N (Sector A holds my bootloader / flash programmer)
My code looks like this:
void ProgramECC (void) { uint32 MainAddres; uint32 ECCAddres; uint16 EccValue; uint64* pData; Fapi_StatusType oReturnCheck; Fapi_FlashStatusType oFlashStatus; MainAddres = 0x100000; EALLOW; FlashEccRegs.ECC_ENABLE.bit.ENABLE = 0x0; EDIS; for (ECCAddres=0x200000; MainAddres < 0x13E000; ECCAddres++) { // Get addres of corresponcing MAIN flash MainAddres = (uint32)Fapi_remapEccAddress(ECCAddres); // Get pointer to main addres pData = (uint64*)MainAddres; // Calculate ECC value EccValue = Fapi_calculateEcc(MainAddres,*pData); // Program ECC Value Fapi_issueProgrammingCommandForEccAddresses(&ECCAddres,&EccValue,1); while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy); if(oReturnCheck != Fapi_Status_Success) { // Check Flash API documentation for possible errors Error(oReturnCheck); } // Read FMSTAT register contents to know the status of FSM after // program command for any debug oFlashStatus = Fapi_getFsmStatus();
} }
The problem is that the "oReturnCheck" value returns 0x004C, which is not documented.
One possible cause could be the flashbank? I activated FlashBank 0 ...
Thanks,
Werner