Reply by bobtransformer September 15, 20062006-09-15
I think it's great to have as many resources as possible for
this stuff. Thanks !
I like it all !

boB

--- In l..., Carsten Gr wrote:
>
> Peter,
> you are partly right :o)
> However, the Keil "peripheral view" dialog is very handy as
> a "testbed" of the processors internal hardware, timers, adc etc
etc
> etc. In the dialogs, you have all the registers shown, even the
> single control/status bits are there as simple checkboxex, it is a
> piece of cake to activate the different registers and see the
> effect. That way you dont have to remember all the register for a
> peripheral, they are listed right on the screen for you, ready to
> be "clicked"....
>
> I also once used Forth (and I liked it !), although it is 15+ years
> ago.
>
> Regards,
> Carsten
>
>
> --- In l..., Peter Jakacki wrote:
> >
> > Carsten Gr wrote:
> > > Quote: "There really isn't any better tool for exploring and
> > > debugging hardware than Forth."
> > >
> > > Well, I'm pretty happy with my Keil tool (using the debugger
and
> the
> > > peripheral view feature, beats everything else !) and a Keil
> uLink
> > > JTAG probe.....
> >
> > Ahh, the old JTAG probe, nothing like a sharp stick to get a
> response :)
> > At the assembler level the probe certainly is good for debugging
> code
> > and as a consequence the hardware to a certain extent. I was
> talking
> > more about interacting with the hardware a little bit more than
> just a
> > "peek" or a "poke".
> >
> > It is not at all unusual for me to write a one-liner to exercise
> > hardware. This does not entail any of the usual
> compile/download/probe
> > cycles, just talking to the hardware and getting responses, a bit
> like
> > having a conversation. If I had a funny problem like the GPIO not
> > responding it would have been sorted out within minutes but
> instead I
> > see so many of these "problems" and the resultant long threads
> > cluttering the group unnecessarily.
> >
> > I am a solder sniffer hardware guy as much as I am a keyboard
> pecker and
> > I have used all kinds of debugger tools. The digital scope comes
> in
> > handy every second day.
> >
> > However, an interactive programming environment that can access
> bare
> > silicon quickly and easily is surely a good thing, no? Just
> because we
> > have a really good pair of tweezers in our toolkit doesn't mean
we
> > should not bother with pliers or screwdrivers. Sometimes,
> occasionally,
> > I even resort to JTAG probes if that is the right tool to use at
> the time.
> >
> > *Peter*
>



An Engineer's Guide to the LPC2100 Series

Reply by Michael Anton September 15, 20062006-09-15
Hi Bob,

Yes I have fast I/O working on an LPC2148. I only use the 32bit
registers though, so that might be an issue.

Mike

> -----Original Message-----
> From: l...
> [mailto:l...]On Behalf
> Of bobtransformer
> Sent: Friday, September 15, 2006 12:25 AM
> To: l...
> Subject: [lpc2000] Re: Port 1 of LPC 2148 completely switched to GPIO
> does not work.
>
> I finally got P1.16 - P1.18 to toggle (LPC2144)
>
> I can only seem to get it to work by using legacy
> GPIO IO1SET IO1CLR IO1DIR etc. (not FIO) I also
> accessed Port1 by the entire port (32 bit) register,
> not the IO1SET2 IO1CLR2 IO1DIR2 8 bit at a time
> method. I had tried FIO with GPIO1M =1 in SCS before.
>
> Have others really got FIO to work on port 1 ??
> Not that I really need it I suppose....
>
> boB
> --- In l..., "bobtransformer" wrote:
> >
> >
> >
> > I looked through a couple of Philips applications that used
> > P1.16 through P1.23 and I noticed that they never used
> > PINSEL2 and they accessed those bits through the
> > FIO1CLR 32 bit register and FIO1DIR 32 bit register (or IO1CLR etc)
> > rather than the FIO1CLR2 or FIO1DIR2 8 bit methods.
> >
> > Just an observation. I guess I'll try it this way myself
> > tonight to see if it makes any difference on my unit.
> >
> > Comments welcomed... :)
> >
> > boB
> >
> >
> >
> > --- In l..., "bobtransformer" wrote:
> > >
> > >
> > > > I believe this should be:
> > > > PINSEL2 = (PINSEL2 & 0x00000030) | value
> > > > as you don't want to keep bits 0 and 1, and bits 2 and 3 need
> to
> > be
> > > > cleared befor you set them.
> > >
> > >
> > > Yes, you're right there !
> > >
> > > And SCS bits are correct. I just changed the chip.
> > > Now some FIO1 bits aren't setting. 1 at least...
> > > WIll try setting PINSEL2 to 0 now.
> > >
> > > No I won't ! My JTAG's broken now.
> > >
> > > Thanks for the help, Michael.
> > >
> > > boB
> > >
> > >
> > >
> > > --- In l..., "Michael Anton" wrote:
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: l...
> > > > > [mailto:l...]On Behalf
> > > > > Of bobtransformer
> > > > > Sent: Tuesday, September 12, 2006 8:52 PM
> > > > > To: l...
> > > > > Subject: [lpc2000] Re: Port 1 of LPC 2148 completely switched
> > to
> > > GPIO
> > > > > does not work.
> > > > >
> > > > >
> > > > >
> > > > > Yes, you're right. I read that note many times now and it
> went
> > > right
> > > > > over me... So I would ignore their cut and pasted (most
> > likely)
> > > > > generic reserved bits note and use the warning note instead.
> I
> > > would
> > > > > include bits 4 and 5 too:
> > > > >
> > > > > (PINSEL2 = (PINSEL2 & 0x0000003F) | value)
> > > > >
> > > > > boB
> > > > >
> > > > >
> > > > >
> > > >
> > > > I believe this should be:
> > > > PINSEL2 = (PINSEL2 & 0x00000030) | value
> > > > as you don't want to keep bits 0 and 1, and bits 2 and 3 need
> to
> > be
> > > > cleared befor you set them.
> > > >
> > > > Another thing that is maybe different, is that I treat PINSEL2
> as
> > > > an 8 bit wide register, rather than 32, so that I am not writing
> > > > to the upper 24 bits at all.
> > > >
> > > > Mike
> > > >
> > >
> >
>
Reply by ruud_commandeur September 15, 20062006-09-15
Hello boB,

I did get FIO to work on port 1. As I recall it was just a matter of
setting the GPIO1M bit and using the proper FIO registers to set or
clear the individual or groups of ports. For instance these defines to
control an LED:

//LED2 = P1.29, controlled by Fast GPIO
#define LED2_OFF FIO1DIR3 |= 0x20; FIO1SET3 = 0x20
#define LED2_ON FIO1DIR3 |= 0x20; FIO1CLR3 = 0x20
#define LED2_INV\
{\
if(FIO1PIN3 & 0x20) \
{LED2_ON;} \
else {LED2_OFF;} \
}

And these defines to use P1.16 - P1.23 as een 8-bit address databus
(for an Ethernet controller):

#define ETH_AD_INIT FIO1MASK2 = 0x00
#define ETH_AD_INPUT FIO1DIR2 = 0x00
#define ETH_AD_OUTPUT FIO1DIR2 = 0xFF
#define ETH_OUT(d) FIO1PIN2 = d
#define ETH_IN(d) d = FIO1PIN2

To be sure that P1.16 - P1.31 can be used as (Fast) GPIO I used these
commands:

SCS_REG = 0x02;
PINSEL2 = 0x00;

Note that the PINSEL2 default/reset value is determined by the reset
value of pins P1.26 and P1.20!! By the way: I don't see why you should
and the PINSEL2 value with 0x00000030. Why filtering and keeping bits
4 & 5? All other bits than 1 & 2 are reserved and should always be set
to 0, is it not?

The only problem I had that no defines for the Fast IO were included
in the "iolpc21xx" header files of the IAR EWARM environment. Not even
the SCS register! I was quite surprised by this, even in the latest
release (4.40) this has not been added, like no one has use this
feature before?? I had to copy these from the Keil enviroment, which
worked fine.

Hope this will help you in some way,

Slay

--- In l..., "bobtransformer" wrote:
> I finally got P1.16 - P1.18 to toggle (LPC2144)
>
> I can only seem to get it to work by using legacy
> GPIO IO1SET IO1CLR IO1DIR etc. (not FIO) I also
> accessed Port1 by the entire port (32 bit) register,
> not the IO1SET2 IO1CLR2 IO1DIR2 8 bit at a time
> method. I had tried FIO with GPIO1M =1 in SCS before.
>
> Have others really got FIO to work on port 1 ??
> Not that I really need it I suppose....
>
> boB
> --- In l..., "bobtransformer" wrote:
> >
> >
> >
> > I looked through a couple of Philips applications that used
> > P1.16 through P1.23 and I noticed that they never used
> > PINSEL2 and they accessed those bits through the
> > FIO1CLR 32 bit register and FIO1DIR 32 bit register (or IO1CLR etc)
> > rather than the FIO1CLR2 or FIO1DIR2 8 bit methods.
> >
> > Just an observation. I guess I'll try it this way myself
> > tonight to see if it makes any difference on my unit.
> >
> > Comments welcomed... :)
> >
> > boB
> >
> >
> >
> > --- In l..., "bobtransformer" wrote:
> > >
> > >
> > > > I believe this should be:
> > > > PINSEL2 = (PINSEL2 & 0x00000030) | value
> > > > as you don't want to keep bits 0 and 1, and bits 2 and 3 need
> to
> > be
> > > > cleared befor you set them.
> > >
> > >
> > > Yes, you're right there !
> > >
> > > And SCS bits are correct. I just changed the chip.
> > > Now some FIO1 bits aren't setting. 1 at least...
> > > WIll try setting PINSEL2 to 0 now.
> > >
> > > No I won't ! My JTAG's broken now.
> > >
> > > Thanks for the help, Michael.
> > >
> > > boB
> > >
> > >
> > >
> > > --- In l..., "Michael Anton" wrote:
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: l...
> > > > > [mailto:l...]On Behalf
> > > > > Of bobtransformer
> > > > > Sent: Tuesday, September 12, 2006 8:52 PM
> > > > > To: l...
> > > > > Subject: [lpc2000] Re: Port 1 of LPC 2148 completely switched
> > to
> > > GPIO
> > > > > does not work.
> > > > >
> > > > >
> > > > >
> > > > > Yes, you're right. I read that note many times now and it
> went
> > > right
> > > > > over me... So I would ignore their cut and pasted (most
> > likely)
> > > > > generic reserved bits note and use the warning note instead.
> I
> > > would
> > > > > include bits 4 and 5 too:
> > > > >
> > > > > (PINSEL2 = (PINSEL2 & 0x0000003F) | value)
> > > > >
> > > > > boB
> > > > >
> > > > >
> > > > >
> > > >
> > > > I believe this should be:
> > > > PINSEL2 = (PINSEL2 & 0x00000030) | value
> > > > as you don't want to keep bits 0 and 1, and bits 2 and 3 need
> to
> > be
> > > > cleared befor you set them.
> > > >
> > > > Another thing that is maybe different, is that I treat PINSEL2
> as
> > > > an 8 bit wide register, rather than 32, so that I am not writing
> > > > to the upper 24 bits at all.
> > > >
> > > > Mike
> > > >
> > >
>
Reply by September 15, 20062006-09-15
Peter,
you are partly right :o)
However, the Keil "peripheral view" dialog is very handy as
a "testbed" of the processors internal hardware, timers, adc etc etc
etc. In the dialogs, you have all the registers shown, even the
single control/status bits are there as simple checkboxex, it is a
piece of cake to activate the different registers and see the
effect. That way you dont have to remember all the register for a
peripheral, they are listed right on the screen for you, ready to
be "clicked"....

I also once used Forth (and I liked it !), although it is 15+ years
ago.

Regards,
Carsten
--- In l..., Peter Jakacki wrote:
>
> Carsten Gr wrote:
> > Quote: "There really isn't any better tool for exploring and
> > debugging hardware than Forth."
> >
> > Well, I'm pretty happy with my Keil tool (using the debugger and
the
> > peripheral view feature, beats everything else !) and a Keil
uLink
> > JTAG probe.....
>
> Ahh, the old JTAG probe, nothing like a sharp stick to get a
response :)
> At the assembler level the probe certainly is good for debugging
code
> and as a consequence the hardware to a certain extent. I was
talking
> more about interacting with the hardware a little bit more than
just a
> "peek" or a "poke".
>
> It is not at all unusual for me to write a one-liner to exercise
> hardware. This does not entail any of the usual
compile/download/probe
> cycles, just talking to the hardware and getting responses, a bit
like
> having a conversation. If I had a funny problem like the GPIO not
> responding it would have been sorted out within minutes but
instead I
> see so many of these "problems" and the resultant long threads
> cluttering the group unnecessarily.
>
> I am a solder sniffer hardware guy as much as I am a keyboard
pecker and
> I have used all kinds of debugger tools. The digital scope comes
in
> handy every second day.
>
> However, an interactive programming environment that can access
bare
> silicon quickly and easily is surely a good thing, no? Just
because we
> have a really good pair of tweezers in our toolkit doesn't mean we
> should not bother with pliers or screwdrivers. Sometimes,
occasionally,
> I even resort to JTAG probes if that is the right tool to use at
the time.
>
> *Peter*
>



Reply by Peter Jakacki September 15, 20062006-09-15
Carsten Gr wrote:
> Quote: "There really isn't any better tool for exploring and
> debugging hardware than Forth."
>
> Well, I'm pretty happy with my Keil tool (using the debugger and the
> peripheral view feature, beats everything else !) and a Keil uLink
> JTAG probe.....

Ahh, the old JTAG probe, nothing like a sharp stick to get a response :)
At the assembler level the probe certainly is good for debugging code
and as a consequence the hardware to a certain extent. I was talking
more about interacting with the hardware a little bit more than just a
"peek" or a "poke".

It is not at all unusual for me to write a one-liner to exercise
hardware. This does not entail any of the usual compile/download/probe
cycles, just talking to the hardware and getting responses, a bit like
having a conversation. If I had a funny problem like the GPIO not
responding it would have been sorted out within minutes but instead I
see so many of these "problems" and the resultant long threads
cluttering the group unnecessarily.

I am a solder sniffer hardware guy as much as I am a keyboard pecker and
I have used all kinds of debugger tools. The digital scope comes in
handy every second day.

However, an interactive programming environment that can access bare
silicon quickly and easily is surely a good thing, no? Just because we
have a really good pair of tweezers in our toolkit doesn't mean we
should not bother with pliers or screwdrivers. Sometimes, occasionally,
I even resort to JTAG probes if that is the right tool to use at the time.

*Peter*
Reply by September 15, 20062006-09-15
Quote: "There really isn't any better tool for exploring and
debugging hardware than Forth."

Well, I'm pretty happy with my Keil tool (using the debugger and the
peripheral view feature, beats everything else !) and a Keil uLink
JTAG probe.....

Regards,
Carsten
--- In l..., Peter Jakacki wrote:
>
> Hi Bob, I haven't really had the time to read this thread but if
you
> want you can just download my Forth for the lpc2148 and probe
> interactively with a few simple commands or one line routines.
There
> really isn't any better tool for exploring and debugging hardware
than
> Forth. Just type things like "FIO1MASK ?" to view the contents or
> "FIODIR 20 DUMP". The base (radix) is set to hex on startup and
all the
> register names are predefined so there is nothing you need but a
terminal.
>
> http://www.pbjtech.com/downloads/IVOS2148.ZIP
>
> *Peter*
Reply by Peter Jakacki September 15, 20062006-09-15
Hi Bob, I haven't really had the time to read this thread but if you
want you can just download my Forth for the lpc2148 and probe
interactively with a few simple commands or one line routines. There
really isn't any better tool for exploring and debugging hardware than
Forth. Just type things like "FIO1MASK ?" to view the contents or
"FIODIR 20 DUMP". The base (radix) is set to hex on startup and all the
register names are predefined so there is nothing you need but a terminal.

http://www.pbjtech.com/downloads/IVOS2148.ZIP

*Peter*
bobtransformer wrote:
>
> I finally got P1.16 - P1.18 to toggle (LPC2144)
>
> I can only seem to get it to work by using legacy
> GPIO IO1SET IO1CLR IO1DIR etc. (not FIO) I also
> accessed Port1 by the entire port (32 bit) register,
> not the IO1SET2 IO1CLR2 IO1DIR2 8 bit at a time
> method. I had tried FIO with GPIO1M =1 in SCS before.
>
> Have others really got FIO to work on port 1 ??
> Not that I really need it I suppose....
Reply by bobtransformer September 15, 20062006-09-15
I finally got P1.16 - P1.18 to toggle (LPC2144)

I can only seem to get it to work by using legacy
GPIO IO1SET IO1CLR IO1DIR etc. (not FIO) I also
accessed Port1 by the entire port (32 bit) register,
not the IO1SET2 IO1CLR2 IO1DIR2 8 bit at a time
method. I had tried FIO with GPIO1M =1 in SCS before.

Have others really got FIO to work on port 1 ??
Not that I really need it I suppose....

boB
--- In l..., "bobtransformer" wrote:
>
> I looked through a couple of Philips applications that used
> P1.16 through P1.23 and I noticed that they never used
> PINSEL2 and they accessed those bits through the
> FIO1CLR 32 bit register and FIO1DIR 32 bit register (or IO1CLR etc)
> rather than the FIO1CLR2 or FIO1DIR2 8 bit methods.
>
> Just an observation. I guess I'll try it this way myself
> tonight to see if it makes any difference on my unit.
>
> Comments welcomed... :)
>
> boB
>
> --- In l..., "bobtransformer" wrote:
> >
> >
> > > I believe this should be:
> > > PINSEL2 = (PINSEL2 & 0x00000030) | value
> > > as you don't want to keep bits 0 and 1, and bits 2 and 3 need
to
> be
> > > cleared befor you set them.
> >
> >
> > Yes, you're right there !
> >
> > And SCS bits are correct. I just changed the chip.
> > Now some FIO1 bits aren't setting. 1 at least...
> > WIll try setting PINSEL2 to 0 now.
> >
> > No I won't ! My JTAG's broken now.
> >
> > Thanks for the help, Michael.
> >
> > boB
> >
> >
> >
> > --- In l..., "Michael Anton" wrote:
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: l...
> > > > [mailto:l...]On Behalf
> > > > Of bobtransformer
> > > > Sent: Tuesday, September 12, 2006 8:52 PM
> > > > To: l...
> > > > Subject: [lpc2000] Re: Port 1 of LPC 2148 completely switched
> to
> > GPIO
> > > > does not work.
> > > >
> > > >
> > > >
> > > > Yes, you're right. I read that note many times now and it
went
> > right
> > > > over me... So I would ignore their cut and pasted (most
> likely)
> > > > generic reserved bits note and use the warning note instead.
I
> > would
> > > > include bits 4 and 5 too:
> > > >
> > > > (PINSEL2 = (PINSEL2 & 0x0000003F) | value)
> > > >
> > > > boB
> > > >
> > > >
> > > >
> > >
> > > I believe this should be:
> > > PINSEL2 = (PINSEL2 & 0x00000030) | value
> > > as you don't want to keep bits 0 and 1, and bits 2 and 3 need
to
> be
> > > cleared befor you set them.
> > >
> > > Another thing that is maybe different, is that I treat PINSEL2
as
> > > an 8 bit wide register, rather than 32, so that I am not writing
> > > to the upper 24 bits at all.
> > >
> > > Mike
> > >
>
Reply by bobtransformer September 14, 20062006-09-14
I looked through a couple of Philips applications that used
P1.16 through P1.23 and I noticed that they never used
PINSEL2 and they accessed those bits through the
FIO1CLR 32 bit register and FIO1DIR 32 bit register (or IO1CLR etc)
rather than the FIO1CLR2 or FIO1DIR2 8 bit methods.

Just an observation. I guess I'll try it this way myself
tonight to see if it makes any difference on my unit.

Comments welcomed... :)

boB

--- In l..., "bobtransformer" wrote:
> > I believe this should be:
> > PINSEL2 = (PINSEL2 & 0x00000030) | value
> > as you don't want to keep bits 0 and 1, and bits 2 and 3 need to
be
> > cleared befor you set them.
> Yes, you're right there !
>
> And SCS bits are correct. I just changed the chip.
> Now some FIO1 bits aren't setting. 1 at least...
> WIll try setting PINSEL2 to 0 now.
>
> No I won't ! My JTAG's broken now.
>
> Thanks for the help, Michael.
>
> boB
>
> --- In l..., "Michael Anton" wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: l...
> > > [mailto:l...]On Behalf
> > > Of bobtransformer
> > > Sent: Tuesday, September 12, 2006 8:52 PM
> > > To: l...
> > > Subject: [lpc2000] Re: Port 1 of LPC 2148 completely switched
to
> GPIO
> > > does not work.
> > >
> > >
> > >
> > > Yes, you're right. I read that note many times now and it went
> right
> > > over me... So I would ignore their cut and pasted (most
likely)
> > > generic reserved bits note and use the warning note instead. I
> would
> > > include bits 4 and 5 too:
> > >
> > > (PINSEL2 = (PINSEL2 & 0x0000003F) | value)
> > >
> > > boB
> > >
> > >
> > >
> >
> > I believe this should be:
> > PINSEL2 = (PINSEL2 & 0x00000030) | value
> > as you don't want to keep bits 0 and 1, and bits 2 and 3 need to
be
> > cleared befor you set them.
> >
> > Another thing that is maybe different, is that I treat PINSEL2 as
> > an 8 bit wide register, rather than 32, so that I am not writing
> > to the upper 24 bits at all.
> >
> > Mike
>
Reply by bobtransformer September 13, 20062006-09-13
> I believe this should be:
> PINSEL2 = (PINSEL2 & 0x00000030) | value
> as you don't want to keep bits 0 and 1, and bits 2 and 3 need to be
> cleared befor you set them.
Yes, you're right there !

And SCS bits are correct. I just changed the chip.
Now some FIO1 bits aren't setting. 1 at least...
WIll try setting PINSEL2 to 0 now.

No I won't ! My JTAG's broken now.

Thanks for the help, Michael.

boB

--- In l..., "Michael Anton" wrote:
>
> > -----Original Message-----
> > From: l...
> > [mailto:l...]On Behalf
> > Of bobtransformer
> > Sent: Tuesday, September 12, 2006 8:52 PM
> > To: l...
> > Subject: [lpc2000] Re: Port 1 of LPC 2148 completely switched to
GPIO
> > does not work.
> >
> >
> >
> > Yes, you're right. I read that note many times now and it went
right
> > over me... So I would ignore their cut and pasted (most likely)
> > generic reserved bits note and use the warning note instead. I
would
> > include bits 4 and 5 too:
> >
> > (PINSEL2 = (PINSEL2 & 0x0000003F) | value)
> >
> > boB
> >
> >
> > I believe this should be:
> PINSEL2 = (PINSEL2 & 0x00000030) | value
> as you don't want to keep bits 0 and 1, and bits 2 and 3 need to be
> cleared befor you set them.
>
> Another thing that is maybe different, is that I treat PINSEL2 as
> an 8 bit wide register, rather than 32, so that I am not writing
> to the upper 24 bits at all.
>
> Mike
>