I am implementing a bootloader using the flash swap functionality. I have ported the code from the AN4533 application note into my project. I proceed through the code just fine until I try to actually write the upper block of the program flash. I get a MSGSTAT0, non-correctable error from the FlashCommandSequence function. I am a little baffled. This code works fine for the setup and the swap functionality and the erase functions without issue. I get this error on all writes.
Chip is MK60FN1M0VLQ12. The application I am loading is roughly 177 kB. I have confirmed the addresses are all accurate.
Any help would be appreciated. I am not sure exactly where to look.
I have run AN4533demo on TWR-K60F120M which has a PK60FN1M0VLQ12(0N96B) on it, the swap command runs well, so I am wondering how you got MGSTAT0 error? is the firmware size aligned to 8 byte? have you also run the demo directly on your device? was the result same? Please kindly help to clarify.
Thanks for your patience!!