MC9S12ZVHY32 Autonomous Periodical Interrupt stopped working in run mode

Showing results for 
Show  only  | Search instead for 
Did you mean: 

MC9S12ZVHY32 Autonomous Periodical Interrupt stopped working in run mode

Contributor I


            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



  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


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


#define Timer_Api_Disable() ( \

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

  ERR_OK                               /* Return result */ \



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); } \



   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.



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


CPMUAPIR      = 0x0594



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 !

Labels (1)
1 Reply

NXP Employee
NXP Employee


The API initialization is correct. All steps 1-6 are also correct.

There are no API errata on this device.

If such behavior happens only on one device occasionally, it could be due to the environment where it is used (a lot of EMI, humidity etc).

Or it is just a faulty device :-(



0 Kudos