Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Re: PINSEL2 crashes everything

2005-08-02 by Aalt Lokhorst

Hello Soren,

I think your hardware is running fine, probably the behaviour is not what your expecting but that is not caused by a hardware failure.

Look in the User Manual of the LPC2132, you can find it on the Philips site.

The manual tells:
Warning: use read-modify-write operation when accessing PINSEL2 register. Accidental write of 0 to bit 2 and/or bit 3 results in loss of 
debug and/or trace functionality! Changing of either bit 4 or bit 5 from 
1 to 0 may cause an incorrect code execution!

The same manual shows in Table 60 that the Reset value of bit 2 isn't 0, 
the default value is the inverted level that is at P1.26 (RTCK) during Reset. This P1.26 needs to be low during reset if you want to use the JTAG port. This will result in setting bit 2 of PINSEL2. If you clear this bit then it will disable the JTAG port.

Regarding your code:
I think your line of code isn't doing what you want it to do.

PINSEL2 = (PINSEL2 & (0 << 2) & (0 << 3));

You are 'anding' PINSEL2 with 0 because the both (0 << #) items will evalute to 0. If you want to clear a bit then you have to 'AND' with the 
inverted bitvalue to prevent the changing of the other bits . (I think it should be something like ~(1<<2)


Regards
Aalt

soren_t_hansen wrote:
> --- In lpc2000@yahoogroups.com, "Aalt Lokhorst" <lokhorst@s...> wrote:
>  > Hello Søren,
>  >
>  > Not sure what processor you are using but I think you are diabling
> the JTAG by changing a JTAG line into a GPIO line.
>  >
>  > I am using the LC2129 and the usermanual of this processor shows the
> following:
>  >
>  > Table 63: Pin Function Select Register 2 for LPC2119/2129/2194
>  > (PINSEL2 - 0xE002C014)
>  >
>  > 1:0 Reserved.
>  >
>  > 2 When 0, pins P1.36:26 are used as GPIO pins.
>  >    When 1, P1.31:26 are used as a Debug port. (RTCK)
>  >
>  > 3 When 0, pins P1.25:16 are used as GPIO pins.
>  >    When 1, P1.25:16 are used as a Trace port.  (TRACESYNC)
>  >
>  > 4:5 Reserved.  Note: These bits must not be altered at any time.
>  >      Changing them may result in an incorrect code execution.
>  >
>  > 6:31 Reserved.
>  >
>  > According to this info you are disabling the JTAG RTCK line.
>  >
>  > Hope this helps,
>  > Aalt
>  >
> > Ups forgot to tell - it's a lpc2132 :o)
> > I use the following line and it still crashes:
> > PINSEL2 = (PINSEL2 & (0 << 2) & (0 << 3));
> > At the moment it isn't that big a deal, since the PINSEL2 bit 2 and 3
> are 0 at reset, and that's what I want them to be. It just pusled me
> that I couldn't write to those two bits whithout the MCU crashing.
> > /Søren
> > > > ------------------------------------------------------------------------
> YAHOO! GROUPS LINKS
> >     *  Visit your group "lpc2000
>       <http://groups.yahoo.com/group/lpc2000>" on the web.
>        >     *  To unsubscribe from this group, send an email to:
>        lpc2000-unsubscribe@yahoogroups.com
>       <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>        >     *  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>.
> > > ------------------------------------------------------------------------
> 
-- ==============================
Aalt Lokhorst
Schut Geometrische Meettechniek bv
Duinkerkenstraat 21
9723 BN Groningen
P.O. Box 5225
9700 GE Groningen
The Netherlands
Tel: +31-50-5877877
Fax: +31-50-5877899
E-mail: Lokhorst@...
==============================

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.