Hello Steve Robalino:
Usually this kind of error is caused by one of the next:
1- Not relocating the Flash Command function to RAM (Read-While-Write error).
- Check that you are calling the Flash_Init() function before any flash operations.
2- Interrupt triggering during a Flash operation (Read-While-Write error).
- Disable all interrupts globally before calling any Flash operation API.
e.g.
DisableGlobalIRQ();
FLASH_Erase(...);
EnableGlobalIRQ();
3- MCU working in HSRUN mode (180 MHz for K65) where flash operations are not allowed.
- You are working at 120 MHz so I do not think this applies to your case.
Check these points and if you cannot solve the issue please let me know.
Best regards,
Jorge Gonzalez
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------