Other Parts Discussed in Thread: CCSTUDIO, ENERGYTRACE, SYSCONFIG
Dear Vamsi
I have still problems. No NMI problem; it is solved, but the ECC calulation is wrong.
This are the routines which not will cause any NMI Interrupt
static Fapi_FlashStatusType FlashProg_WriteEcc(uint32_t addr)
{
uint64_t data;
uint16_t ecc;
Fapi_StatusType fapiSts;
Fapi_FlashStatusType fapiFlashSts;
int16_t rv;
// uint32 eccAddress;
EALLOW;
Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0x0;
EDIS;
EALLOW;
fapiFlashSts = Fapi_setActiveFlashBank(Fapi_FlashBank0);
EDIS;
data = *(uint64_t *) addr;
ecc = Fapi_calculateEcc(addr, data);
fapiSts = Fapi_issueProgrammingCommand((uint32_t *) addr, NULL, 0, &ecc, 1, Fapi_EccOnly);
while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);
if (fapiSts == Fapi_Status_Success)
{
fapiFlashSts = Fapi_getFsmStatus();
rv = 0;
}
ASSERT(fapiFlashSts == 0);
ASSERT(fapiSts == Fapi_Status_Success);
return rv;
}
/**
* @brief program ECC call after programming with Fapi_DataOnly option
* @param addr. range
* @retval status
*/
Fapi_FlashStatusType CalculateAndWriteEcc(uint32_t BlockAdrStart, uint32_t BlockAdrEnd)
{
uint32_t addr;
Fapi_FlashStatusType rv;
addr = BlockAdrStart;
rv = 0;
while ((addr <= BlockAdrEnd) && (rv == 0))
{
rv = FlashProg_WriteEcc(addr);
addr = addr + 4;
}
return rv;
}
This is Memory Content:
0x00080000 4800 F328 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF
This ECC Content with emulator programmed
0x1080000
FFB6 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF
This is calculation with my routines:
0x01080000 00A1 0021 003C 00AD 0039 00A8 00B5 0024 0036 00A7 00BA 002B 00BF 002E 0033 00A2
I checked this line workingf fine:
data = *(uint64_t *) addr; //data has expected content addr is also ok.
ecc = Fapi_calculateEcc(addr, data);
calculated ecc is equal to memory content on 0x1080000
So basically the routine is working. Only the result from Fapi_calculateEcc seems to be wrong
Hope you have now the information to really give me the hint I need to solve the problem.
Thanks
Franz