EmbDev.net

Forum: µC & Digital Electronics LPC1768 does not wakeup from deepsleep


von Sven (Guest)


Attached files:

Rate this post
useful
not useful
Hey,
I am useing some examples from Keil and I am working with the LPC1768.

I am trying to put the controller into deepsleep or power down ect. pp.
My problem is, that the controller does not wake up from deep sleep and 
power down mode.
In the Attachment you can find my Code, it would be great if you can 
help me.

thanks =)

: Moved by Admin
von Sven (Guest)


Rate this post
useful
not useful
so here in an easier way, but the problem is the same the µC does not 
wakeup from deepsleep, powerdown or deep power down.
1
#include "lpc17xx.h"
2
#include "type.h"
3
#include "extint.h"
4
5
6
void main(void)
7
{
8
/***********PINs einstellen**********/
9
10
/*************LEDs******************/
11
12
  LPC_GPIO2 -> FIODIR |= 0xFF;    // P2[0..7] Ausgänge
13
  LPC_GPIO2 -> FIOCLR |= 0xFF;    // alle Pins ausschalten
14
15
/************Taster****************/
16
17
  LPC_GPIO3 -> FIODIR &= (1<<25);   // P3[25] Eingang
18
19
/************Interrupt*************/
20
21
LPC_PINCON->PINSEL4 &= ~(0x03<<20);   // Reset des Pins
22
LPC_PINCON->PINSEL4 |=  (0x01<<20);  // Config P2.10 = EINT0
23
LPC_GPIOINT->IO2IntEnF = 0x200;    // Port2.10 is falling edge. 
24
LPC_SC->EXTMODE = EINT0_EDGE;    // INT0 edge trigger 
25
LPC_SC->EXTPOLAR = 0;      // INT0 is falling edge by default
26
NVIC_EnableIRQ(EINT0_IRQn);       // Enable IRQ for EINT0
27
28
  while(1)
29
  {
30
    if (!(LPC_GPIO3 -> FIOPIN & (1<<25)))
31
    {
32
      LPC_GPIO2 -> FIOPIN = 0xFF;
33
      SCB -> SCR = 0x04;
34
      __WFI();
35
    }
36
37
  }
38
39
}
40
41
void EINT0_IRQHandler (void)
42
{
43
  LPC_SC->EXTINT = EINT0;  //clear interrupt 
44
  LPC_GPIO2 -> FIOCLR = 0xFF;
45
}

von Sven (Guest)


Rate this post
useful
not useful
nobody?

von Lutz (Guest)


Rate this post
useful
not useful
>LPC_GPIO3 -> FIODIR &= (1<<25);   // P3[25] Eingang
Reset value of this register is 0x0. Your code doesn't change anything 
in this case, but take care if the value of FIODIR differs from 0x0. 
You've probably forgotten the '~'.

>LPC_PINCON->PINSEL4 &= ~(0x03<<20);   // Reset des Pins
Unneccessary, because the reset value of PINSEL4[21:20] is 00. And this 
value is also overwritten with
>LPC_PINCON->PINSEL4 |=  (0x01<<20);  // Config P2.10 = EINT0
but that's not a problem; you can make it sure or obvious by this way.

>LPC_GPIOINT->IO2IntEnF = 0x200;    // Port2.10 is falling edge.
0x200 codes a falling edge interrupt enable for P2.9, not for P2.10. 
Take care of the bitposition when bitshifting or when making an absolut 
assignment. This seems to be the problem and my "analysis" stops at this 
line of code.

von Lutz (Guest)


Rate this post
useful
not useful
P.S.: When you change your language to German your name is Jannik? 
Strange ...

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.