Hi @Chandrakant
Take a look at example 1_Configure_part_and_Load_keys from AN5401SW.zip package.
To enable CSEc, it's necessary to run Program Partition command which enables emulated EEPROM. The EEPROM is needed by CSEc to store the keys. And one of the parameters for Program Partition command is "CSEc Key Size". This can't be zero if you want to use CSEc. See the reference manual and AN5401 for details.
In mentioned example, this is shown in function configure_part_CSEc(). Be aware that the example should be executed from RAM - here is a description from reference manual:
"The Program Partition command must not be launched from flash memory, since flash
memory resources are not accessible during Program Partition command execution."
And it is expected that the device is not partitioned yet. If it is and but if CSEc is not enabled, it's necessary to run Erase All Blocks command to reset the partition. If CSEc is already enabled and you want to start over, change the configuration or erase keys, it's necessary to run example 5_Resetting_flash_to_the_factory_state. For this operation you need to know MASTER_ECU_KEY. The example uses the same MASTER_ECU_KEY which was set in the first example. If you changed it, it needs to be updated also in the "reset" project.
Regards,
Lukas