Hello Jorge,
Thank you very much for replying and offering help.
Here is the full part number for K60 CPU - MK60FX512VLQ12 . The code in the message above does NOT work with this CPU.
However, the same code works on K70 CPU, part number MK70FN1M0VMJ12.
So, to make it work on K60 also, I put in while loops. Here is the modified code that works on both CPUs.
If you guys can explain why I need this for K60, that would be great. I curious to know what is the reason.
while(FTFE_FCCOB0 !=(uint8_t)FLASH_CMD_SECTOR_ERASE)
{
*(volatile uint8_t *)&FTFE_FCCOB0 = (uint8_t)FLASH_CMD_SECTOR_ERASE;
}
while(FTFE_FCCOB1 != (uint8_t)(startAddress >> 16))
{
*(volatile uint8_t *)&FTFE_FCCOB1 = (uint8_t)(startAddress >> 16);
}
while(FTFE_FCCOB2 != (uint8_t)((startAddress >> 8) & 0xFF))
{
*(volatile uint8_t *)&FTFE_FCCOB2 = (uint8_t)((startAddress >> 8) & 0xFF);
}
while(FTFE_FCCOB3 != (uint8_t)(startAddress & 0xFF))
{
*(volatile uint8_t *)&FTFE_FCCOB3 = (uint8_t)(startAddress & 0xFF);
}