Hi,
I do not know which tool you are using but normally if the MCU is secured or we want to clean it then we have to connect suitable SW via BDM interface (USB multilink www.pemicro.com) to the MCU. The pins MODB and MODA must be connected to GND and MODC is usually connected to Vdd via pull up. (The board should contain standard BDM connector for this purpose) The SW pulls the MODC down during reset using interface circuit to be MODC=MODB=MODA=0 which enters the MCU in special single chip mode and we can enter mass erase command and unsecure command to the MCU.
You can download Unsecure_12 program from the www.pemicro.com which unsecures the MCU....or page
https://www.pemicro.com/support/download_processor.cfm?type=5
Moreover, if you are using CodeWarrior it always mass erase the MCU before a new code is loaded into it. Ther is also unsecure the MCU option in the menu. Sometimes i tis not working, noboddy knows why so it is better to use Unsecure_12 for this purpose.
Note; Normally the mass erase command is followed by writing security bits in the MCU to unsecure status to be MCU unsecured after next reset usually performed before application download. The application can then program these bits to required status.
There are threads solving this topic… for example..
https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Erasing-a-secured-S12XD-device-via-BDM/m-p/...
Best regards,
Ladislav