S32K144 FLASH

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S32K144 FLASH

4,529 次查看
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 回复数

3,231 次查看
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

3,230 次查看
mahmoudsherrah
Contributor III

Hello Ravi,

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

0 项奖励
回复

3,231 次查看
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 项奖励
回复

3,231 次查看
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 项奖励
回复