Add logic to sleep in lpc17xx idle loop
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3329 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
50704d884c
commit
a50a529a63
@ -250,6 +250,7 @@ LEDs
|
||||
#define LED_SIGNAL 5 /* NC NC ON (momentary) */
|
||||
#define LED_ASSERTION 6 /* NC NC ON (momentary) */
|
||||
#define LED_PANIC 7 /* NC NC ON (0.5Hz flashing) */
|
||||
#undef LED_IDLE /* Sleep mode indication not supported */
|
||||
|
||||
After the system is booted, this logic will no longer use LEDs 1 and 2. They
|
||||
are then available for use the application software using lpc17_led1() and
|
||||
|
@ -329,6 +329,9 @@ LEDs
|
||||
if you see this at all, it probably means that the system is hanging up
|
||||
somewhere in the initialization phases.
|
||||
- ON means that the OS completed initialization.
|
||||
- Glowing means that the LPC17 is running in a reduced power mode: LED1 is
|
||||
turned off when the processor enters sleep mode and back on when it wakesup
|
||||
up.
|
||||
|
||||
LED2:
|
||||
- ON/OFF toggles means that various events are happening.
|
||||
@ -341,25 +344,32 @@ LEDs
|
||||
NOTE: LED2 is controlled by a jumper labeled: ACC_IRQ/LED2. That jump must be
|
||||
in the LED2 position in order to support LED2.
|
||||
|
||||
LED1 LED2 Meaning
|
||||
----- -------- --------------------------------------------------------------------
|
||||
OFF OFF Still initializing and there is no interrupt activity.
|
||||
Initialization is very fast so if you see this, it probably means
|
||||
that the system is hung up somewhere in the initialization phases.
|
||||
OFF Glowing Still initializing (see above) but taking interrupts.
|
||||
OFF ON This would mean that (1) initialization did not complete but the
|
||||
software is hung, perhaps in an infinite loop, somewhere inside
|
||||
of an interrupt handler.
|
||||
OFF Flashing Ooops! We crashed before finishing initialization.
|
||||
LED1 LED2 Meaning
|
||||
------- -------- --------------------------------------------------------------------
|
||||
OFF OFF Still initializing and there is no interrupt activity.
|
||||
Initialization is very fast so if you see this, it probably means
|
||||
that the system is hung up somewhere in the initialization phases.
|
||||
OFF Glowing Still initializing (see above) but taking interrupts.
|
||||
OFF ON This would mean that (1) initialization did not complete but the
|
||||
software is hung, perhaps in an infinite loop, somewhere inside
|
||||
of an interrupt handler.
|
||||
OFF Flashing Ooops! We crashed before finishing initialization (or, perhaps
|
||||
after initialization, during an interrupt while the LPC17xx was
|
||||
sleeping -- see below).
|
||||
|
||||
ON OFF The system has completed initialization, but is apparently not taking
|
||||
any interrupts.
|
||||
ON Glowing This is the normal healthy state: The OS successfully initialized
|
||||
and is taking interrupts.
|
||||
ON ON This would mean that (1) the OS complete initialization, but (2)
|
||||
the software is hung, perhaps in an infinite loop, somewhere inside
|
||||
of a signal or interrupt handler.
|
||||
ON Flashing Ooops! We crashed sometime after initialization.
|
||||
ON OFF The system has completed initialization, but is apparently not taking
|
||||
any interrupts.
|
||||
ON Glowing The OS successfully initialized and is taking interrupts (but, for
|
||||
some reason, is never entering a reduced power mode -- perhaps the
|
||||
CPU is very busy?).
|
||||
ON ON This would mean that (1) the OS complete initialization, but (2)
|
||||
the software is hung, perhaps in an infinite loop, somewhere inside
|
||||
of a signal or interrupt handler.
|
||||
Glowing Glowing This is also a normal healthy state: The OS successfully initialized,
|
||||
is running in reduced power mode, but taking interrupts. The glow
|
||||
is very faint and you may have to dim the lights to see that LEDs are
|
||||
active at all!
|
||||
ON Flashing Ooops! We crashed sometime after initialization.
|
||||
|
||||
Using OpenOCD and GDB with an FT2232 JTAG emulator
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -136,11 +136,12 @@
|
||||
#define LED_HEAPALLOCATE 0 /* OFF OFF = Still initializing */
|
||||
#define LED_IRQSENABLED 0 /* OFF OFF = Still initializing */
|
||||
#define LED_STACKCREATED 1 /* ON OFF = Initialization complete */
|
||||
#define LED_INIRQ 2 /* NC ON = In an interrupt handler */
|
||||
#define LED_SIGNAL 2 /* NC ON = In a signal handler */
|
||||
#define LED_ASSERTION 2 /* NC ON = In an assertion */
|
||||
#define LED_PANIC 2 /* NC ON = Oops! We crashed. (flashing) */
|
||||
|
||||
#define LED_INIRQ 2 /* N/C ON = In an interrupt handler */
|
||||
#define LED_SIGNAL 2 /* N/C ON = In a signal handler (glowing) */
|
||||
#define LED_ASSERTION 2 /* N/C ON = In an assertion */
|
||||
#define LED_PANIC 2 /* N/C ON = Oops! We crashed. (flashing) */
|
||||
#define LED_IDLE 3 /* OFF N/C = LPC17 in sleep mode (LED1 glowing) */
|
||||
|
||||
/* Alternate pin selections *********************************************************/
|
||||
|
||||
/* CAN1 GPIO PIN SIGNAL NAME
|
||||
|
@ -2,7 +2,7 @@
|
||||
* configs/olimex-lpc1766stk/src/up_leds.c
|
||||
* arch/arm/src/board/up_leds.c
|
||||
*
|
||||
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -92,6 +92,8 @@
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static bool g_uninitialized = true;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
@ -132,11 +134,16 @@ void up_ledon(int led)
|
||||
case 1 : /* STACKCREATED */
|
||||
lpc17_gpiowrite(LPC1766STK_LED1, false);
|
||||
lpc17_gpiowrite(LPC1766STK_LED2, true);
|
||||
g_uninitialized = false;
|
||||
break;
|
||||
|
||||
case 2 : /* INIRQ, SIGNAL, ASSERTION, PANIC */
|
||||
lpc17_gpiowrite(LPC1766STK_LED2, false);
|
||||
break;
|
||||
|
||||
case 3 : /* IDLE */
|
||||
lpc17_gpiowrite(LPC1766STK_LED1, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,9 +159,14 @@ void up_ledoff(int led)
|
||||
case 0 : /* STARTED, HEAPALLOCATE, IRQSENABLED */
|
||||
case 1 : /* STACKCREATED */
|
||||
lpc17_gpiowrite(LPC1766STK_LED1, true);
|
||||
|
||||
case 2 : /* INIRQ, SIGNAL, ASSERTION, PANIC */
|
||||
lpc17_gpiowrite(LPC1766STK_LED2, true);
|
||||
break;
|
||||
|
||||
case 3 : /* IDLE */
|
||||
lpc17_gpiowrite(LPC1766STK_LED1, g_uninitialized);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
||||
|
@ -228,6 +228,7 @@ They are encoded as follows:
|
||||
LED_SIGNAL In a signal handler*** N/C ON N/C OFF
|
||||
LED_ASSERTION An assertion failed ON ON N/C OFF
|
||||
LED_PANIC The system has crashed N/C N/C N/C ON
|
||||
LED_IDLE STM32 is is sleep mode (Optional, not used)
|
||||
|
||||
* If LED1, LED2, LED3 are statically on, then NuttX probably failed to boot
|
||||
and these LEDs will give you some indication of where the failure was
|
||||
|
Loading…
Reference in New Issue
Block a user