Using a KL05, I'm having problems with a bus error generated when reading the FSTAT register after launching a erase command operation. The exact operations I'm doing are the following:
while(FTFA_PDD_GetCmdCompleteFlag(FTFA) != FTFA_FSTAT_CCIF_MASK); /* just to be sure peripheral is ready */
/* verification to know when the operation has been completed */
while(FTFA_PDD_GetCmdCompleteFlag(FTFA) != FTFA_FSTAT_CCIF_MASK); /* THIS IS WHERE THE BUS ERROR IS GENERATED */
When the bus error is generated, I observe the flag RDCOLERR in FTFA_FSTAT register has been enabled. I can't understand why this is happening. Even more weird: when I execute step by step this operation, no error is generated. I have tried to add a delay before the sencond FSTAT verification but it is useless.
Do you have any idea about what could be happening? All help will be appreciated.
Thanks in advance
UPDATE: I'm not using Processor Expert code.