S32K144 FLASH

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K144 FLASH

2,989 Views
raviranjankumar
Contributor III

Hi,

I am working on S32K144  Flash Memory. I want to do partition for 4KB EEPROM and 64KB backup. While partition when I am writing 1 to clear CCIF and again wating  for 1 to complete the process, in while loop it is going to reset handler but when I am debugging step by step then it is not going to reset handler. I am not able to understand.

/* Clear CCIF to launch command */
p_stgFTFCRegAccess->FTFC_FSTAT |= FTFC_FSTAT_CCIF_MSK;

while (0U == (p_stgFTFCRegAccess->FTFC_FSTAT & FTFC_FSTAT_CCIF_MSK));

Please help.

Thanks and regard,

Ravi Ranjan Kumar

4 Replies

1,691 Views
mahmoudsherrah
Contributor III

OK, I have managed to solve this problem, even though this was not stated ANYWHERE before and is done implicitly in all examples I have seen (SDK and No SDK). By implicitly I mean, the code is written of course but there was no stressing on this fact and no mention of it in the application note AN11983.

The solution is to put command launching in a function and place this function in RAM as follows:

void launchCommand(void) __attribute__((section (".code_ram"))); //attribute place the function in RAM. No need to repeat for definition

void launchCommand(void)

{

      /* Clear CCIF to launch command */
      p_stgFTFCRegAccess->FTFC_FSTAT |= FTFC_FSTAT_CCIF_MSK;

      while (0U == (p_stgFTFCRegAccess->FTFC_FSTAT & FTFC_FSTAT_CCIF_MSK));

}

Also enabling FTFC_IRQn before you partition the flash memory using pure software (i.e. flash not partitioned by PE Micro Debug configuration, like "Enable Device Partitioning" and "Preserve Memory Area")

Hope this helps anyone

BR,

Mahmoud

1,690 Views
mahmoudsherrah
Contributor III

Hello Ravi,

I am experiencing the exact same problem. Did you manage to find a solution for that?

0 Kudos

1,691 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

pastedImage_1.png

It looks like this is the reason. Try to execute the code from RAM.

Regards,

Lukas

0 Kudos

1,691 Views
raviranjankumar
Contributor III

Hi Lukas,

               Thanks for reply. I execute the code from RAM and my driver is working fine in S32K144 design studio. But in Keil and IAR, now also it is going to reset handler. I disable interrupt and kept launch command function in RAM section. Anything  else should I do to work flash in Keil and IAR?

Thanks and Regards,

Ravi Ranjan.

0 Kudos