LPC1765 Wakeup on CAN in deep sleep not working

cancel
Showing results for 
Search instead for 
Did you mean: 

LPC1765 Wakeup on CAN in deep sleep not working

252 Views
sanjabehera
Contributor I

Hello,

We are trying to wakeup the LPC1765 controller using CAN activity. We have followed application note to wakeup on CAN http://www.strong-ic.com/upload/1336635046_461.pdf 

We are using MCU expresso IDE for our development. As per our observation the device wakes up upon gpio interrupt but does not wakeup on CAN if any CAN packet is sent using PCAN analyzer on the bus. We are able to receive data on CAN RX pin verified using oscilloscope. Still the controller does not wakeup ? Can you please help us if we are missing anything?  As per datasheet, the device should wakeup on CAN activity.

Below is the sample code that we are using to wakeup on CAN. We are using both CAN 1 and CAN2. 

Code running in main.c :-

/* Enable the receive interrupt*/
 Chip_CAN_EnableInt(LPC_CAN, CAN_IER_RIE | CAN_IER_WUIE);

LPC_CAN1->MOD |= (1 << 4);   //SM bit is set
LPC_CAN2->MOD |= (1 << 4);   //SM bit is set
Chip_PMU_DeepSleepState(LPC_PMU);


ISR routine :-

void CANActivity_IRQHandler(void)
{

 ToggleGSMLed();

 LPC_SYSCTL->CANSLEEPCLR = ( 1 << 1 ) | (1 << 2);

 LPC_CAN1->MOD &= -(1 << 4);
 LPC_CAN2->MOD &= -(1 << 4);
 LPC_SYSCTL->CANWAKEFLAGS = ( 1 << 1 ) | (1 << 2);
 //printf("CAN wakeup\r\n");

 return;
}

Can you please find a solution and let us know the actual issue of wakeup? Waiting for your reply.

Thanks,

Sanja Sameer

0 Kudos
2 Replies

141 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi sanja behera,

Thank you for your interest in NXP Semiconductor products and 
the opportunity to serve you.

I was wondering if you can share a compile-able demo, as I'd like to replicate this phenomenon on my site.

I'm looking forward to your reply.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

141 Views
sanjabehera
Contributor I

Thanks for your response.

The problem was resolved as i have not enable CANActivity_IRQHandler at time of initialization.

Here is pseudo code

can1_vInit();

can2_vInit();

Chip_CAN_EnableInt(LPC_CAN1, CAN_IER_RIE | CAN_IER_WUIE);

Chip_CAN_EnableInt(LPC_CAN2, CAN_IER_RIE | CAN_IER_WUIE);

NVIC_EnableIRQ(CAN_IRQn);
NVIC_EnableIRQ(CANActivity_IRQn);

void CAN_IRQHandler(void)

{

   //My ISR routine

}

void CANActivity_IRQHandler(void)
{

 

 LPC_SYSCTL->CANSLEEPCLR = ( 1 << 1 ) | (1 << 2);

 LPC_CAN1->MOD &= -(1 << 4);
 LPC_CAN2->MOD &= -(1 << 4);
 LPC_SYSCTL->CANWAKEFLAGS = ( 1 << 1 ) | (1 << 2);

 return;
}

0 Kudos