LPC1114FN/102 R_PIO0_11 not functioning as output. - [SOLVED]

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

LPC1114FN/102 R_PIO0_11 not functioning as output. - [SOLVED]

549 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mp035 on Tue Sep 02 06:35:29 MST 2014
Hi All, I'm new to LPC devices, have used all forms of PIC microcontrollers for many years.  I am trying to drive R_PIO0_11 on LPC1114 in DIP28 package, and no matter what I try, it does not respond, other GPIO pins seem to work fine.  Any hints on what I am missing would be very welcome.  Here is my code:
    GPIOInit();

    SystemCoreClockUpdate();
    /* Setup SysTick Timer for 1 msec interrupts  */
    if (SysTick_Config(SystemCoreClock / 1000)) { 
        while (1);                                  /* Capture error */
    }

    // manual CS PIN
    LPC_IOCON->R_PIO0_11 =
    0x01 | // select GPIO as function
    (0x00 << 3)| // no pull-up/pull-down
    (0x00 << 5)| // no hysteresis
    (0x01 << 7)| // digital pin
    (0x00 << 10); // non open-drain
    GPIOSetDir(0, 11, output); //manual CS pin
    GPIOSetValue(0, 11, 0); //*************************** PIO0_11 stays HIGH!!!!!!!!!!
Labels (1)
0 Kudos
7 Replies

514 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by 1234567890 on Sun Sep 07 01:00:39 MST 2014
Download and install ('Import project(s)' menu) the matching package:
http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc11xx-packages-0
0 Kudos

514 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mp035 on Sat Sep 06 21:09:22 MST 2014
Hi, unfortunately F3 is not an option, because I don't have the symbol defined in my workspace, compilation using the symol results in:

error: 'SYSCTL_CLOCK_IOCON' undeclared here (not in a function)

I did
me@mybox:/usr/local/lpcxpresso_7.3.0_186$ find * -name clock_11xx.h


which returned no results.

Is there a project, or something that I need to get the definitions?

Thanks again for all of your help.
0 Kudos

514 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Wed Sep 03 18:04:15 MST 2014

Quote: mp035
...I can not find any standard definitions for the bit positions, as there is in your code example.  Can you point me to where they are?



F3 is your friend  :bigsmile:

If you select ' SYSCTL_CLOCK_IOCON' with double click you can use 'Open Declaration' (F3) to let LPCXpresso find it... in 'clock_11xx.h'  :)
0 Kudos

514 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mp035 on Wed Sep 03 17:41:14 MST 2014
Thanks for the tips.

Can I ask one more question, I know where the peripheral register word names are defined, but I can not find any standard definitions for the bit positions, as there is in your code example.  Can you point me to where they are?

To be clear, this is so that my code is more readable, ie:
<code>
LPC_SYSCTL->SYSAHBCLKCTRL |= (1 << SYSCTL_CLOCK_IOCON);
<code>
instead of:
<code>
LPC_SYSCTL->SYSAHBCLKCTRL |= (1  << 16);
<code>
0 Kudos

514 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Tue Sep 02 15:57:31 MST 2014

Quote: mp035
It seems rather silly that  a library function would enable the GPIO block, but not the IOCON block



LPCOpen is far away from beeing perfect and so your logic approach isn't helping you...

Clock bits are set in SystemInit or other Inits or not  :)

In general it's helpful to use the Debugger to see if IOCON changes are really performed and IOCON bit is set...
0 Kudos

514 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mp035 on Tue Sep 02 15:39:18 MST 2014
That operation is perfrormed in GPIOInit();

EDIT: Sorry.  You are correct. GPIOInit performs
LPC_SYSCTL->SYSAHBCLKCTRL |= (1<<6);


but NOT

LPC_SYSCTL->SYSAHBCLKCTRL |= (1<<16);


Which is, as you pointed out, is the IOCON block.   It seems rather silly that  a library function would enable the GPIO block, but not the IOCON block, especially on a device where IOCON is a prerequisite to using GPIO.

Anyways, thank you very much for your reply, it saved me pulling more of my hair out! 
0 Kudos

514 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Tue Sep 02 08:36:22 MST 2014
IOCON enabled  :quest:

LPC_SYSCTL->SYSAHBCLKCTRL |= (1[color=#f00]<<[/color]SYSCTL_CLOCK_IOCON);
0 Kudos