Odd GPIO behavior

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

Odd GPIO behavior

560 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jdurand on Sat Sep 08 17:35:33 MST 2012
I've done several LPC boards already (LPC1113, LPC1754, LPC4350) and never had a problem with the GPIO...until now.

I have an LPC1226FBD48/301 part on my board here and while I can run code on it (FreeRTOS is running one task at the moment), I can't seem to talk to the GPIO.

For example, I go through and configure some of the IOCON bits for GPIO0 and then try to write to the DIR and OUT registers.  No matter what I write the registers read back as 0.  I tried using the Peripheral tab of the Code Red debugger and when I try to change the port in that, it warns me for example that it read back 0 after I wrote a 1.

Is there a power or clock I have to enable for the GPIO?  I've been looking through the manual but haven't found anything.
Labels (1)
0 Kudos
1 Reply

484 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jdurand on Sat Sep 08 22:06:26 MST 2012
I found it!

In SystemINIT() in CMSIS they have this section

  /* System clock to the IOCON needs to be enabled or
  most of the I/O related peripherals won't work. */
  LPC_SYSCON->SYSAHBCLKCTRL = 0x0001001FUL;

The problem is, it's turning OFF most clocks that were on by default.  All I had to do was turn them back on again.
0 Kudos