Try this simple C program; add a breakpoint when at the assignment to ARMCOP.
void @near main (void) {
COPCTL=0x40;
COPCTL=0x43;
ARMCOP=6;
while(1) { }
}If the software begins from an external reset COPCTL will contain the value 0x43 prior to setting ARMCOP=6.
However, after the ARMCOP reset, COPCTL will contain the value 0x40, and the assignment to ARMCOP will no longer cause a reset.
According to the datasheet describing the COPCTL fields
Writing CR[2:0] to “000” has no effect, but counts for the “write once” condition.
I expect when ARMCOP=6; is reached COPCTL would always contain the value 0x40.
Specifically tested on an MC9S12XS128 Mask 1M04M.
While this is a simple example, assigning ARMCOP an invalid value is used by the full software to trigger a reset on demand. COPCTL=0 was placed in an earlier module during development and was mistakenly not removed. causing the second reset request to fail.