LPC1114 0.0 and 0.4 as GPIO

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

LPC1114 0.0 and 0.4 as GPIO

1,436 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MDimonte on Thu Apr 09 17:30:44 MST 2015
Hi,

I'm fairly new to microcontrollers, but I've been playing around with an LPC1114 and http://www.microbuilder.eu/Projects/LPC1114ReferenceDesign/CodeBaseDocumentation.aspx#pmuInit for my code base.

I'm having some issues setting 0.0 and 0.4 as high outputs. My code is as follows:

#include "core/gpio/gpio.h"
int main(void) 
{ 
    gpioInit(); 
    IOCON_PIO0_4=IOCON_PIO0_4_FUNC_GPIO; 
    IOCON_nRESET_PIO0_0=IOCON_nRESET_PIO0_0_FUNC_GPIO; 
 
    gpioSetDir(0,0,gpioDirection_Output); 
    gpioSetDir(0,4,gpioDirection_Output); 
        while (1) 
        { 
            gpioSetValue(0,0,1); 
            gpioSetValue(0,4,1); 
        } 
} 


I can actually only get about half of the pins to work when I set them as outputs this way, however, these are the only two that are needed for my program. Any ideas?
Labels (1)
0 Kudos
Reply
9 Replies

1,367 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Thu Apr 09 19:10:56 MST 2015
This is a NXP forum, so the usual toolchain is LPCXpresso & LPCOpen

http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc11xx-packages-0

Of course you can write to that IOCON register without library...

Something like:

LPC_IOCON->RESET_PIO0_0 = value; 


Or you can use the debugger to set the pin function to GPIO 
0 Kudos
Reply

1,367 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MDimonte on Thu Apr 09 18:57:20 MST 2015
Those commands are from lpc111x.h is that not standard? Could you please tell me how you do set it in whatever your library is and that would probably help me figure out what I'm doing wrong. Thanks!
0 Kudos
Reply

1,367 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Thu Apr 09 18:43:05 MST 2015

Quote: MDimonte
...shouldn't

IOCON_nRESET_PIO0_0=IOCON_nRESET_PIO0_0_FUNC_GPIO; 


set PIO0_0 into GPIO mode or am I doing something wrong here?



I'm not using this library, so I can't confirm that...

Debugging IOCON_PIO0_0 register should show you which function is actually selected 
0 Kudos
Reply

1,367 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MDimonte on Thu Apr 09 18:36:44 MST 2015
Awesome, thanks! One last question, shouldn't

IOCON_nRESET_PIO0_0=IOCON_nRESET_PIO0_0_FUNC_GPIO; 


set PIO0_0 into GPIO mode or am I doing something wrong here?
0 Kudos
Reply

1,367 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Thu Apr 09 18:21:33 MST 2015
UM10398 is describing Pin functions in Chapter 7  :O

If you want to use this pins as output, switch them to GPIO before  ;-)

Not sure which hardware you are using, but a few pins are often using different functions (and are connected for this purpose)...

PIO0.0 is usually Reset...

PIO0.10 is usually SWCLK (for SWD Debugger)...

PIO0.11 pin functions 0 (default after Reset) is not GPIO....

PIO1.0 pin functions 0 (default after Reset) is not GPIO...

PIO1.1 pin functions 0 (default after Reset) is not GPIO...

PIO1.2 pin functions 0 (default after Reset) is not GPIO...

PIO1.3 is usually SWDIO (for SWD Debugger)...

So it's a good idea to use the debugger to check this IOCON register settings after reading UM10398  :)


0 Kudos
Reply

1,367 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MDimonte on Thu Apr 09 18:03:27 MST 2015
Darn, thanks for the info. I just tested and I cannot get outputs from 0.0, 0.4, 0.5, 0.10, 0.11, and 1.0-1.3. I understand why 0.4/0.5 do not work but what about the rest?
0 Kudos
Reply

1,367 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Thu Apr 09 17:50:20 MST 2015

Quote: MDimonte
So it's not possible to set it as output?



It's open-drain. Of course you can use it as output if you add a pull-up   :)


Quote: MDimonte
So it's not possible to set it as output?



PIO0.4 and PIO0.5 are the only open-drain pins (for I2C)...
0 Kudos
Reply

1,367 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MDimonte on Thu Apr 09 17:45:20 MST 2015
So it's not possible to set it as output? What about 0.0, is there something similar going on with that?
0 Kudos
Reply

1,367 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Thu Apr 09 17:35:51 MST 2015

Quote: MDimonte
Any ideas?



PIO0_4  is an open-drain pin  ;-)
0 Kudos
Reply