I'm porting some existing working K60 code to the K66, but am having problems getting the "swap flash" mechanism (described in AN4533) to work properly. The code works fine on my K60, but not on my K66.
The MCU in question is a bare-metal MK66FN2M0VLQ18. I am using V1.0.4 of the C90TFS flash driver. I am NOT running in HSRUN mode (I'm running at 120Mhz).
I get no errors while preparing the flash sectors, erasing and programming the flash, and issuing the swap command (0x46); However after the MCU reboots, I immediately get ACCERR and FPVIOL in the FTFE_FSTAT register, at which point the the processor is locked up. I then have to do a "mass erase" to get the MCU back to a usable state.
Has anyone else experienced this when porting their K60 flash swapping code to the K66?
Thanks in advance for any insights!