Yahoo Groups archive

Lpc2000

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

Message

Re: PINSEL2 crashes everything

2005-08-03 by Dave

--- In lpc2000@yahoogroups.com, "soren_t_hansen" <soren_t_hansen@y...>
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

You obviously meant:

//---------------------------------------------------------------

#define PIO_PINSEL0        ((volatile unsigned long *) 0xE002C000)
#define PIO_PINSEL1        ((volatile unsigned long *) 0xE002C004)
#define PIO_PINSEL2        ((volatile unsigned long *) 0xE002C014)

struct PINSEL_REGS {
	volatile unsigned long* sel0;
	volatile unsigned long* sel1;
	volatile unsigned long* sel2;
};

static const struct PINSEL_REGS pinsel_regs = {
	PIO_PINSEL0,
	PIO_PINSEL1,
	PIO_PINSEL2
};

static const struct PINSEL_REGS* pioGetPinSel(void) { return
&pinsel_regs; }

//---------------------------------------------------------------

	unsigned long regVal;
	const struct PINSEL_REGS* pinsel = pioGetPinSel();

	regVal = *pinsel->sel2;
	regVal &= ~(PINSEL2_ENABLE_TRACE | PINSEL2_ENABLE_DEBUG);
	*pinsel->sel2 = regVal;

Dave

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.