Hi,
I want to put the S12XEQ to sleep and wake when either when the CAN bus is energised or a CAN message is received. Before I put the micro to sleep I put the CAN tranceiver into SLEEP (High on STB pin of TJA1042).
I have asked a similar question before but have never gotten this to work. The micro would goto sleep happily, current on supply would reduce, but would never wake. I expect either CAN0 or CAN1 to wake the micro
My code looks like this when I want to start sleep.
CAN_Shutdown_OFF(); // Pull TJA1042 Stanby High = 5V = Standby
CAN0CTL0 |= WUPE; // Enable Wake Up
CAN1CTL0 |= WUPE; // WUPE allows restart from Sleep
CAN0RIER |= WUPIE; // Enable Wake Up Interrupt Enable
CAN1RIER |= WUPIE;
CAN0CTL0 |= SLPRQ; // Request sleep mode, clock continues to run
CAN1CTL0 |= SLPRQ; // Request sleep mode
while ((CAN0CTL1 & SLPAK) == 0) ; // Wait for SLPAK to == 1 Correct !
while ((CAN1CTL1 & SLPAK) == 0) ; // Wait for SLPAK to == 1
_asm ("ANDCC #$7f"); // Clear S bit. If not S is Set then STOP is disabled and it does a 2 cycle NOP
_asm ("NOP");
_asm ("STOP"); // Enter STOP mode Correct !
// Processor will now SLEEP here
_asm ("ORCC #$80"); // Set STOP bit
// And wakeup here...
CAN_Shutdown_ON(); // Pull TJA1042 Stanby low = 0V = working
I also have some code in "CAN Wake ISR", but it is much the same as above.
Can you see what I am missing?
Regards,
Wade
Hi,
I do not want to repeat what was already written so I will use links.
There are a few questions and answers related to your issue. Plus there is an S12XE CAN wake up example in the answer in the item 1)
Also it is good to go through entire CAN setup. You can compare it with 2)
1) Contains S12XE CAN wake up example in the answer
Do not be surprised the question is related to S12G because modules and principles are the same.
2)
Best regards,
Ladislav