LPC1769 + Ethernet (uIP) + DEEPSLEEP

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1769 + Ethernet (uIP) + DEEPSLEEP

635 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mhespenh on Wed Nov 09 10:01:47 MST 2011
Hi folks,

I'm new to the ARM world (but an old hat from the 8-bit PIC world) and I'm working on an ethernet-enabled sensor device.

I've goten uIP working just dandy and can open a TCP socket from my pc to fetch ADC values- no problem :D.  Now I'm trying to lower the power consumption- I only want to talk to this guy every few minutes, so I'd like to be able to put it into DEEPSLEEP (or POWERDOWN) mode and have it awaken on LAN traffic (WoL).  So far I can get it into SLEEP mode (which puts me at around 130mA compared to 160mA full blast) and it will work just fine, however when I put it into DEEPSLEEP it doesn't wake up when I ping it from my computer.

I've looked through the Low Power Modes app note (AN10915, I believe) and have kanged most of my sleep code from it- but I am guessing the ethernet is not set to generate the necessary WoL interrupt by default.  I have several timers running (periodic, arp, adc) and my best guess is THOSE are waking me from sleep NOT the ethernet, so when I move to DEEPSLEEP (where timers can't wake me) I don't get woken. I also suspect I may not be handling the clocking correctly (maybe the emac isn't getting a clock at all?!)- but like I said, I'm new to the ARM world :confused:

Here is my "go to sleep" function code:
/*Set SLEEPDEEP bit in the Cortex M3 System Control Register*/ 
SCB->SCR |= (1 << 2);
   
//set sleep mode to DEEP POWERDOWN (SLEEPDEEP=1 in SCR)
LPC_SC->PCON = 0x3;

__WFI();

//when we wake up, return clocks to proper settings
SystemCoreClockUpdate();
clock_init();


From "lpc17xx_emac.c" I see the following:
LPC_EMAC->IntEnable = INT_RX_DONE | INT_TX_DONE;

I tried ORing in INT_WAKEUP as well, but that didn't help.

So at this point I'm a bit lost- anyone successfully gotten into DEEPSLEEP or POWERDOWN modes and successfully woken using just ethernet traffic? :confused:

***EDIT***
Okay, after a little more investigation I've concluded that the ethernet IS generating interrupts properly- I turned all my timers (the uIP periodic and ARP) to 10 seconds and tell it to sleep after every main loop I still get communication, so it is waking from sleep correctly on ethernet activity.  But if I change it to DEEPSLEEP and/or disconnect the PLL it fails to respond to pings/traffic (although the activity lights do blink).  So I think I'm not clocking the EMAC properly...?  Maybe? :confused:

***EDIT2***
Okay, I realized it might be helpful if the EMAC was enabled in the NVIC, so I added
NVIC_EnableIRQ(ENET_IRQn);[/code] to the init function in main, but that just causes the entire thing to hang.

**EDIT3***
Minor code revisions

Thanks for any tips/pointers,
-Michael
0 Kudos
Reply
1 Reply

559 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mhespenh on Fri Nov 18 08:52:50 MST 2011
*bump*

And more info- I'm also getting some outrageous current draws in POWERDOWN and DEEP POWERDOWN modes- I can't seem to do better than ~95mA :eek:  Even when I set PCONP = 0x0 (which I recognize will kill emac entirely).  So clearly I am missing something :confused:

-Michael
0 Kudos
Reply