AnsweredAssumed Answered

Oh, not CCIF flag again

Question asked by David Gabbay on May 30, 2019
Latest reply on Oct 8, 2019 by David Gabbay


Using S32K116, I was trying to program/erase the internal flash. When I step through (step by step), it works perfectly. When I let it run it is halted right after the command sequence right after clearing STAT[CCIF] flag. 

This issue was discussed several times, in the community, and the suggested solution was to run this tiny code from RAM. This should involve copying code to the SRAM_L and calling it from flash. However, the RM claims explicitly that code can be run from one section of the flash while another section is programmed/erased.

The code I'm using is as following:


u8 FlashCommandSequence(void)
u8 state;

FTFC->FCNFG|= 0x80; /* generate interrupt upon flash's command completion */

do {
state= DG_read8((u32)&FTFC->FSTAT);
} while(!(state & FTFC_FSTAT_CCIF_MASK)) ;

return (u8)(FTFC->FSTAT & 0x71) ;


void clr_CCIF(void)
FTFC->FSTAT= FTFC_FSTAT_CCIF_MASK; /* clr CCIF to start programing */
__asm(" WFI");


From RM ( S32K1XXRM, 36.1.2): 

Having multiple read partitions allows for concurrent operations such as Read
While Write (RWW)

I have not spent to much time on copying the clr_CCIF() function to SRAM_L, but from little time I tried, it failed. 


I will appreciate any help.