[rtems commit] lpc24xx/lpc17xx: lpc24xx_pin_set_function() keep LPC4088 W type pin in digital mode for non-analog function.

Sebastian Huber sebh at rtems.org
Wed Aug 20 11:34:17 UTC 2014


Module:    rtems
Branch:    master
Commit:    0a66c1266f1f0968345b2a0bcb7acbeeba0c1d82
Changeset: http://git.rtems.org/rtems/commit/?id=0a66c1266f1f0968345b2a0bcb7acbeeba0c1d82

Author:    Pavel Pisa <ppisa at pikron.com>
Date:      Sat Aug 16 16:15:17 2014 +0200

lpc24xx/lpc17xx: lpc24xx_pin_set_function() keep LPC4088 W type pin in digital mode for non-analog function.

The problem wit incorrect switching of pins into analog mode manifestes
on LPC4088 based board.

LPC4088 implements pin P1.17 (ENET_MDIO) as new W type (digital pin
with analog option). The pin was listed as D category on LPC1788
which does not have analog mode control bit. If analog option is
not explicitly switched off on LPC4088 then the pin does not work
as digital pin.

Code tested on LPC1788 and no problems has been observed even that
manual specifies the IOCON_ADMODE field as reserved and should
be written as zero. But even RTEMS lpc24xx_gpio_config sets this
bit unconditionally.

Signed-off-by: Pavel Pisa <ppisa at pikron.com>

---

 c/src/lib/libbsp/arm/lpc24xx/misc/io.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/c/src/lib/libbsp/arm/lpc24xx/misc/io.c b/c/src/lib/libbsp/arm/lpc24xx/misc/io.c
index 45e0c94..c28b518 100644
--- a/c/src/lib/libbsp/arm/lpc24xx/misc/io.c
+++ b/c/src/lib/libbsp/arm/lpc24xx/misc/io.c
@@ -395,9 +395,14 @@ lpc24xx_pin_set_function(
     rtems_interrupt_enable(level);
   #else
     uint32_t iocon_extra = 0;
+    uint32_t iocon_not_analog = IOCON_ADMODE;
 
     /* TODO */
     switch (pin_range.fields.type) {
+      case LPC17XX_PIN_TYPE_ADC:
+      case LPC17XX_PIN_TYPE_DAC:
+        iocon_not_analog = 0;
+        break;
       case LPC17XX_PIN_TYPE_I2C_FAST_PLUS:
         iocon_extra |= IOCON_HS;
         break;
@@ -408,7 +413,7 @@ lpc24xx_pin_set_function(
         break;
     }
 
-    *iocon = IOCON_FUNC(pin_range.fields.function) | iocon_extra;
+    *iocon = IOCON_FUNC(pin_range.fields.function) | iocon_extra | iocon_not_analog;
   #endif
 
   return RTEMS_SUCCESSFUL;



More information about the vc mailing list