S32K312 PEP error bit of MCRS is set despite of fact that PFCBLK0_SPELOCK, PFCBLK0_SSPELOCK cleared

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

S32K312 PEP error bit of MCRS is set despite of fact that PFCBLK0_SPELOCK, PFCBLK0_SSPELOCK cleared

Jump to solution
396 Views
Andik
Contributor II

Hi,

I'm trying to program FLASH of S32K312, for now, it's 32 words from address 0x401000 to 0x40107F (nearly start of "Code flash memory 0").

Communication is done via SWD interface, AHB_AP (DAP master #4). Chip is blank.

 

PFLASH_PFCBLK0_SPELOCK, PFLASH_PFCBLK0_SSPELOCK, PFLASH_PFCBLK0_SETSLOCK are set to 0.

Reading XRDC_HWCFG1_DID gets 0 as domain ID.

PFLASH_PFCPGM_PEADR_L is loaded with address 0x401000.

FLASH_MCRS is written with PES and PEP set to 1 to clear pending errors.

Data are written to DATAX[0]-DATAx[31].

FLASH_MCR is set to MCR_PGM

FLASH_MCR is set to (MCR_PGM or MCR_EHV)

At this point I get FLASH_MCRS = 0x0002C100, meaning PEP bit is set.

I did not find demos with example of protection management in S32DS. Found S32K344 Demo template with FlashInit.c, FlashProgram.c. Also not sure, where are protected areas described according to particular lock register bits.

Any advice?

Thanks.

A.N.

 

0 Kudos
Reply
1 Solution
327 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Andik,

Regarding the sectors, if you program 0x401000 to 0x40107F, it is the first super sector in PFLASH_PFCBLK0_SSPELOCK[0].

There are two 1024KB blocks on S32K312.

12x64KB sectors (super sectors) in the first 768KB area of every block.

32x8KB sectors in the last 256KB area of every block.

danielmartynek_1-1744103153440.png

 

And this is the programming model, please double-check all the steps.

danielmartynek_2-1744103249600.png

danielmartynek_3-1744103308240.png

danielmartynek_4-1744103662491.png

 

Do you develop a programmer?

If so, you would get better suport as an NXP partner:

https://www.nxp.com/design/design-center/partner-marketplace/partner-onboarding:PARTNER-ENROLL

 

Regards,

Daniel

 

 

 

 

 

 

View solution in original post

0 Kudos
Reply
4 Replies
328 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Andik,

Regarding the sectors, if you program 0x401000 to 0x40107F, it is the first super sector in PFLASH_PFCBLK0_SSPELOCK[0].

There are two 1024KB blocks on S32K312.

12x64KB sectors (super sectors) in the first 768KB area of every block.

32x8KB sectors in the last 256KB area of every block.

danielmartynek_1-1744103153440.png

 

And this is the programming model, please double-check all the steps.

danielmartynek_2-1744103249600.png

danielmartynek_3-1744103308240.png

danielmartynek_4-1744103662491.png

 

Do you develop a programmer?

If so, you would get better suport as an NXP partner:

https://www.nxp.com/design/design-center/partner-marketplace/partner-onboarding:PARTNER-ENROLL

 

Regards,

Daniel

 

 

 

 

 

 

0 Kudos
Reply
382 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Andrej,

Can you read this register?

danielmartynek_0-1743752641982.png

 

Thanks,

Daniel

0 Kudos
Reply
348 Views
Andik
Contributor II

I have to mention, that core is halted, in debug.

0 Kudos
Reply
376 Views
Andik
Contributor II
Hi Daniel,
content of PRTN0_CORE2_STAT is 0x80000001
0 Kudos
Reply