I am in the process of evaluating the Freedom board with the Kinetis KL25 MCU.
Basically, writing a small program that interacts with the serial port to test peripherals, and become familiar with CodeWarrior and the Kinetis MCU.
Up to now, everything has worked as expected.
I am now getting hung up on the flash programming and erasing.
To test the ability to erase a flash sector, and reprogram a long word, I have used code snippets from application note AN2295, specifically the Flash Driver code comprised of three modules; flash_kinetis.c, flash_kinetis.h and flash_kinetisRamFunc.c
My test program calls functions in these modules to; initialize the ram code, erase a sector, and program a long word (not using the other flash functions)
After initializing the ram code, and assuming the 1st long word in the sector is already erased (0xffffffff), I can perform a long word program using FLASH_ProgramLongWord(LWord destination, LWord data32b) which works correctly. A query of the long word flash location shows it was programmed as expected. However, if I call the sector erase function; FLASH_EraseSector(LWord destination), the sector is erased, but its as though the stack gets screwed up, because the program resets and starts from the begining. The Hard Fault exception is being handled, so I know a Hard Fault is not occurring.
If I load the PE Micro SDA debugger into the Freedom board, invoke the Eclipse debugger and step through the code, the reset does not occur after erasing the sector, however, if I run the program in the debugger without stepping through it (at full speed) , it again resets.
Any help would be greatly appreciated,