Wake up recovery from stop mode in MC9S12XS128(HCS12XS) microcontroller

cancel
Showing results for 
Search instead for 
Did you mean: 

Wake up recovery from stop mode in MC9S12XS128(HCS12XS) microcontroller

871 Views
sirishmadhusudh
Contributor I

Hi,

I am using MC9S12XS128 micrcontroller for automotive ECU, configured the processor to go to stop mode for low power consumption.

I have enabled the WUPE and WUPIE bits so that the controller wakes up from stop on arrival of CAN message.

I tried enabling them at initialization and also before going to sleep. In both cases it did not recover.
When I run the code, the ECU works well and goes to stop mode as expected, but is unable to recover when CAN message is received and ECU does not respond at all. Also all other Interrupts get disabled.

I tried using the Pseudo stop mode (enabled PSTP bit in CLKSEL) to see if that helps, but that too did not work.

I have used the following procedure to go to Stop mode:

CAN0CTL0_WUPE = 1;

CAN0RIER_WUPIE = 1;

__asm ANDCC #0x7F;

__asm stop;

 

Can anybody please help me reolve this issue?

 

Regards,
Sirish

 

Labels (1)
0 Kudos
5 Replies

119 Views
RadekS
NXP Employee
NXP Employee

WUPE bit allows the MSCAN to restart from sleep mode or from power down mode (entered from sleep) when traffic on CAN is detected. So we have to switch CAN module into sleep mode prior we use MCU stop mode.

For Example:

CAN0CTL0_SLPRQ = 1; //sleep mode request

while(CAN0CTL1_SLPAK == 0); //wait for acknowledge of sleep mode

asm ANDCC #0x7F;  //clear S bit

asm nop;

asm STOP;         //STOP mode

Example of interrupt routine:

#pragma CODE_SEG NON_BANKED

interrupt 36 void CAN0_WAKE(void)

{

}

#pragma CODE_SEG DEFAULT


119 Views
sirishmadhusudh
Contributor I

Hi,

I tried above solution but still we are facing the same problem. I'm sending the CAN messages after ECU goes to stop mode but its giving Tx Error in CANOe.

The CAN msg is not generating the interrupt (CanWakeUpInterrupt_0 [i.e isr addr: 0xFFB6     ivVcan0wkup)]. i verified this by setting a breakpoint in that isr and also removed d debugger n checked by making a GPIO pin high. in both cases the isr was not executed. To check if the ECU has gone to stop mode or not, i checked the current consumption. The current consumption drastically falls to few micro Amps when stop instruction gets executed. The only problem now is recovering...

do u think any additional setting has to be made?

Could you please help me.

Regards,

Sirish

0 Kudos

119 Views
RadekS
NXP Employee
NXP Employee

Maybe too simple question: Did you clear I bit?

For example by command EnableInterrupts;

Problem could be caused for example by STOP instruction in interrupt routine (where I bit=1).

Are you sure that CAN message can go through CAN transceiver?

BDM is not active in stop mode, breakpoints will not work.

Testing stop mode by GPIO or current consumption is OK.

Another option is ECLK(PE4) output pin. In special mode you can test/measure directly bus clock. In normal mode after command ECLKCTL_NECLK=0;

0 Kudos

119 Views
sirishmadhusudh
Contributor I

We are using vector generated code for CAN driver. To
verify wheter the Wake up interrupt is getting invoked, we put the MSCAN and
the transceiver to sleep but did not put the controller to stop. When a CAN
message was sent, the MSCAN and transceiver returned to normal mode and the
wake up ISR was hit. The same test was conducted after adding the __asm ANDCC
#0x7F; and  __asm stop instructions. In
this case the controller goes to stop mode (which we can verify from the
drastic drop in the power consumption), but when a CAN message is sent, the
controller simply doesn't wake up. To ensure that the wake up interrupt has the
highest priority, we tried to change the priority level of wake up interrupt to
level 7. We were not able to set the priority for the wake up interrupt (with
INT_CFADDR = 0xB0 and INT_CFDATA6 = 0x07 as the address of the wake up ISR is
0x7FB6). When we checked the address location of INT_CFDATA6, it was not
getting updated to 07 but was stuck at 00. Any manual attempt to overwrite the
value in that location also failed.

We tried putting the controller in pseudo stop mode by setting the PSTP bit in CLKSEL register, but that too did not work.

And Yes i cleared the I - bit.

0 Kudos

119 Views
xd_pang
Contributor II

I met the same problem with yours.

How did you solve the problem in the end?
Could you tell me?

sirishmadhusudhan 撰写:

To verify wheter the Wake up interrupt is getting invoked, we put the MSCAN and the transceiver to sleep but did not put the controller to stop.

When a CAN message was sent, the MSCAN and transceiver returned to normal mode and the wake up ISR was hit.

The same test was conducted after adding the
__asm ANDCC #0x7F;
and
__asm stop
instructions.
In this case the controller goes to stop mode (which we can verify from the drastic drop in the power consumption), but when a CAN message is sent, the controller simply doesn't wake up.

sirishmadhusudhan 撰写:

We tried putting the controller in pseudo stop mode by setting the PSTP bit in CLKSEL register, but that too did not work.

0 Kudos