EmbeddedRelated.com
Forums

Port 1 of LPC 2148 completely switched to GPIO does not work.

Started by "joerg.nagel" June 28, 2006
--- In l..., "brendanmurphy37"
wrote:
>
> --- In l..., "jayasooriah" wrote:
> > We certainly do differ in that one of us understands reverse
> engineering.
> > You're right there: we are different. I don't feel the need
> gratuitously to insult people who don't agree with me.
>
> Please give everyone in the group a break, and lay off the insults. We
> all have better things to do than listen to abusive comments.
>
> Brendan.
>

Would be good if you could start and lead on on this path :)
Jaya

An Engineer's Guide to the LPC2100 Series

Did anybody ever really figure out this problem ???
I am using the LPC2144 and can not seem to get port 1
to output 1's and zeros. However, the one PWM output
on port 1 appears to work.

I have set the bit that is suppoed to make P1.16 to P1.25 GPIO.
Using FIO. Does the LPC series not really have an operational port 1
GPIO ?? I need those bits.

thanks,
boB
--- In l..., "joerg.nagel" wrote:
>
> Hello all,
> by fluke I found a workaround for my problem.
> I played around with the GPIO peripherals in the Kile simulator
while
> simultaneously watching the IOPIN1 content on the serial console.
> Suddenly I found a state in which Port1 could be read although
PINSEL2
> bit 2 and 3 were zero. It depends on the state of P1.31. Either when
> it is switched to input and pulled low or when this pin is set to
> output and output is set to 0 the port wakes up.
> This behaviour seems very strange to me. It is nowhere mentioned in
> the LPC2148 users manual and does not make sense at all, because it
is
> not possible to read a one from this pin ?!?!
> It was big luck that I only need the first 14 IO pins of this port
but
> when someone wants to use the whole Port as IO this could get very
> uncomfortable.
> I reproduced this with two Boards, one designed by myself and an
> Olimex LPC-P2148.
> There are three facts I really wonder about:
> Has really nobody used this port as IO before?
> Is this a feature or a bad hardware design error?
> And when its an error why is it implemented in the Kile simulator
but
> not mentioned in the LPC2148 errata sheet?
>
> Any comments?
>
> Cheers Joerg
>
> P.s.: Sorry for perhaps posting this message twice. The first time
it
> did not appear in the message list.
>
Update: no input on IO port 1 was: LPC2148: FIO1SET doesn't work
*****************************************

A wee bit older thread from Joerg
Hello All,
please let me update my request. After some measuring work I found out
that my FIO1SET works and puts out right values on the IO Pins. The
only thing I messed up with is that the FIO1PIN register mostly
represents 0x00000000. Only when I set the complete port for output it
represents the written values. Even during input configuration of the
complete port FIO1PIN ever stays 0x00000000 so I can't read out the
correct values.
Is it possible to checkout if JTAG and TRACE mode are dissabled
correctly and the port is really switched to GPIO? As I mentioned
before I wrote 0x00000000 to PINSEL2. P1.26 is pulled high with an
pull up resistor and P0.31 also is pulled high through the USB
circuit. P1.20 is connected to an peripherial device which has
floating output pins.

Does anybody have already used p1? What have you done to read from it.

Thanks in advance.
Joerg
> -----Original Message-----
> From: l...
> [mailto:l...]On Behalf
> Of bobtransformer
> Sent: Monday, September 11, 2006 8:01 PM
> To: l...
> Subject: [lpc2000] Re: Port 1 of LPC 2148 completely switched to GPIO
> does not work.
>
> Did anybody ever really figure out this problem ???
> I am using the LPC2144 and can not seem to get port 1
> to output 1's and zeros. However, the one PWM output
> on port 1 appears to work.
>
> I have set the bit that is suppoed to make P1.16 to P1.25 GPIO.
> Using FIO. Does the LPC series not really have an operational port 1
> GPIO ?? I need those bits.
>
> thanks,
> boB
Using a LPC2148, or LPC2146, I have had no problems using Port 1 for
GPIO. But I don't use any of the JTAG lines as GPIO, which is what
I believe the OP was having problems with.

If you are using fast I/O, you must only use fast I/O. I didn't catch
the note about this when I started, and wondered why some old legacy
code did not work.

Mike
I set both GPIO1M and 0M in SCS and made sure FIOMASKs are cleared
a long time ago... FIO has been working well for port 0.

For some reason I still can't get port1 to set a pin with FIO1SET etc.
I've set GPIO1M in SCS and FIO has been working well for port 0.

Now some weird things are happening with the J-link debugger too,
where certain pins (port0) won't set and clear until after I've
exited the debugger and it's just running out of RAM from the JTAG
load. IAR compiler...

Weird... I may have to call the FAE soon if I can't figure this
out. (Hello John H.)

Thanks,
boB
--- In l..., "Michael Anton" wrote:
>
> > -----Original Message-----
> > From: l...
> > [mailto:l...]On Behalf
> > Of bobtransformer
> > Sent: Monday, September 11, 2006 8:01 PM
> > To: l...
> > Subject: [lpc2000] Re: Port 1 of LPC 2148 completely switched to
GPIO
> > does not work.
> >
> >
> >
> > Did anybody ever really figure out this problem ???
> > I am using the LPC2144 and can not seem to get port 1
> > to output 1's and zeros. However, the one PWM output
> > on port 1 appears to work.
> >
> > I have set the bit that is suppoed to make P1.16 to P1.25 GPIO.
> > Using FIO. Does the LPC series not really have an operational
port 1
> > GPIO ?? I need those bits.
> >
> > thanks,
> > boB
> >
> >
> Using a LPC2148, or LPC2146, I have had no problems using Port 1 for
> GPIO. But I don't use any of the JTAG lines as GPIO, which is what
> I believe the OP was having problems with.
>
> If you are using fast I/O, you must only use fast I/O. I didn't
catch
> the note about this when I started, and wondered why some old legacy
> code did not work.
>
> Mike
>
> I set both GPIO1M and 0M in SCS and made sure FIOMASKs are cleared
> a long time ago... FIO has been working well for port 0.
>
> For some reason I still can't get port1 to set a pin with FIO1SET etc.
> I've set GPIO1M in SCS and FIO has been working well for port 0.
>
> Now some weird things are happening with the J-link debugger too,
> where certain pins (port0) won't set and clear until after I've
> exited the debugger and it's just running out of RAM from the JTAG
> load. IAR compiler...
>

Do you have any references to Fast IO registers in your ddf file? I
banged my head on this one some time back.
Joel
Yes, I had to add the FIO registers to the .ddf file. That was fairly
easy.

I just found this NOTE in the LPC214X manual:
"
P1.20/TRACESYNC 48[6] I/O P1.20 General purpose digital
input/output pin O TRACESYNC Trace Synchronization. Standard I/O
port with internal pull-up.
Note: LOW on this pin while RESET is LOW enables pins P1.25:16 to
operate as Trace port after reset
"

But, doesn't my setting of bit 3 of PINSEL2 override this and
make P1.25 -- P1.16 GPIO as it says:

As in:
3 GPIO/TRACE 0 Pins P1.25-16 are used as GPIO pins.

Thanks,
boB
--- In l..., Joel Winarske wrote:
>
>
> > I set both GPIO1M and 0M in SCS and made sure FIOMASKs are cleared
> > a long time ago... FIO has been working well for port 0.
> >
> > For some reason I still can't get port1 to set a pin with FIO1SET
etc.
> > I've set GPIO1M in SCS and FIO has been working well for port 0.
> >
> > Now some weird things are happening with the J-link debugger too,
> > where certain pins (port0) won't set and clear until after I've
> > exited the debugger and it's just running out of RAM from the JTAG
> > load. IAR compiler...
> >
>
> Do you have any references to Fast IO registers in your ddf file?
I
> banged my head on this one some time back.
>
>
> Joel
>



I don't see bits to select Port 1's pin function, as I do for
Port 0, like these...
PINSEL0 and PINSEL1 Values Function:
00 Primary (default) GPIO port
01 First alternate
10 Second alternate
11 Reserved

Although as I see the PWM working on this port, the alternate
function appears to work (I didn't set it this way that
I know of because I don't see that listed for port 1.

Must be different for Port 1 ???

boB
--- In l..., "bobtransformer" wrote:
>
>
> Yes, I had to add the FIO registers to the .ddf file. That was fairly
> easy.
>
> I just found this NOTE in the LPC214X manual:
> "
> P1.20/TRACESYNC 48[6] I/O P1.20 General purpose digital
> input/output pin O TRACESYNC Trace Synchronization. Standard I/O
> port with internal pull-up.
> Note: LOW on this pin while RESET is LOW enables pins P1.25:16 to
> operate as Trace port after reset
> "
>
> But, doesn't my setting of bit 3 of PINSEL2 override this and
> make P1.25 -- P1.16 GPIO as it says:
>
> As in:
> 3 GPIO/TRACE 0 Pins P1.25-16 are used as GPIO pins.
>
> Thanks,
> boB

Why would the trace port test at reset be any different than the
bootloader test? My GUESS is that P1.20 is tested coming out of reset
and if low then P1.25:16 are set to operate as a trace port
independent of anything that happens later.

Easy enough to test...

Richard



> Yes, I had to add the FIO registers to the .ddf file. That was fairly
> easy.
>
As a quick check try removing all references of the FIO registers from
the .ddf file. Then debug again and have code twiddle P1 FIO. I am
using P0 and P1 I/O in FIO mode in current design without trouble. I
seem to recall I experienced the same exact issue. My workaround was to
debug in non-FIO, then enabled FIO when there was no need to read FIO
registers in C-Spy.
Joel
> I just found this NOTE in the LPC214X manual:
> "
> P1.20/TRACESYNC 48[6] I/O P1.20 General purpose digital
> input/output pin O TRACESYNC Trace Synchronization. Standard I/O
> port with internal pull-up.
> Note: LOW on this pin while RESET is LOW enables pins P1.25:16 to
> operate as Trace port after reset
> "

LPC214x "Special" Pins
-----------------------
P0.2 - open drain, requires external pull-up for output functionality
P0.3 - open drain, requires external pull-up for output functionality
P0.11 - open drain, requires external pull-up for output functionality
P0.14 - open drain / sampled on reset. If low serial boot loader starts.
Requires external pull-up for output functionality
P0.31 - sampled on reset. If low JTAG port is disabled
P1.20 - sampled on reset. If low enable P1.16:25 to operate as Trace port
P1.26 - sampled on reset. If low enables P1.26:31 to operate as debug port
P1.16:26 have internal pull-ups
Joel Winarske
www.indyelectronics.com