Forums

GPIO problem on Ashling EVBA7 LPC2106

Started by tphatrapornnant October 22, 2005
Hi all,

I'm using Ashling EVBA7 Philips LPC2100 Evaluation board (LPC2106). I
got a problem about using GPIO P0.16-P0.31 as general input/output. I
set some of these pins (P0.16-P0.31) as I did on P0.0-P0.15 pins which
all were used and worked correctly. For P0.16-P0.31, it didn't work. I
set pins to be output as the following:

PINSEL0 &= ~P15;
IODIR |= P15;
IOSET = P15;

PINSEL1 &= ~P26;
IODIR |= P26;
IOSET = P26;

Both pins worked correctly on Keil simulator (I toggled both pins
with '1' and '0' in while loop) but only P0.15 could toggle on the
real H/W.

Did I forget somethings? Does anyone have a clue?

Thanks,

Teera.


An Engineer's Guide to the LPC2100 Series

--- In lpc2000@lpc2..., "tphatrapornnant" <tp35@l...> wrote:
>
> Hi all,
>
> I'm using Ashling EVBA7 Philips LPC2100 Evaluation board
(LPC2106). I
> got a problem about using GPIO P0.16-P0.31 as general
input/output. I
> set some of these pins (P0.16-P0.31) as I did on P0.0-P0.15 pins
which
> all were used and worked correctly. For P0.16-P0.31, it didn't
work. I
> set pins to be output as the following:
>
> PINSEL0 &= ~P15;
> IODIR |= P15;
> IOSET = P15;
>
> PINSEL1 &= ~P26;
> IODIR |= P26;
> IOSET = P26;
>
> Both pins worked correctly on Keil simulator (I toggled both pins
> with '1' and '0' in while loop) but only P0.15 could toggle on the
> real H/W.
>
> Did I forget somethings? Does anyone have a clue?
>
> Thanks,
>
> Teera.
>

I'm not really a fan of PINSELx &= ~PIN# - I can't see the bit
pattern and I doubt that it works. I much prefer to do a #define
<bit pattern name> <hex pattern> and then use that to set the bits.

However, I think the real problem is that there is no ~P26 in
PINSEL1, it should PROBABLY be the same pattern as ~P15. Each pin
select register only controls 16 pins.

Richard



--- In lpc2000@lpc2..., "rtstofer" <rstofer@p...> wrote:
>
> --- In lpc2000@lpc2..., "tphatrapornnant" <tp35@l...>
wrote:
> >
> > Hi all,
> >
> > I'm using Ashling EVBA7 Philips LPC2100 Evaluation board
> (LPC2106). I
> > got a problem about using GPIO P0.16-P0.31 as general
> input/output. I
> > set some of these pins (P0.16-P0.31) as I did on P0.0-P0.15 pins
> which
> > all were used and worked correctly. For P0.16-P0.31, it didn't
> work. I
> > set pins to be output as the following:
> >
> > PINSEL0 &= ~P15;
> > IODIR |= P15;
> > IOSET = P15;
> >
> > PINSEL1 &= ~P26;
> > IODIR |= P26;
> > IOSET = P26;
> >
> > Both pins worked correctly on Keil simulator (I toggled both
pins
> > with '1' and '0' in while loop) but only P0.15 could toggle on
the
> > real H/W.
> >
> > Did I forget somethings? Does anyone have a clue?
> >
> > Thanks,
> >
> > Teera.
> >
>
> I'm not really a fan of PINSELx &= ~PIN# - I can't see the bit
> pattern and I doubt that it works. I much prefer to do a #define
> <bit pattern name> <hex pattern> and then use that to set the bits.
>
> However, I think the real problem is that there is no ~P26 in
> PINSEL1, it should PROBABLY be the same pattern as ~P15. Each pin
> select register only controls 16 pins.

NUTS! There is no way it should be the same pattern as ~P15. In
fact, I don't even want to go there. Just create a proper bit
pattern and use it. Then you know you are setting the proper bits
to the proper state. >
> Richard
>




Hi Teera

If you are using the main JTAG 1 for debugging (DBGSEL = '1' at
reset) the ports P0.17..P.31 are not available for use as general
purpose ports - they become trace pins. (P0.16 will still work).

The simulator you used probably didn't take this in to account.

Most evaluation boards allow you also to use the JTAG 2, in which
case only pins P0.27..P0.31 will be used by the JTAG and
P0.16..P0.26 will be avaiable. JTAG 2 must be initialised by
software - there are application notes and is quite easy.

If DBSEL = '0' at reset all pins are free for use but JTAG debugging
is not possible.

I expect that this info may help you. If you need any more details,
application notes etc. just drop me a line.

Regards

Mark Butcher
www.mjbc.ch

>
> Hi all,
>
> I'm using Ashling EVBA7 Philips LPC2100 Evaluation board
(LPC2106). I
> got a problem about using GPIO P0.16-P0.31 as general
input/output. I
> set some of these pins (P0.16-P0.31) as I did on P0.0-P0.15 pins
which
> all were used and worked correctly. For P0.16-P0.31, it didn't
work. I
> set pins to be output as the following:
>
> PINSEL0 &= ~P15;
> IODIR |= P15;
> IOSET = P15;
>
> PINSEL1 &= ~P26;
> IODIR |= P26;
> IOSET = P26;
>
> Both pins worked correctly on Keil simulator (I toggled both pins
> with '1' and '0' in while loop) but only P0.15 could toggle on the
> real H/W.
>
> Did I forget somethings? Does anyone have a clue?
>
> Thanks,
>
> Teera.
>




Teera,

I am using almost all the GPIO pins on my LPC2106
board for driving CS8900A (at high speed). When doing
this exercise I learnt an important thing about P0.16
-- this behaves very differently, the switching timing
are very slow -- other pins are ok.

Set the appropriate PINSEL & IODIR bits, probe the
pins using an Oscilloscope & do this (you will see it
yourself),

while(1)
{
IOCLR = 0xffffffff
IOSET = 0xaaaaaaaa
IOCLR = 0xffffffff
IOSET = 0x55555555
} Cheers,
-Mike.

--- tphatrapornnant <tp35@tp35...> wrote:

> Hi all,
>
> I'm using Ashling EVBA7 Philips LPC2100 Evaluation
> board (LPC2106). I
> got a problem about using GPIO P0.16-P0.31 as
> general input/output. I
> set some of these pins (P0.16-P0.31) as I did on
> P0.0-P0.15 pins which
> all were used and worked correctly. For P0.16-P0.31,
> it didn't work. I
> set pins to be output as the following:
>
> PINSEL0 &= ~P15;
> IODIR |= P15;
> IOSET = P15;
>
> PINSEL1 &= ~P26;
> IODIR |= P26;
> IOSET = P26;
>
> Both pins worked correctly on Keil simulator (I
> toggled both pins
> with '1' and '0' in while loop) but only P0.15 could
> toggle on the
> real H/W.
>
> Did I forget somethings? Does anyone have a clue?
>
> Thanks,
>
> Teera.


__________________________________


Many thanks, Mark.

It's working now.

Teera.

--- In lpc2000@lpc2..., "Mark Butcher" <M_J_Butcher@I...>
wrote:
>
> Hi Teera
>
> If you are using the main JTAG 1 for debugging (DBGSEL = '1' at
> reset) the ports P0.17..P.31 are not available for use as general
> purpose ports - they become trace pins. (P0.16 will still work).
>
> The simulator you used probably didn't take this in to account.
>
> Most evaluation boards allow you also to use the JTAG 2, in which
> case only pins P0.27..P0.31 will be used by the JTAG and
> P0.16..P0.26 will be avaiable. JTAG 2 must be initialised by
> software - there are application notes and is quite easy.
>
> If DBSEL = '0' at reset all pins are free for use but JTAG debugging
> is not possible.
>
> I expect that this info may help you. If you need any more details,
> application notes etc. just drop me a line.
>
> Regards
>
> Mark Butcher
> www.mjbc.ch >
>
> >
> > Hi all,
> >
> > I'm using Ashling EVBA7 Philips LPC2100 Evaluation board
> (LPC2106). I
> > got a problem about using GPIO P0.16-P0.31 as general
> input/output. I
> > set some of these pins (P0.16-P0.31) as I did on P0.0-P0.15 pins
> which
> > all were used and worked correctly. For P0.16-P0.31, it didn't
> work. I
> > set pins to be output as the following:
> >
> > PINSEL0 &= ~P15;
> > IODIR |= P15;
> > IOSET = P15;
> >
> > PINSEL1 &= ~P26;
> > IODIR |= P26;
> > IOSET = P26;
> >
> > Both pins worked correctly on Keil simulator (I toggled both pins
> > with '1' and '0' in while loop) but only P0.15 could toggle on the
> > real H/W.
> >
> > Did I forget somethings? Does anyone have a clue?
> >
> > Thanks,
> >
> > Teera.
> >
>