S32K312开启HSE后擦除app报错program and eraseprotection errors,怎么解决

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32K312开启HSE后擦除app报错program and eraseprotection errors,怎么解决

760件の閲覧回数
aiyayabeibei
Contributor I

S32K312开启HSE后擦除app,报错program and eraseprotection errors,Debug查看FlashDriver 中对于SPELOCK,SSPELOCK(SPELOCK[0]=0xFFFFFF00,SPELOCK[1]=0xFFFFFF00,SSPELOCK[0]=0x00000000,SSPELOCK[1]=0x00000000)写入值解锁操作无效,怎么解决

 
0 件の賞賛
返信
4 返答(返信)

706件の閲覧回数
aiyayabeibei
Contributor I

谢谢,尝试了后成功解决了

 

0 件の賞賛
返信

730件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @aiyayabeibei 

S32K312 has following flash blocks (see „Table 92 Flash block configuration“ in the reference manual)

Block 0 – Code flash 1MB at 0x0040_0000 - 0x004F_FFFF

Block 1 – Code flash 1MB at 0x0050_0000 - 0x005F_FFFF

Block 2 – Data flash 128KB at 0x1000_0000 - 0x1001_FFFF

 

If FullMem HSE FW is installed, the memory shrinks to following (because the rest is allocated exclusively for HSE):

Block 0 – Code flash 1MB at 0x0040_0000 - 0x004F_FFFF

Block 1 – Code flash (1MB-176KB)at 0x0050_0000 - 0x005D_3FFF

Block 2 – Data flash (128KB-40KB) at 0x1000_0000 - 0x1001_5FFF

 

Now, when you write the lock bits, it is necessary to keep the bits covering HSE space set. This is the key point. If you try to write a value where even one bit covering HSE space is cleared, bus error is returned.

So, when using sector protection (last 256KB of each block), we can write any number to PFCBLK0_SPELOCK because Block 0 is not affected by HSE.

In case of Block 1, the situation is different. Last 176KB is occupied by HSE, so only 80KB left. 80KB means that it’s 10 sectors. If we want to unlock all of them, we can write:

PFCBLK1_SPELOCK = 0xFFFFFC00;

This will pass because we kept all HSE bits set. And you can write anything to lowest 10 bits.

In case of data flash (Block 2), there’s 88KB. To unlock all of them:

PFCBLK2_SPELOCK = 0xFFFFF800;

 

Super sectors are applicable only for Block 0 and 1. HSE does not affect first 768KB of those 1MB blocks, so there are no issues here and you can write anything to PFCBLK0_SSPELOCK and PFCBLK1_SSPELOCK.

Data flash (Block 2) has less than 256KB, so super sector has no effect here.

Regards,

Lukas

0 件の賞賛
返信

558件の閲覧回数
aiyayabeibei
Contributor I

Hello @lukaszadrapa ;

         May I ask you which register flag bit is after S32K312 performs swap switching

0 件の賞賛
返信

542件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Partition swapping needs to be requested by HSE service HSE_SRV_ID_ACTIVATE_PASSIVE_BLOCK. It's not just about writing a register. See please HSE FW RM for more details.

Regards,

Lukas

0 件の賞賛
返信