S32K148 OTP

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

S32K148 OTP

3,488 次查看
ZY2
Contributor II

Hello!

My requirement is to put the bootloader code into the OTP area. Do NXP have any related documentation or examples?

0 项奖励
回复
7 回复数

3,468 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @ZY2,

The flash can be protected by programming the FPROT registers in the flash configuration field.

RM, rev.14

36.4.4.1.7 Program Flash Protection Registers (FPROT0 - FPROT3),

36.4.1 Flash configuration field description.

 

Refer to this thread:

https://community.nxp.com/t5/MPC5xxx/program-flash-write-protection/m-p/1073282

 

The protection can be removed by Mass erase.

However, Mass erase can be disabled in the FSEC byte of the Flash configuration field.

 

Regards,

Daniel

 

 

 

 

0 项奖励
回复

3,425 次查看
ZY2
Contributor II

ZY2_0-1729063754643.png

After calling FLASH_DRV_SetPFlashProtection() interface, re-MCU, call FLASH_DRV_GetSecurityState() to check the status, and the return value is 0x01. Do I have the correct steps to enable Flash protection?

0 项奖励
回复

3,401 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @ZY2,

Protection and Security are two different things.

  • Protection:

https://community.nxp.com/t5/MPC5xxx/program-flash-write-protection/m-p/1073282

FLASH_DRV_GetPFlashProtection reads the FTFC_FPROT registers

FLASH_DRV_SetPFlashProtection sets the FTFC_FPROT registers.

These APIs work with the FTFC registers that are configured during the boot sequence from the FPROT bytes in the flash (Flash configuration field). That means we can set the protection in the application image.

danielmartynek_0-1729155898392.png

If you use S32DS IDE, modify Startup_S32k148.S file:

danielmartynek_1-1729156002581.png

 

  • Security

FLASH_DRV_GetSecurityState reads the FSEC register, that is again configurable in the flash configuration field (FSEC byte).

 

Regards,

Daniel

 

 

 

 

0 项奖励
回复

3,395 次查看
ZY2
Contributor II

ZY2_0-1729156601167.pngZY2_1-1729156655743.png

I misconfigured the FSEC register to 0xfe, and finally succeeded in protecting the flash sector 0~0x10000, but the current situation is that the protection of the sector 0~0x10000 cannot be removed by the key.

0 项奖励
回复

3,389 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Again, Security is not Protection, Security bypass is not about the protection.

The protection cannot be removed in the FPROT registers, only added, have a look at the description of the FPROT registers in the RM.

To remove the protection, you need to remove it from the flash image (Flash configuration field).

 

 

 

0 项奖励
回复

3,365 次查看
ZY2
Contributor II

Ok, thanks, so I want to deprotect sectors 0~0x10000 is not allowed right?

ZY2_0-1729160032803.png

 

0 项奖励
回复

3,266 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

This can be done in the Flash configuration field by reflashing the image with a new FPROT settings. But it is not possible to unprotect it from the application in the run time.

 

Regards,

Daniel

 

 

0 项奖励
回复