EmbeddedRelated.com
Forums

LPC1311_13_42_43 PINTSEL description problem

Started by Alexan_e April 24, 2012
In LPC1311_13_42_43 User manual UM10375.pdf (
www.cn.nxp.com/documents/*user*_manual/UM10524.pdf )

section 3.5.30 page 27/28 there is a description of the PINTSEL
register, the problem is that the decription of the register and the bit
explenations are different.
To select a pin for any of the eight pin interrupts, *write the pin
number as 0 to 23 for pins PIO0_0 to PIO0_23 and 24 to 55 for pins
PIO1_0 to PIO1_31 to the INTPIN bits*.
For example, setting INTPIN to 0x5 in PINTSEL0 selects pin PIO0_5 for
pin interrupt 0. Setting INTPIN in PINTSEL7 to 0x32 (pin 50) selects pin
PIO1_26 for pin interrupt 7.
But according to the bit description of the register to select PIO1_26
you have to use
(1UL<<5) I 26 which results in 0x58

GPIO Pin Interrupt Select register (PINTSEL, address 0x4004 8178) bit
description:
b4:0 INTPIN Pin number within the port selected by the PORTSEL 0 bit in
this register.

b5 PORTSEL Select the port for the pin number to be selected in the 0
INTPIN bits of this register, 0=Port 0 and 1=Port 1

Does anyone know which of the two ways is correct?

Alex

An Engineer's Guide to the LPC2100 Series

Hi ALex,

On Tue, 2012-04-24 at 10:49 +0300, Alexan_e wrote:
> In LPC1311_13_42_43 User manual UM10375.pdf (
> www.cn.nxp.com/documents/*user*_manual/UM10524.pdf )
>
> section 3.5.30 page 27/28 there is a description of the PINTSEL
> register, the problem is that the decription of the register and the bit
> explenations are different.

I have spend a hour on this now and I will try some
more tonight at home, I have to do some work :-)
As far as I can tell you, the description is not
correct but table 35 seems to be correct.
"PINTSEL" is not listed in the include files, like
lpc13xx.h, in cmsis v1p30 v2p00. Strange.

But unfortunally I cannot try this on real silicon
as I only have a lpcxpresso board with a lpc1343 on
it. The um10375 does not show anything about "PINTSEL"
at all. But um10524 does and that is for a different
microcontroller that I do not have.

roelof

Sorry to get you in trouble but I did mess up and instead of writing LPC1315_16_17_45_46_47 UM10524.pdf I wrote LPC1311_13_42_43 User manual UM10375.pdf
The quotes and the datasheet link in my post were the correct ones.
So my question refers to LPC1315_16_17_45_46_47 UM10524.pdf ( www.cn.nxp.com/documents/user_manual/*UM10524*.*pdf*)

In uVision 4.5 the register exists in the LPC13Uxx.x file (@version V0.1, @date 18. Jan 2012)

typedef struct { /*!< (@ 0x40048000) SYSCON Structure */

__IO uint32_t PINSEL[8]; /*!< (@ 0x40048178) GPIO Pin Interrupt Select register */

} LPC_SYSCON_Type;

Apparently the name is different but based on the given address that is what is described as PINTSEL in the datasheet

LPC_SYSCON->PINSEL[0]
LPC_SYSCON->PINSEL[1]
LPC_SYSCON->PINSEL[2]
LPC_SYSCON->PINSEL[3]
LPC_SYSCON->PINSEL[4]
LPC_SYSCON->PINSEL[5]
LPC_SYSCON->PINSEL[6]
LPC_SYSCON->PINSEL[7]

I also think that the correct way is the one described in the register bits table but I can't be sure becasue I have no hardware to test it.

Alex
On 04/24/2012 12:33 PM, roelof 't Hooft wrote:

> Hi ALex,
>
> On Tue, 2012-04-24 at 10:49 +0300, Alexan_e wrote:
> > In LPC1311_13_42_43 User manual UM10375.pdf (
> > www.cn.nxp.com/documents/*user*_manual/UM10524.pdf )
> >
> > section 3.5.30 page 27/28 there is a description of the PINTSEL
> > register, the problem is that the decription of the register and the
> bit
> > explenations are different.
>
> I have spend a hour on this now and I will try some
> more tonight at home, I have to do some work :-)
> As far as I can tell you, the description is not
> correct but table 35 seems to be correct.
> "PINTSEL" is not listed in the include files, like
> lpc13xx.h, in cmsis v1p30 v2p00. Strange.
>
> But unfortunally I cannot try this on real silicon
> as I only have a lpcxpresso board with a lpc1343 on
> it. The um10375 does not show anything about "PINTSEL"
> at all. But um10524 does and that is for a different
> microcontroller that I do not have.
>
> roelof

I have opened a ticket with NXP support to resolve the issue

Alex

----- Original Message -----
From: Alexan_e
To: l...
Sent: Tuesday, April 24, 2012 1:17 PM
Subject: Re: [lpc2000] LPC1311_13_42_43 PINTSEL description problem

Sorry to get you in trouble but I did mess up and instead of writing LPC1315_16_17_45_46_47 UM10524.pdf I wrote LPC1311_13_42_43 User manual UM10375.pdf
The quotes and the datasheet link in my post were the correct ones.
So my question refers to LPC1315_16_17_45_46_47 UM10524.pdf ( www.cn.nxp.com/documents/user_manual/*UM10524*.*pdf*)

In uVision 4.5 the register exists in the LPC13Uxx.x file (@version V0.1, @date 18. Jan 2012)

typedef struct { /*!< (@ 0x40048000) SYSCON Structure */

__IO uint32_t PINSEL[8]; /*!< (@ 0x40048178) GPIO Pin Interrupt Select register */

} LPC_SYSCON_Type;

Apparently the name is different but based on the given address that is what is described as PINTSEL in the datasheet

LPC_SYSCON->PINSEL[0]
LPC_SYSCON->PINSEL[1]
LPC_SYSCON->PINSEL[2]
LPC_SYSCON->PINSEL[3]
LPC_SYSCON->PINSEL[4]
LPC_SYSCON->PINSEL[5]
LPC_SYSCON->PINSEL[6]
LPC_SYSCON->PINSEL[7]

I also think that the correct way is the one described in the register bits table but I can't be sure becasue I have no hardware to test it.

Alex

On 04/24/2012 12:33 PM, roelof 't Hooft wrote:

> Hi ALex,
>
> On Tue, 2012-04-24 at 10:49 +0300, Alexan_e wrote:
> > In LPC1311_13_42_43 User manual UM10375.pdf (
> > www.cn.nxp.com/documents/*user*_manual/UM10524.pdf )
> >
> > section 3.5.30 page 27/28 there is a description of the PINTSEL
> > register, the problem is that the decription of the register and the
> bit
> > explenations are different.
>
> I have spend a hour on this now and I will try some
> more tonight at home, I have to do some work :-)
> As far as I can tell you, the description is not
> correct but table 35 seems to be correct.
> "PINTSEL" is not listed in the include files, like
> lpc13xx.h, in cmsis v1p30 v2p00. Strange.
>
> But unfortunally I cannot try this on real silicon
> as I only have a lpcxpresso board with a lpc1343 on
> it. The um10375 does not show anything about "PINTSEL"
> at all. But um10524 does and that is for a different
> microcontroller that I do not have.
>
> roelof
>
>



I just got reply about the issue from NXP support.

Your inquiry is resolved for your case 00006235: Conflicting definitions of PINTSEL in LPC1315_16_17_45_46_47 UM10524
Solution answer:

The Table (35) is incorrect. So follow the text. A correct table is published in the LPC11U24 UM page 31 at: http://www.nxp.com/documents/user_manual/UM10462.pdf
Also the example code bundle, file gpio.c (http://www.lpcware.com/modules/pubdlcnt/pubdlcnt.php?file=http://www.lpcware.com/sites/default/files/LPC1315_16_17_45_46_47_SampleSoftware.v101.zip&nid62) shows the correct handling of the registers.
My question was:
--------------------------
In LPC1315_16_17_45_46_47 UM10524 (17 Feb.2012)
section 3.5.30 page 27/28 there is a description of the PINTSEL register, the problem is that
the description of the register and the bit explanations are different.

This is what the text description says (end of page 27):
To select a pin for any of the eight pin interrupts, *write the pin number as 0 to 23 for pins
PIO0_0 to PIO0_23 and 24 to 55 for pins PIO1_0 to PIO1_31 to the INTPIN bits*.
For example, setting INTPIN to 0x5 in PINTSEL0 selects pin PIO0_5 for pin interrupt 0.
Setting INTPIN in PINTSEL7 to 0x32 (pin 50) selects pin PIO1_26 for pin interrupt 7.

And this is what the bit description says (table 35 page 28):
GPIO Pin Interrupt Select register (PINTSEL, address 0x4004 8178) bit description:
b4:0 INTPIN Pin number within the port selected by the PORTSEL 0 bit in this register.
b5 PORTSEL Select the port for the pin number to be selected in the 0 INTPIN bits of this
register, 0=Port 0 and 1=Port 1

So according to the bit description of the register to select PIO1_26 you have to use
(1UL<<5) | 26 which results in 0x3A (decimal 58)

Which of two definitions is the correct one?
Based on the first for PIO1_26 we have to use 0x32 and based on the second 0x3A.
Also based on the first definition INTPIN is six bit long b0:5 when table 34 shows it as 5 bit long b0:4



This thread was originally for the wrong definition of the PINTSEL bits in the LPC1311_13_42_43 user manual.

I have noticed that the user manuals of LPC11Exx and LPC11Uxx have the correct definition for the PINTSEL register like
Bit Symbol Description
5:0 INTPIN Pin number select for pin interrupt. (P0_0 to P0_23 correspond to numbers 0 to 23 and PIO1_0 to PIO1_31 correspond to numbers 24 to 55).
31:6- Reserved

Now the LPC11Axx user manual seems to have the wrong definition again
Bit Symbol Description
4:0 INTPIN The pin number within the port identified by the INTPORT field.
5 INTPORT Select the port: 0 = P0 pin. 1 = P1 pin.
31:6-Reserved

I haven't opened a new support ticket about this but based on the previous suggestion I have checked the LPC11Axx code bundle and in the gpio.c the register is set using
if ( portNum )
{
LPC_SYSCON->PINSEL[0] = bitPosi + 32;
}
else
{
LPC_SYSCON->PINSEL[0] = bitPosi;
}

I think this proves that the LPC11Axx UM definition for PINTSEL is indeed wrong but I wonder if anyone can verify this.

Please note that the PINTSEL register is defined as PINSEL (missing a T) in LPC13Uxx.h and LPC11Axx.h while it is correctly named PINTSEL in LPC11Exx.h and LPC11Uxx.h.

Alex
----- Original Message -----
From: Alexan_e
To: l...
Sent: Tuesday, May 01, 2012 2:35 PM
Subject: Re: [lpc2000] LPC1311_13_42_43 PINTSEL description problem

I just got reply about the issue from NXP support.

Your inquiry is resolved for your case 00006235: Conflicting definitions of PINTSEL in LPC1315_16_17_45_46_47 UM10524
Solution answer:

The Table (35) is incorrect. So follow the text. A correct table is published in the LPC11U24 UM page 31 at: http://www.nxp.com/documents/user_manual/UM10462.pdf
Also the example code bundle, file gpio.c (http://www.lpcware.com/modules/pubdlcnt/pubdlcnt.php?file=http://www.lpcware.com/sites/default/files/LPC1315_16_17_45_46_47_SampleSoftware.v101.zip&nid62) shows the correct handling of the registers.

My question was:
----------------------
In LPC1315_16_17_45_46_47 UM10524 (17 Feb.2012)
section 3.5.30 page 27/28 there is a description of the PINTSEL register, the problem is that
the description of the register and the bit explanations are different.

This is what the text description says (end of page 27):
To select a pin for any of the eight pin interrupts, *write the pin number as 0 to 23 for pins
PIO0_0 to PIO0_23 and 24 to 55 for pins PIO1_0 to PIO1_31 to the INTPIN bits*.
For example, setting INTPIN to 0x5 in PINTSEL0 selects pin PIO0_5 for pin interrupt 0.
Setting INTPIN in PINTSEL7 to 0x32 (pin 50) selects pin PIO1_26 for pin interrupt 7.

And this is what the bit description says (table 35 page 28):
GPIO Pin Interrupt Select register (PINTSEL, address 0x4004 8178) bit description:
b4:0 INTPIN Pin number within the port selected by the PORTSEL 0 bit in this register.
b5 PORTSEL Select the port for the pin number to be selected in the 0 INTPIN bits of this
register, 0=Port 0 and 1=Port 1

So according to the bit description of the register to select PIO1_26 you have to use
(1UL<<5) | 26 which results in 0x3A (decimal 58)

Which of two definitions is the correct one?
Based on the first for PIO1_26 we have to use 0x32 and based on the second 0x3A.
Also based on the first definition INTPIN is six bit long b0:5 when table 34 shows it as 5 bit long b0:4





Actually I realized today that the LPC11Axx chips have 32 pins in port 0 unlike the 24 pins of LPC1315_16_17 so this means that
the actual value of PINTSEL will be exactly the same using both definitions of the PINTSEL register.

For example for port1 pin 5 (P1.5)

The first way is PINTSEL[x] = (1UL<<5) | 5 = 0x25

And the second way as used in the examples is PINTSEL[x] = 32+5 = 0x25

So I guess that even though the definition seems to be wrong the result is the same either way so it doesn't matter.

Alex

On 27/5/2012 02:54, Alexan_e wrote:
>
> This thread was originally for the wrong definition of the PINTSEL bits in the LPC1315_16 user manual.
>
> I have noticed that the user manuals of LPC11Exx and LPC11Uxx have the correct definition for the PINTSEL register like
> Bit Symbol Description
> 5:0 INTPIN Pin number select for pin interrupt. (P0_0 to P0_23 correspond to numbers 0 to 23 and PIO1_0 to PIO1_31 correspond to
> numbers 24 to 55).
> 31:6- Reserved
>
> Now the LPC11Axx user manual seems to have the wrong definition again
> Bit Symbol Description
> 4:0 INTPIN The pin number within the port identified by the INTPORT field.
> 5 INTPORT Select the port: 0 = P0 pin. 1 = P1 pin.
> 31:6-Reserved
>
> I haven't opened a new support ticket about this but based on the previous suggestion I have checked the LPC11Axx code bundle
> and in the gpio.c the register is set using
> if ( portNum )
> {
> LPC_SYSCON->PINSEL[0] = bitPosi + 32;
> }
> else
> {
> LPC_SYSCON->PINSEL[0] = bitPosi;
> }
>
> I think this proves that the LPC11Axx UM definition for PINTSEL is indeed wrong but I wonder if anyone can verify this.
>
> Please note that the PINTSEL register is defined as PINSEL (missing a T) in LPC13Uxx.h and LPC11Axx.h while it is correctly
> named PINTSEL in LPC11Exx.h and LPC11Uxx.h.
>
> Alex
>
> ----- Original Message -----
> From: Alexan_e
> To: l...
> Sent: Tuesday, May 01, 2012 2:35 PM
> Subject: Re: [lpc2000] LPC1311_13_42_43 PINTSEL description problem
>
> I just got reply about the issue from NXP support.
>
> Your inquiry is resolved for your case 00006235: Conflicting definitions of PINTSEL in LPC1315_16_17_45_46_47 UM10524
> Solution answer:
>
> The Table (35) is incorrect. So follow the text. A correct table is published in the LPC11U24 UM page 31 at:
> http://www.nxp.com/documents/user_manual/UM10462.pdf
> Also the example code bundle, file gpio.c
> (http://www.lpcware.com/modules/pubdlcnt/pubdlcnt.php?file=http://www.lpcware.com/sites/default/files/LPC1315_16_17_45_46_47_SampleSoftware.v101.zip&nid62
> )
> shows the correct handling of the registers.
>
> My question was:
> ----------------------
> In LPC1315_16_17_45_46_47 UM10524 (17 Feb.2012)
> section 3.5.30 page 27/28 there is a description of the PINTSEL register, the problem is that
> the description of the register and the bit explanations are different.
>
> This is what the text description says (end of page 27):
> To select a pin for any of the eight pin interrupts, *write the pin number as 0 to 23 for pins
> PIO0_0 to PIO0_23 and 24 to 55 for pins PIO1_0 to PIO1_31 to the INTPIN bits*.
> For example, setting INTPIN to 0x5 in PINTSEL0 selects pin PIO0_5 for pin interrupt 0.
> Setting INTPIN in PINTSEL7 to 0x32 (pin 50) selects pin PIO1_26 for pin interrupt 7.
>
> And this is what the bit description says (table 35 page 28):
> GPIO Pin Interrupt Select register (PINTSEL, address 0x4004 8178) bit description:
> b4:0 INTPIN Pin number within the port selected by the PORTSEL 0 bit in this register.
> b5 PORTSEL Select the port for the pin number to be selected in the 0 INTPIN bits of this
> register, 0=Port 0 and 1=Port 1
>
> So according to the bit description of the register to select PIO1_26 you have to use
> (1UL<<5) | 26 which results in 0x3A (decimal 58)
>
> Which of two definitions is the correct one?
> Based on the first for PIO1_26 we have to use 0x32 and based on the second 0x3A.
> Also based on the first definition INTPIN is six bit long b0:5 when table 34 shows it as 5 bit long b0:4
>
>
>
>
--
Alex
---------------------
http://alexan.edaboard.eu/ (Home of ARMwizard, a free tool for peripheral initialization of LPC2xxx/17xx/13xx/11xx microcontrollers )