AnsweredAssumed Answered

Forcing RESET in code - 68HC711K4

Question asked by Randall Gardner on Jan 15, 2010
Latest reply on Jan 20, 2010 by Randall Gardner

I am in the process of going back through some 10-15 year old code to diagnosis a problem we are having on a product that is 68HC711K4 based.   The issue I have having is forcing a reset of the microcontroller when ever an Illegal Opcode interrupt occurs.  Periodically, we get reports of the units failing in this mode (LCD displays error code indicating the illegal opcode) - and I would like the microcontroller to automatically reset in the ISR for the Illegal Opcode, especially since I believe that EMI may be intermittently corrupting the data/addr lines going to the external Flash we use for the firmware.  


I believe I am correct in stating, that, unlike the HC08, the Illegal Opcode interrupt does not force a full reset.  So, I am trying to force a clock monitor reset instead, from inside the Illegal Opcode ISR.  Here is the ISR:



__mod2__ void IllegalInst(void)


    asm("\tsei");                                                    /* Disable all interrupts */
    DisplayError(ILLEGAL_INST);                                    /* Display the error */
    SetSolenoidPWM(A, 0, 0, 0);                                   /* Deactivate the solenoids */

    SetSolenoidPWM(B, 0, 0, 0);
    Register.PORTH.BIT.PW2 = 0;                                 
    Register.PORTH.BIT.PW4 = 0;
    asm("\tldaa\t#$00");                                             /* \t(instruction)\t(operand) */  

    asm("\ttap");                                                       /* clear bit 7 of CCR - enable STOP */
    Register.OPTION.BIT.FCME = 1;                              /* 1.02 - enable Clock Monitor */
    asm("\tstop");                                                     /* 1.02 - Stop system clocks and since Clock Monitor enabled, system will reset */




I thought that this would force the program to go to the Clock Monitor interrupt vector since the STOP instruction stops the clocks, but it doesn't appear to going to that vector.  


Sorry for the long-winded description, but I haven't really used an HC11 since college and it's tough remember all the caveats sometimes.  Any insight is greatly appreciated.