Hi @ikarkala ,
Changing the DEPART value on the S32K146 involves manipulating the flash memory partitioning. Here are the answers to your questions:
1. No, it's not possible to change the DEPART value without a mass erase. The DEPART value is stored in the Flash Configuration Field (FCF) which is a part of the flash memory. Changing this value requires erasing and reprogramming the FCF, which is a part of the mass erase operation.
2. To check if the CSE (Cryptographic Security Engine) is enabled, you can read the CSE_PRAM register. If the CSE is enabled, the CSE_PRAM[0] bit will be set to 1. Here is a code snippet to check this:
if ((CSE->CSE_PRAM & CSE_PRAM_CSE_EN_MASK) == CSE_PRAM_CSE_EN_MASK) { // CSE is enabled } else { // CSE is not enabled } 3. Yes, to change the DEPART value, you have to perform a mass erase and then repartition the flash memory. This is because the DEPART value is stored in the FCF which is a part of the flash memory.
4. After a mass erase, you can reset and continue partitioning by running the code. However, you have to ensure that the new DEPART value is correctly set in the FCF. Here is a code snippet to set the DEPART value:
// Set the DEPART value FTFC->FCCOB3 = FTFC_FCCOB3_CCOBn(0x80); // Program Partition command FTFC->FCCOB4 = FTFC_FCCOB4_CCOBn(DEPART_VALUE); // DEPART value // Execute the command FTFC->FSTAT = FTFC_FSTAT_CCIF_MASK;
Please refer to the Flash Partitioning on S32K1xx article for more details about flash partitioning on the S32K146.
Regards,
Prakash