I am currently using the S32K312 chip.
And I want to use the C40 register to erase the chip.
So, I disabled the SPELOCK And SSPELOCK protection before using the C40asf register.
use those code:
for(i=0;i<5;i++){
(*(volatile unsigned int*)(PFLASH0_SPELOCK0+i*4)) = 0;
}
for(i=0;i<4;i++){
(*(volatile unsigned int*)(PFLASH0_SSPELOCK0+i*4)) = 0;
}
So that,SPELOCK0~SPELOCK4,SSPELOCK0~SSPELOCK3 ,It should all be zero.
The PFLASH address of the S32K312 chip is from 0x400000 to 0x5F4000.
I attempted to erase the sectors starting from 0x400000, with each sector being 8K in size.
However, when I erased the address of 0x5C0000,MCRS return a error.
c40asf->MCRS.PEP was 1, This indicates that this area has not been unlocked.
But I should have unlocked all the PFlash areas of this chip.
please help me fix it.
S32K3