9 years, 9 months ago.

How to wakeup mbed lpc1768 using CAN?

Hi, I can´t wake my mbed (lpc1768) using CAN WuIrq. I need to use any power save mode (if possible power down) and wake when a can message is received.

I can wake the mbed from sleep using interrupt on a GPIO. From power-down wakes the mbed only on WDT interrupt (using wakeup library)

I also tried to disconnect the mbed interface without success

Can you see any mistake I make?

Thanks!

Here is my code:

#include "mbed.h"
#include "PowerControl.h"
#include "EthernetPowerControl.h"

void can1_wakeup(void)
{
 SystemInit();   
}
void can2_wakeup(void)
{
 SystemInit();  
}

static void wakeUpHandler(void)
{
 SystemInit();
}

int main(void){

    CAN can1(p9, p10);
    CAN can2(p30, p29);

    can1.frequency(500000);
    can2.frequency(500000);
    
    can1.attach(&can1_wakeup,CAN::WuIrq);
    can2.attach(&can2_wakeup,CAN::WuIrq);
    
    InterruptIn wakeup(p26);
    wakeup.rise(&wakeUpHandler);  // Setup rising edge interrupt
    
    wait(10);

    PHY_PowerDown();
    //mbed_interface_powerdown();
    sleep();
    
    while (1)
    {
     }
}
Be the first to answer this question.