PEmicro Blog

NXP S32K1xx: CSEC and Mass Erase

Sep 11, 2026

The NXP S32K1xx devices have a Cryptographic Services Engine (CSEc) module that provides security features. With respect to flash operations, once CSEc flash keys have been allocated, flash mass erase on the S32K1xx is disabled. This article explains how to handle the different erases using PEmicro tools.

This is noted in the S32K1xx Reference Manual:

    For CSEc enabled parts, once Flash Keys are allocated (regardless of being initialized or not), the SHE spec requirement of not erasing Flash Keys without authentication will apply. This will mean Authentication (DBG_CHAL & DBG_AUTH) commands must be run and pass (removing all flash keys) before erase of the DFlash (all Flash Keys are backed up in emulated EEPROM in DFlash). Thus Erase All Blocks and Erase All Blocks Unsecure will not work, nor will Erase Flash Block or Sector IF the selected Block/Sector includes the DFlash where the keys are stored. Additionally if any Flash Keys are write protected, they can't be erased/removed, thus the DFlash can't be erased and the Authentication process will not pass.

This affects which algorithm should be selected in the PEmicro PROGACMP and Cyclone Image Creation software. 

CSEc Disabled

Users who are not enabling CSEc can select the following algorithm files to perform a flash mass erase using the "EM ;Erase Module" command. This mass erase is ideal for restoring a device to its factory state by erasing all flash regions, including PFlash, DFlash, and EEPROM.

s32k116f128m4_pflash_dflash_eeprom.arp
s32k118f256m4_pflash_dflash_eeprom.arp
s32k142wf256m8_pflash_dflash_eeprom.arp
s32k144wf512m8_pflash_dflash_eeprom.arp
s32k142f256m15_pflash_dflash_eeprom.arp
s32k144f512m15_pflash_dflash_eeprom.arp
s32k146f1m0m11_pflash_dflash_eeprom.arp
s32k148f2m0m11_pflash_dflash_eeprom.arp


CSEc Enabled

However, users who enable CSEc must use the following algorithm files to perform a flash sector erase instead, which leaves the DFlash sectors holding the keys untouched. The "EM ;Erase Module" command will perform the flash sector erase, which will only erase the PFlash region.

s32k116f128m4_sector_erase.arp
s32k118f256m4_sector_erase.arp
s32k142wf256m8_sector_erase.arp
s32k144wf512m8_sector_erase.arp
s32k142f256m15_sector_erase.arp
s32k144f512m15_sector_erase.arp
s32k146f1m0m11_sector_erase.arp
s32k148f2m0m11_sector_erase.arp

    

For more information regarding CSEC and flash programming, please refer to AN12130, Section 3.2.5.2 – Mass erase and CSEc considerations:


https://www.nxp.com/docs/en/application-note/AN12130.pdf

Tags related to this Blog Post

Cyclone     Cyclone FX     Multilink     Multilink FX     GDB Server     Prog ACMP     ARM     NXP     Device Support     Production Programming     Debug