Hi,
So here it is.
I am going to start that Device ID is placed on the address 0x1FC000 which is not presented in the documentation because it is internal number which reason is hidden to public.
I have created two command files you can run in the debugger window – see and test attached project.
They are AAA_Read_Device_ID_And_OTPROM.cmd and AAA_ProgramOnceField.cmd.
The project which also present reading and writing program once field is not relevant but should be created for the device we want to play with. It is not required to be code (simple code, enough to use what is generated by wizard) loaded into the MCU’s memory. However, necessary is the debugger is connected to a memory. Because of this it is enough to set:


…. And press debug
In the debug enable “Debugger Shell”:
Before continuing please modify flash clock setup in both files to value suitable for programming on the basis of the oscclk you use. In the files search for lines

Write into debugger shell command which runs the AAA_Read_Device_ID_And_OTPROM.cmd:
source "c:\D\CODING & SW\ECLIPSE\S12ZVMC-FLASH-WRITEONCEFIELD-CW106\AAA_Read_Device_ID_And_OTPROM.cmd"
(it is possible you have different path to the file…please change it)
The command will execute and shows:
Device ID
And Program field phrase 0. If you want to see another phrase you should modify AAA_Read_Device_ID_And_OTPROM.cmd line set PHRASE 1.

Change 1 to the phrase you want to see and run the command presented above “source …..” again. It is enough to press arrow up on the keyboard to see and use previous commands.
In order to program selected field use and run command “source” with the file:
AAA_ProgramOnceField.cmd
source "c:\D\CODING & SW\ECLIPSE\S12ZVMC-FLASH-WRITEONCEFIELD-CW106\AAA_ProgramOnceField.cmd"
The same note, the path you have could be different so adjust it.
The same line as in previous file should be changed to select the phrase you want to program.

As a result you will see programming algorithm and also read back of the field, example of output:
%>source "c:\D\CODING &
SW\ECLIPSE\S12ZVMC-FLASH-WRITEONC
EFIELD-CW106\AAA_ProgramOnceField
.cmd"
############################
Programming Field =
2
############################
cmdwin::mem 0x0386 %x = 0x30
cmdwin::wait 1000
cmdwin::mem 0x0382 %x = 0x05
cmdwin::mem 0x038C %x = 0x07
cmdwin::mem 0x038D %x = 0x00
cmdwin::mem 0x038E %x = 0x00
cmdwin::mem 0x038F %x = 2
cmdwin::mem 0x0390 %x = 0xA2
cmdwin::mem 0x0391 %x = 0xB2
cmdwin::mem 0x0392 %x = 0xC2
cmdwin::mem 0x0393 %x = 0xD2
cmdwin::mem 0x0394 %x = 0xE2
cmdwin::mem 0x0395 %x = 0xF2
cmdwin::mem 0x0396 %x = 0xA3
cmdwin::mem 0x0397 %x = 0xB3
cmdwin::mem 0x0386 %x = 0x80
cmdwin::wait 1000
############################
Read back Programmed Field =
2
############################
cmdwin::mem 0x0386 %x = 0x30
cmdwin::wait 1000
cmdwin::mem 0x0382 %x = 0x01
cmdwin::mem 0x038C %x = 0x04
cmdwin::mem 0x038D %x = 0x00
cmdwin::mem 0x038E %x = 0x00
cmdwin::mem 0x038F %x = 2
cmdwin::mem 0x0386 %x = 0x80
cmdwin::wait 1000
cmdwin::mem 0x0390 8
390 $a2 $b2 $c2 $d2 $e2 $f2
$a3 $b3 . . . . . . . .
….Are you able to test? Do you understand?
Best regards,
Ladislav