fupeng

mc9s12 CAN wake up fail

Discussion created by fupeng on Aug 9, 2017
Latest reply on Aug 15, 2017 by Daniel Martynek
Hi,
    I am using MC9S12xet256 micrcontroller,I use the Processor Expert to create the code.In stop mode, Normally I can wake up it by CAN,but when the AD module added,I can not wake up by CAN.
   Execute the code as follows:
  main.c
for(;;)
{
   AD1_Measure(TRUE);  /*It is possible to delete these two lines*/
   AD1_GetValue16(&advalue);
   if(EnterStopFlag)
   {
      EnterStopFlag = 0;
      /*turn off led*/
      CAN1_SetSleepRequest();
      Cpu_SetStopMode();
      /*turn on led*/
   }
}
   event.c
void CAN1_OnFullRxBuffer(void)
{
   ...
   ...
   if(MessageID == 0x101)
   {
      EnterStopFlag= 1;
   }
   else
   {
      EnterStopFlag= 0;
   }
}
void CAN1_OnWakeup(void)
{
   /* Write your code here ... */
   CAN1_ClearSleepRequest();
}
Can anybody please help me reolve this issue?
 
Regards,
Felix

Outcomes