AnsweredAssumed Answered

MC9S12ZVHY32 Autonomous Periodical Interrupt stopped working in run mode

Question asked by Nikhil Pawar on Jan 23, 2015
Latest reply on Mar 5, 2015 by iggi

Hello,

            I have a problem with the API (Autonomous Periodical Interrupt) module of MC9S12ZVHY32 it stop working unexpectedly. I am using this controller is a two wheeler instrument cluster application. We used API as an scheduler for different task as update speed, update lcd, update stepper, etc. API is configured to ticks at every 200 usec, here we update the flags for different function to be called after specified intervals as 600usec, 100msec, 200msec etc.

The API module is handled using processor expert code it is intially configured in

1.PE_low_level_init(); function as

 

  /* CPMUAPICTL: APICLK=1,APIFE=0,APIE=1,APIF=1 */

  clrSetReg8Bits(CPMUAPICTL, 0x04U, 0x83U);

 

  /* CPMUAPIR: APIR10=1,APIR8=1,APIR7=1,APIR4=1,APIR2=1 */

setReg16Bits(CPMUAPIR, 0x0594U); 

 

then after this API enable function is called

2.Timer_Api_Enable();

byte Timer_Api_Enable(void)

{

  CPMUAPICTL |= 0x07U;                 /* Enable timer; Reset int. request flag; Enable interrupt */

  return ERR_OK;                      /* OK */

}

 

3. Then we go in main loop and in API ISR every time the interrupt is generated the APIF is cleared as

CPMUAPICTL_APIF = 0x01U;             /* Reset interrupt request flag */

 

then while going to sleep the API disable function at every Ignition OFF sense is called

4.Timer_Api_Disable();

#define Timer_Api_Disable() ( \

  clrSetReg8Bits(CPMUAPICTL, 0x06U, 0x01U), /* Disable API timer and interrupt */ \

  ERR_OK                               /* Return result */ \

)


5.

Then we go to sleep i.e. STOP MODE by calling Cpu_SetStopMode();  function

 

#define Cpu_SetStopMode() \

  /*lint -save  -e950 Disable MISRA rule (1.1) checking. */\

  {__asm(ANDCC #0x7F); __asm(STOP); } \

 

6.

   Then at IGNITION ON sense we wake up from sleep by external interrupt and the entry function _EntryPoint(); is called.

    Again the same steps given above are followed.

 

PROBLEM DEFINATION: -

In an field vehicle after 15000 Kms in endurance test cluster hang issue was reported. When we hotsink the device on vehicle in hang condition it is freely moving in main loop, but the API stopped working, the interrupt was not at all generated. The API related register contents at that time were as below

CPMUAPICTL  = 0x87

CPMUAPIR      = 0x0594

CPMUACLKTR = 0xFC

 

So in main loop all functions operated using this periodic interrupt stopped working and other function which are not depended on this interrupt are working fine. The IGNITION sense activity is also depended on this interrupt so now the controller is not able to go in sleep mode and thus wake up is also not called, so that it would reinitialize the system by calling ENTRY_POINT. There is no way to come out as watchdog is also cleared in main loop and its working fine.

 

I think the above description will give you the clear Idea about the issue, please try to tell me the reason why this API stopped giving interrupt.

 

Feel free to ask for further clarification if required.

 

Thank you for your kind support !

Outcomes