Hi I'm using the kl05 kinetis the TSS library and want to emulate the EEPROM using the c90tfs driver. When I call the function FSL_InitEeprom () generates an interrupt me of
PE_ISR (Cpu_ivINT_Hard_Fault)
{
/ * This code can be changed using the CPU component property "Build Options / Unhandled int code" * /
PE_DEBUGHALT ();
}
Specifically there is the interruption in the line 392 of the file "ee_high_level.c"
/ * If it is not first time initialization * /
/ * Check if the current field has been Identified active * /
if (EE_ERASED_STATE_32 == g_currentActiveSector)
{
/ * If the current active has not been Identified industry,
then the first turn before the alternative is the current active industry sectors * /
sectorAddress = PREV_SECTOR (altSectorAddress);
----> here --- >>> sectorStatus = READ32 (sectorAddress);
/ * The first turn before the alternative sector, the industries is the latest Active field * /
while (EE_SECTOR_STATUS_ACTIVE! = sectorStatus)
{
sectorAddress = PREV_SECTOR (sectorAddress);
sectorStatus = READ32 (sectorAddress);
}
g_currentActiveSector = sectorAddress;
g_freeSpaceAddress = sectorAddress + EE_SECTOR_SIZE - EE_SECTOR_WASTE;
}
my master code is as follows:
int main (void)
/ * lint-restore Enable MISRA rule (6.3) checking. * /
{
/ * Variable local Write your definition here * /
/ / Delay_ms (500) / / DELAY MANDATORY for stability
/ *** Processor Expert internal initialization. DO NOT REMOVE THIS CODE! *** /
PE_low_level_init ();
/ *** End of Processor Expert internal initialization. *** /
/ * Write your code here * /
/ * For example: for (;;) {} * /
UINT32 fnSize = 0x200;
UINT32 fnSrc = (UINT32) FSL_FlashCommandSequence - 1;
UINT32 fnDest = (UINT32) __ram_for_command_sequence_func;
CopyToRAM (fnDest, fnSize, fnSrc);
/ / Assign value to the global function pointer for FlashCommandSequence. / /
/ / The EED will use this pointer whenever service calls FlashCommandSequence it. / /
g_pFlashCommandSequence = (pFLASHCOMMANDSEQUENCE) (fnDest + 1);
returnCode = FSL_DeinitEeprom ();
if (EE_OK! = returnCode)
{
ErrorTrap ();
}
returnCode = FSL_InitEeprom () ;/ / FSL_DeinitEeprom ();
if (EE_OK! = returnCode) {ErrorTrap ();}
WaitEepromReady ();
已解决! 转到解答。
Erase the whole chip and try again by disableinterrupts before calling initeeprom.
If error still happends, check whether sectorAddress is within the flash area. Reading of non-existing address will cause fault interrupt.
Erase the whole chip and try again by disableinterrupts before calling initeeprom.
If error still happends, check whether sectorAddress is within the flash area. Reading of non-existing address will cause fault interrupt.