GPIO issue on LPC2368

Started by danielgl88 November 5, 2009
I've met a confusing problem. GPIO pins supposed to work as a input/output that we've defined right?
But the problem is I can made the GPIO-able pins on port2.x as GPIO, tested them and they work well.
But when I try to define GPIO-able pins on port 0.x and 1.x it seems that they're not working.
Is there any other state that I should define on these pins beside PINSEL, PINMODE, FIODIR?

FYI, I'm using http://www.futurlec.com/ARM2368_Controller.shtml

Thanks for your attention, really appreciate your help. :)

An Engineer's Guide to the LPC2100 Series

If you use FIODIR, make sure that you set P0 and P1 in "fast I/O mode"
(check manual for details), otherwise FIODIR won't have any effect on these
ports.

Best,
Bogdan

On Thu, Nov 5, 2009 at 6:01 AM, danielgl88 wrote:

> I've met a confusing problem. GPIO pins supposed to work as a input/output
> that we've defined right?
> But the problem is I can made the GPIO-able pins on port2.x as GPIO, tested
> them and they work well.
> But when I try to define GPIO-able pins on port 0.x and 1.x it seems that
> they're not working.
> Is there any other state that I should define on these pins beside PINSEL,
> PINMODE, FIODIR?
>
> FYI, I'm using http://www.futurlec.com/ARM2368_Controller.shtml
>
> Thanks for your attention, really appreciate your help. :)
>
>
>


Hi,

There are two ways to access GPIO in LPC23xx, the slow IO (IOPIN, IOSET, IOCLR, IODIR) and fast IO (FIOPIN, FIOSET, FIOCLR, FIODIR, FIOMASK).

The slow IO takes 6-7 clock cycles to read the pin status or write the pin state. Port0 and Port1 is using this method by default to provide compatibility with older LPC20xx. The fast IO takes 2-clock cycles to read the pin status or write the pin state. Port2, Port3, and Port4 by default use this method.

To enable Port0 and Port1 being accessed by the fast IO, set the GPIOM bit (GPIOM = 1) in SCS register (0xE01F_C1A0).

Regards,
-daniel

-----Original Message-----
From: l... [mailto:l...] On Behalf Of Bogdan Marinescu
Sent: Thursday, November 05, 2009 8:13 PM
To: l...
Subject: Re: [lpc2000] GPIO issue on LPC2368

If you use FIODIR, make sure that you set P0 and P1 in "fast I/O mode"
(check manual for details), otherwise FIODIR won't have any effect on these
ports.

Best,
Bogdan

On Thu, Nov 5, 2009 at 6:01 AM, danielgl88 wrote:

> I've met a confusing problem. GPIO pins supposed to work as a input/output
> that we've defined right?
> But the problem is I can made the GPIO-able pins on port2.x as GPIO, tested
> them and they work well.
> But when I try to define GPIO-able pins on port 0.x and 1.x it seems that
> they're not working.
> Is there any other state that I should define on these pins beside PINSEL,
> PINMODE, FIODIR?
>
> FYI, I'm using http://www.futurlec.com/ARM2368_Controller.shtml
>
> Thanks for your attention, really appreciate your help. :)

Another possibility is that you have errors in LPC23xx.h.  I had a version from lwIP where the definitions for FIOxDIRn were WRONG!
 
This meant that outputs on P0 and P1 were not working but P2 and P3 (where I used FIO
xDIRL) worked perfectly.

--- On Fri, 6/11/09, Daniel Widyanto wrote:
From: Daniel Widyanto
Subject: RE: [lpc2000] GPIO issue on LPC2368
To: "l..."
Date: Friday, 6 November, 2009, 1:23
 

Hi,

There are two ways to access GPIO in LPC23xx, the slow IO (IOPIN, IOSET, IOCLR, IODIR) and fast IO (FIOPIN, FIOSET, FIOCLR, FIODIR, FIOMASK).

The slow IO takes 6-7 clock cycles to read the pin status or write the pin state. Port0 and Port1 is using this method by default to provide compatibility with older LPC20xx. The fast IO takes 2-clock cycles to read the pin status or write the pin state. Port2, Port3, and Port4 by default use this method.

To enable Port0 and Port1 being accessed by the fast IO, set the GPIOM bit (GPIOM = 1) in SCS register (0xE01F_C1A0) .

Regards,
-daniel

-----Original Message-----
From: lpc2000@yahoogroups .com [mailto:lpc2000@yahoogroups .com] On Behalf Of Bogdan Marinescu
Sent: Thursday, November 05, 2009 8:13 PM
To: lpc2000@yahoogroups .com
Subject: Re: [lpc2000] GPIO issue on LPC2368

If you use FIODIR, make sure that you set P0 and P1 in "fast I/O mode"
(check manual for details), otherwise FIODIR won't have any effect on these
ports.

Best,
Bogdan

On Thu, Nov 5, 2009 at 6:01 AM, danielgl88 wrote:

> I've met a confusing problem. GPIO pins supposed to work as a input/output
> that we've defined right?
> But the problem is I can made the GPIO-able pins on port2.x as GPIO, tested
> them and they work well.
> But when I try to define GPIO-able pins on port 0.x and 1.x it seems that
> they're not working.
> Is there any other state that I should define on these pins beside PINSEL,
> PINMODE, FIODIR?
>
> FYI, I'm using http://www.futurlec .com/ARM2368_ Controller. shtml
>
> Thanks for your attention, really appreciate your help. :)