Question about S32k312 C40_Ip write/erase pflash

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

Question about S32k312 C40_Ip write/erase pflash

412 Views
lucaswang
Contributor II

hello!

I'm using s32k312 with RTD5.0.0, there's some problem about C40_Ip erasing pflash :

  1. Erase block0(0x420000-0x500000) failed, will cause hard_fault;
  2. Erase block1(0x500000-Hse_start) successful;

I found a post https://community.nxp.com/t5/S32K/S32K344-C40-IP-Hardware-Fault-Problem/td-p/1697432 

I modify C40_Ip.h, but the erasing still fails.

C8000B92-26B8-46da-B99F-B6ABBCF118DF.png

A8A99288-1158-4791-B832-AD5C70B8BB68.pngmain.png

Tags (1)
0 Kudos
Reply
5 Replies

378 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @lucaswang,

It works with this test project:

https://community.nxp.com/t5/S32K-Knowledge-Base/S32K312-C40-Ip-SRAM-RTD-500-DS35/ta-p/2074245

Make sure these functions are also placed in SRAM (SchM_Mem_43_INFLS.h).

extern void SchM_Enter_Mem_43_INFLS_MEM_EXCLUSIVE_AREA_xx(void);
extern void SchM_Exit_Mem_43_INFLS_MEM_EXCLUSIVE_AREA_xx(void);

 

Regards,

Daniel

 

0 Kudos
Reply

350 Views
lucaswang
Contributor II

Thank you for your reply! According to what you said, I can perform the erase and write operations. However, I still encountered other problems. My program receives data sent from the PC via the serial port and writes to the FLASH while receiving the data. But each time, it can only write a part of the data, and then the program triggers a HARDFAULT reset. Here is the interface of my write function:

D506A331-7182-4f70-A8A4-3B4C1E0D296D.png

0 Kudos
Reply

347 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @lucaswang,

There can be a collision if 

  • the Interrupt vector table
  • or the interrupt handlers
  • or the data that the handlers read

are in that PFlash block that is being programmed.

Can you mask the interrupts before the flash operations are launched?

 

Regards,

Daniel

 

 

 

0 Kudos
Reply

341 Views
lucaswang
Contributor II
I have masked the interrupts before the flash operations.
See my function interface:
AB095F7C-1653-4a99-AEEA-05821C2343B1.png
I found that when the length is passed in as 128, the writing can be completed. However, when the length is passed in as 4096, only a part of it can be written, and then a reset will be triggered afterwards.
I have another question, as shown in the following picture:
9CB3AB23-A687-4500-AEA7-3E4696E2193D.png
 
 this sector is locked. How should I unlock it? I'm using a JFlash debugger, and after the problem occurred, the program can no longer be flashed in.
0 Kudos
Reply

325 Views
danielmartynek
NXP TechSupport
NXP TechSupport

This is expected, as you can see in the RM, we can program max. 128B at once.

danielmartynek_0-1744096571767.png

danielmartynek_1-1744096697422.png

danielmartynek_2-1744096755206.png

 

Regards,

Daniel

 

 

0 Kudos
Reply