diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 62984f349..617bb390d 100755 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -152,3 +152,6 @@ driver in loopback mode. 6.14 2012-xx-xx Gregory Nutt + + * apps/examples/buttons/main.c: The test needs to up_buttoninit() to + properly configure the button interrupt GPIOs. diff --git a/apps/examples/buttons/main.c b/apps/examples/buttons/main.c index b0d06e48a..fe447ca6b 100644 --- a/apps/examples/buttons/main.c +++ b/apps/examples/buttons/main.c @@ -2,7 +2,7 @@ * examples/buttons/main.c * * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -422,6 +422,10 @@ int MAIN_NAME(int argc, char *argv[]) lib_lowprintf("maxbuttons: %d\n", maxbuttons); #endif + /* Initialize the button GPIOs */ + + up_buttoninit(); + /* Register to recieve button interrupts */ #ifdef CONFIG_ARCH_IRQBUTTONS diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 6e016fc61..1acdfdadf 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -2320,3 +2320,5 @@ for NuttX. At present, this is just a stub and it refers to the NuttX top-level README.txt file which is the only, real "Getting Started" Guide that exists for the time being. + * arch/arm/src/lpc17xx/lpc17_gpioint.c: Correct an value used as the lower + end of an IRQ number range test. diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c b/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c index 8a894d31c..9dd594c31 100755 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c @@ -2,7 +2,7 @@ * arch/arm/src/lpc17xx/lpc17_gpio.c * * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -278,7 +278,8 @@ static int lpc17_pullup(uint16_t cfgset, unsigned int port, unsigned int pin) ****************************************************************************/ #ifdef CONFIG_GPIO_IRQ -static void lpc17_setintedge(unsigned int port, unsigned int pin, unsigned int value) +static void lpc17_setintedge(unsigned int port, unsigned int pin, + unsigned int value) { uint64_t *intedge; unsigned int shift; @@ -415,7 +416,9 @@ static inline int lpc17_configinput(uint16_t cfgset, unsigned int port, unsigned * Configure a GPIO interrupt pin based on bit-encoded description of the pin. * ****************************************************************************/ -static inline int lpc17_configinterrupt(uint16_t cfgset, unsigned int port, unsigned int pin) + +static inline int lpc17_configinterrupt(uint16_t cfgset, unsigned int port, + unsigned int pin) { /* First, configure the port as a generic input so that we have a known * starting point and consistent behavior during the re-configuration. @@ -439,7 +442,9 @@ static inline int lpc17_configinterrupt(uint16_t cfgset, unsigned int port, unsi * Configure a GPIO output pin based on bit-encoded description of the pin. * ****************************************************************************/ -static inline int lpc17_configoutput(uint16_t cfgset, unsigned int port, unsigned int pin) + +static inline int lpc17_configoutput(uint16_t cfgset, unsigned int port, + unsigned int pin) { uint32_t fiobase; uint32_t regval; @@ -486,7 +491,9 @@ static inline int lpc17_configoutput(uint16_t cfgset, unsigned int port, unsigne * of the pin. * ****************************************************************************/ -static int lpc17_configalternate(uint16_t cfgset, unsigned int port, unsigned int pin, uint32_t alt) + +static int lpc17_configalternate(uint16_t cfgset, unsigned int port, + unsigned int pin, uint32_t alt) { /* First, configure the port as an input so that we have a known * starting point and consistent behavior during the re-configuration. diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpiodbg.c b/nuttx/arch/arm/src/lpc17xx/lpc17_gpiodbg.c index 6fe777de1..dc4dac33a 100755 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpiodbg.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpiodbg.c @@ -1,8 +1,8 @@ /**************************************************************************** * arch/arm/src/lpc17xx/lpc17_gpiodbg.c * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -49,12 +49,16 @@ #include "lpc17_gpio.h" #include "lpc17_internal.h" -#ifdef CONFIG_DEBUG_GPIO - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +#ifndef CONFIG_DEBUG +# undef CONFIG_DEBUG_GPIO +#endif + +#ifdef CONFIG_DEBUG_GPIO + /**************************************************************************** * Private Types ****************************************************************************/ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c b/nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c index cdc0e27b5..66988b0b9 100755 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c @@ -2,7 +2,7 @@ * arch/arm/src/lpc17xx/lpc17_gpioint.c * * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -172,7 +172,7 @@ static int lpc17_irq2port(int irq) /* Set 3: 14 interrupts p2.0-p2.13 */ - else if (irq >= LPC17_VALID_NIRQS2 && irq < (LPC17_VALID_FIRST2+LPC17_VALID_NIRQS2)) + else if (irq >= LPC17_VALID_FIRST2 && irq < (LPC17_VALID_FIRST2+LPC17_VALID_NIRQS2)) { return 2; } diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c index 577ec6747..1588142a2 100755 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c @@ -3,7 +3,7 @@ * arch/arm/src/chip/lpc17_irq.c * * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -374,7 +374,7 @@ void up_disable_irq(int irq) putreg32(regval, regaddr); } #ifdef CONFIG_GPIO_IRQ - else + else if (irq >= LPC17_VALID_FIRST0L) { /* Maybe it is a (derived) GPIO IRQ */ @@ -407,7 +407,7 @@ void up_enable_irq(int irq) putreg32(regval, regaddr); } #ifdef CONFIG_GPIO_IRQ - else + else if (irq >= LPC17_VALID_FIRST0L) { /* Maybe it is a (derived) GPIO IRQ */ diff --git a/nuttx/configs/olimex-lpc1766stk/README.txt b/nuttx/configs/olimex-lpc1766stk/README.txt index 36c2e2387..cb5fa168f 100755 --- a/nuttx/configs/olimex-lpc1766stk/README.txt +++ b/nuttx/configs/olimex-lpc1766stk/README.txt @@ -534,20 +534,26 @@ Using OpenOCD and GDB with an FT2232 JTAG emulator Once the OpenOCD daemon has been started, you can connect to it via GDB using the following GDB command: - arm-elf-gdb - (gdb) target remote localhost:3333 + arm-elf-gdb + (gdb) target remote localhost:3333 NOTE: The name of your GDB program may differ. For example, with the CodeSourcery toolchain, the ARM GDB would be called arm-none-eabi-gdb. After starting GDB, you can load the NuttX ELF file: - (gdb) symbol-file nuttx - (gdb) load nuttx + (gdb) symbol-file nuttx + (gdb) load nuttx - Loading the symbol-file is only useful if you have built NuttX to - inclulde debug symbols (by setting CONFIG_DEBUG_SYMBOLS=y in the - .config file). + NOTES: + 1. Loading the symbol-file is only useful if you have built NuttX to + inclulde debug symbols (by setting CONFIG_DEBUG_SYMBOLS=y in the + .config file). + 2. I usually have to reset, halt, and 'load nuttx' a second time. For + some reason, the first time apparently does not fully program the + FLASH. + 3. The MCU must be halted prior to loading code using 'mon reset' + as described below. OpenOCD will support several special 'monitor' commands. These GDB commands will send comments to the OpenOCD monitor. Here @@ -556,9 +562,10 @@ Using OpenOCD and GDB with an FT2232 JTAG emulator (gdb) monitor reset (gdb) monitor halt - The MCU must be halted prior to loading code. Reset will restart - the processor after loading code. The 'monitor' command can be - abbreviated as just 'mon'. + NOTES: + 1. The MCU must be halted using 'mon halt' prior to loading code. + 2. Reset will restart the processor after loading code. + 3. The 'monitor' command can be abbreviated as just 'mon'. Olimex LPC1766-STK Configuration Options ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -827,6 +834,12 @@ Where is one of the following: Support for the board's SPI-based MicroSD card is included (but not passing tests as of this writing). + NOTE: If you start the program with no SD card inserted, there will be + a substantial delay. This is because there is no hardware support to sense + whether or not an SD card is inserted. As a result, the driver has to + go through many retries and timeouts before it finally decides that there + is not SD card in the slot. + nx: And example using the NuttX graphics system (NX). This example uses the Nokia 6100 LCD driver. diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_buttons.c b/nuttx/configs/olimex-lpc1766stk/src/up_buttons.c index a6b73b284..bcafc7337 100644 --- a/nuttx/configs/olimex-lpc1766stk/src/up_buttons.c +++ b/nuttx/configs/olimex-lpc1766stk/src/up_buttons.c @@ -111,7 +111,7 @@ void up_buttoninit(void) { int i; - /* Configure the GPIO pins as inputs. */ + /* Configure the GPIO pins as interrupting inputs. */ for (i = 0; i < BOARD_NUM_BUTTONS; i++) {