EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

GPIO read gives wrong value in 17xx

Started by prab...@yahoo.co.in April 13, 2010
hi all,
Is any one facing following Issue?

I have set some gpios(leds).LEDs are on.But if i read that gpio value means
it gives value 1.I have set 15th bit of PCONP also.So i am suspecting
gpio reads(FIOPIN register)???i am using lpc17xx.h from FreeRTOSdemo code.

any idea about what wrong in this issue???
Thank

An Engineer's Guide to the LPC2100 Series

hi all,
after configuring,setting gpios,if i read that pin suddenly means it gives wrong value.Again read means it gives correct value.i think It takes two or more instruction cycle to update pin value in to this register.Anyone facing this issue???any ideas?

Thanks,

________________________________
From: "p...@yahoo.co.in"
To: l...
Sent: Tue, 13 April, 2010 1:06:07 PM
Subject: [lpc2000] GPIO read gives wrong value in 17xx

hi all,
Is any one facing following Issue?

I have set some gpios(leds). LEDs are on.But if i read that gpio value means
it gives value 1.I have set 15th bit of PCONP also.So i am suspecting
gpio reads(FIOPIN register)??? i am using lpc17xx.h from FreeRTOSdemo code.

any idea about what wrong in this issue???
Thank

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php
Hi:

I'm using the LPC1752 and I haven't have any trouble reading /setting the GPIO pins:

To read a GPIO pin:

uint32_t GPIO_P0_0_RX_Read(void)
{
uint32_t result;

// Read current value
if((LPC_GPIO0->FIOPIN & (1UL << 0)))
{
result = TRUE;
}
else
{
result = FALSE;
}

return (result);
}

To set HIGH pin:

void GPIO_P0.1_High(void)
{
LPC_GPIO0->FIOSET |= (1UL << 1);
}

To set LOW pin:

void GPIO_P0.1_Low(void)
{
LPC_GPIO0->FIOCLR |= (1UL << 1);
}

Maybe there is a problem in the input signal hardware that delays the signal?

Regards,

Alex

--- In l..., pra bu wrote:
>
> hi all,
> after configuring,setting gpios,if i read that pin suddenly means it gives wrong value.Again read means it gives correct value.i think It takes two or more instruction cycle to update pin value in to this register.Anyone facing this issue???any ideas?
>
> Thanks,
> ________________________________
> From: "prabuisin@..."
> To: l...
> Sent: Tue, 13 April, 2010 1:06:07 PM
> Subject: [lpc2000] GPIO read gives wrong value in 17xx
>
>
> hi all,
> Is any one facing following Issue?
>
> I have set some gpios(leds). LEDs are on.But if i read that gpio value means
> it gives value 1.I have set 15th bit of PCONP also.So i am suspecting
> gpio reads(FIOPIN register)??? i am using lpc17xx.h from FreeRTOSdemo code.
>
> any idea about what wrong in this issue???
> Thank
>
>
>
> Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php
>

Hi,

> To set HIGH pin:
>
> void GPIO_P0.1_High(void)
> {
> LPC_GPIO0->FIOSET |= (1UL << 1);
> }

NO. Not '|=', just '='.

>
> To set LOW pin:
>
> void GPIO_P0.1_Low(void)
> {
> LPC_GPIO0->FIOCLR |= (1UL << 1);
> }

Ditto.

> Maybe there is a problem in the input signal hardware that delays the
> signal?

Maybe this part of the user manual should be in florescent orange, or
there should be the concept of "write only" in C?

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks V2 is out for LPC1700, LPC3100, LPC3200, SAM9, and more!
Maybe there is a problem in the input signal hardware that delays the signal?
We are using same board design for both lpc1764 and lpc2364.Do we need to
change crystal for lpc1764 board ??? or any other thing in board ???

Thanks,
________________________________
From: alexander_ribero
To: l...
Sent: Wed, 14 April, 2010 11:12:12 PM
Subject: [lpc2000] Re: GPIO read gives wrong value in 17xx

Hi:

I'm using the LPC1752 and I haven't have any trouble reading /setting the GPIO pins:

To read a GPIO pin:

uint32_t GPIO_P0_0_RX_ Read(void)
{
uint32_t result;

// Read current value
if((LPC_GPIO0- >FIOPIN & (1UL << 0)))
{
result = TRUE;
}
else
{
result = FALSE;
}

return (result);
}

To set HIGH pin:

void GPIO_P0.1_High( void)
{
LPC_GPIO0->FIOSET |= (1UL << 1);
}

To set LOW pin:

void GPIO_P0.1_Low( void)
{
LPC_GPIO0->FIOCLR |= (1UL << 1);
}

Maybe there is a problem in the input signal hardware that delays the signal?

Regards,

Alex

--- In lpc2000@yahoogroups .com, pra bu wrote:
>
> hi all,
> after configuring, setting gpios,if i read that pin suddenly means it gives wrong value.Again read means it gives correct value.i think It takes two or more instruction cycle to update pin value in to this register.Anyone facing this issue???any ideas?
>
> Thanks,
> ____________ _________ _________ __
> From: "prabuisin@. .."
> To: lpc2000@yahoogroups .com
> Sent: Tue, 13 April, 2010 1:06:07 PM
> Subject: [lpc2000] GPIO read gives wrong value in 17xx
> hi all,
> Is any one facing following Issue?
>
> I have set some gpios(leds). LEDs are on.But if i read that gpio value means
> it gives value 1.I have set 15th bit of PCONP also.So i am suspecting
> gpio reads(FIOPIN register)??? i am using lpc17xx.h from FreeRTOSdemo code.
>
> any idea about what wrong in this issue???
> Thank
>
> Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger. yahoo.com/ download. php
>

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php
Hi all,
Here is my observations.

Test case 1:(With optimization - Os)

Step 1:
I have configured any one
GPIO(ex.P0.1) as Output.
Step 2:
Set that GPIO as High.
Step 3:
Read that GPIO and Print the
GPIO value using printf().Here GPIO value is 0.This is wrong.
Step 4:
Again read that GPIO and Print the
GPIO value using printf().Here GPIO value is 1.This is correct.

Test case 2:(With optimization - O0)

Step 1:
I have configured any one
GPIO(ex.P0.1) as Output.
Step 2:
Set that GPIO as High.
Step 3:
Read that GPIO and Print the
GPIO value using printf().Here GPIO value is 1.This is correct
Step 4:
Again read that GPIO and Print the
GPIO value using printf().Here GPIO value is 1.This also correct.

I have checked assembly code of these test cases.There is no issue
in code generation.

I have also tested same test cases on LPC2364.I couldn't see this Issue.

So This is not compiler related Issue.

Do we need to configure any registers? Is this expected behavior??if so,why we
didn't see this issue in LPC2364?

My setup(both 2364 and 1764):

Oscillator clock(Crystal) = 24 MHZ.
PLL0
Output clock = 288 MHZ.
CPU
clock
= 48 MHZ.

PCLK
= 12 MHZ.

PCLKSEL0,1
= 0 ;

FYI:We are using same HW board design for both LPC.One board is with LPC2364 and other
board is with LPC1764.

Thanks,

________________________________
From: pra bu
To: l...
Sent: Thu, 15 April, 2010 3:26:21 PM
Subject: Re: [lpc2000] Re: GPIO read gives wrong value in 17xx

Maybe there is a problem in the input signal hardware that delays the signal?
We are using same board design for both lpc1764 and lpc2364.Do we need to
change crystal for lpc1764 board ??? or any other thing in board ???

Thanks,
________________________________
From: alexander_ribero
To: lpc2000@yahoogroups .com
Sent: Wed, 14 April, 2010 11:12:12 PM
Subject: [lpc2000] Re: GPIO read gives wrong value in 17xx

Hi:

I'm using the LPC1752 and I haven't have any trouble reading /setting the GPIO pins:

To read a GPIO pin:

uint32_t GPIO_P0_0_RX_ Read(void)
{
uint32_t result;

// Read current value
if((LPC_GPIO0- >FIOPIN & (1UL << 0)))
{
result = TRUE;
}
else
{
result = FALSE;
}

return (result);
}

To set HIGH pin:

void GPIO_P0.1_High( void)
{
LPC_GPIO0->FIOSET |= (1UL << 1);
}

To set LOW pin:

void GPIO_P0.1_Low( void)
{
LPC_GPIO0->FIOCLR |= (1UL << 1);
}

Maybe there is a problem in the input signal hardware that delays the signal?

Regards,

Alex

--- In lpc2000@yahoogroups .com, pra bu wrote:
>
> hi all,
> after configuring, setting gpios,if i read that pin suddenly means it gives wrong value.Again read means it gives correct value.i think It takes two or more instruction cycle to update pin value in to this register.Anyone facing this issue???any ideas?
>
> Thanks,
> ____________ _________ _________ __
> From: "prabuisin@. .."
> To: lpc2000@yahoogroups .com
> Sent: Tue, 13 April, 2010 1:06:07 PM
> Subject: [lpc2000] GPIO read gives wrong value in 17xx
> hi all,
> Is any one facing following Issue?
>
> I have set some gpios(leds). LEDs are on.But if i read that gpio value means
> it gives value 1.I have set 15th bit of PCONP also.So i am suspecting
> gpio reads(FIOPIN register)??? i am using lpc17xx.h from FreeRTOSdemo code.
>
> any idea about what wrong in this issue???
> Thank
>
> Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger. yahoo.com/ download. php
>
Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger. yahoo.com/ download. php

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php
So, did you fix the bug in your program related to FIOSET and FIOCLR before posting?

Reading the PIN value will return what’s sensed at the pin. Did you account for the write buffer on the CM3?

Questions, I know… And you should post a complete program, not just a fragment.

-- Paul.

From: l... [mailto:l...] On Behalf Of pra bu
Sent: 15 April 2010 12:01
To: l...
Subject: Re: [lpc2000] Re: GPIO read gives wrong value in 17xx(it needs delay)

Hi all,
Here is my observations.

Test case 1:(With optimization - Os)

Step 1:
I have configured any one GPIO(ex.P0.1) as Output.
Step 2:
Set that GPIO as High.
Step 3:
Read that GPIO and Print the GPIO value using printf().Here GPIO value is 0.This is wrong.
Step 4:
Again read that GPIO and Print the GPIO value using printf().Here GPIO value is 1.This is correct.

Test case 2:(With optimization - O0)

Step 1:
I have configured any one GPIO(ex.P0.1) as Output.
Step 2:
Set that GPIO as High.
Step 3:
Read that GPIO and Print the GPIO value using printf().Here GPIO value is 1.This is correct
Step 4:
Again read that GPIO and Print the GPIO value using printf().Here GPIO value is 1.This also correct.

I have checked assembly code of these test cases.There is no issue
in code generation.

I have also tested same test cases on LPC2364.I couldn't see this Issue.

So This is not compiler related Issue.

Do we need to configure any registers? Is this expected behavior??if so,why we didn't see this issue in LPC2364?

My setup(both 2364 and 1764):

Oscillator clock(Crystal) = 24 MHZ.
PLL0 Output clock = 288 MHZ.
CPU clock = 48 MHZ.
PCLK = 12 MHZ.
PCLKSEL0,1 = 0 ;

FYI:We are using same HW board design for both LPC.One board is with LPC2364 and other
board is with LPC1764.

Thanks,

_____

From: pra bu
To: l...
Sent: Thu, 15 April, 2010 3:26:21 PM
Subject: Re: [lpc2000] Re: GPIO read gives wrong value in 17xx

Maybe there is a problem in the input signal hardware that delays the signal?

We are using same board design for both lpc1764 and lpc2364.Do we need to
change crystal for lpc1764 board ??? or any other thing in board ???

Thanks,

_____

From: alexander_ribero
To: lpc2000@yahoogroups .com
Sent: Wed, 14 April, 2010 11:12:12 PM
Subject: [lpc2000] Re: GPIO read gives wrong value in 17xx

Hi:

I'm using the LPC1752 and I haven't have any trouble reading /setting the GPIO pins:

To read a GPIO pin:

uint32_t GPIO_P0_0_RX_ Read(void)
{
uint32_t result;

// Read current value
if((LPC_GPIO0- >FIOPIN & (1UL << 0)))
{
result = TRUE;
}
else
{
result = FALSE;
}

return (result);
}

To set HIGH pin:

void GPIO_P0.1_High( void)
{
LPC_GPIO0->FIOSET |= (1UL << 1);
}

To set LOW pin:

void GPIO_P0.1_Low( void)
{
LPC_GPIO0->FIOCLR |= (1UL << 1);
}

Maybe there is a problem in the input signal hardware that delays the signal?

Regards,

Alex

--- In lpc2000@yahoogroups .com, pra bu wrote:
>
> hi all,
> after configuring, setting gpios,if i read that pin suddenly means it gives wrong value.Again read means it gives correct value.i think It takes two or more instruction cycle to update pin value in to this register.Anyone facing this issue???any ideas?
>
> Thanks,
> ____________ _________ _________ __
> From: "prabuisin@. .."
> To: lpc2000@yahoogroups .com
> Sent: Tue, 13 April, 2010 1:06:07 PM
> Subject: [lpc2000] GPIO read gives wrong value in 17xx
> hi all,
> Is any one facing following Issue?
>
> I have set some gpios(leds). LEDs are on.But if i read that gpio value means
> it gives value 1.I have set 15th bit of PCONP also.So i am suspecting
> gpio reads(FIOPIN register)??? i am using lpc17xx.h from FreeRTOSdemo code.
>
> any idea about what wrong in this issue???
> Thank
>
> Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger. yahoo.com/ download. php
>
Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger. yahoo.com/ download. php
Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php
Hi ,
here is my code.

#define GPIO0_SET(n) (GPIO0->FIOSET |= (1 << (n)))
#define GPIO0_CLR(n) (GPIO0->FIOCLR |= (1 << (n)))
#define GPIO0_DIR_OUT(n) (GPIO0->FIODIR |= (1 << (n)))
#define GPIO0_MASK(n) (GPIO0->FIOMASK &= ~(1 << (n)))

void testGPIO()
{
/* Have already set 15th bit of PCONP,pinsel regsiter for gpio*/
GPIO0_DIR_OUT(0);
GPIO0_MASK(0);(tested with setting mask and without setting mask.same result)
GPIO0_SET(0);
dbgprintf("Pin 0.0 Set is:%d\n",GPIO0_READ(0)); gives wrong vale
dbgprintf("Pin 0.0 Set is:%d\n",GPIO0_READ(0));gives correct value
}

Same issue when clear gpio.
So, did you fix the bug in your program related to FIOSET and
FIOCLR before posting?
Ans : still now i didn't this bug.
Did
you account for the write buffer on the CM3?
Ans: not understand
Thanks,
________________________________
From: Paul Curtis
To: l...
Sent: Thu, 15 April, 2010 4:34:22 PM
Subject: RE: [lpc2000] Re: GPIO read gives wrong value in 17xx(it needs delay)

So, did you fix the bug in your program related to FIOSET and
FIOCLR before posting?

Reading the PIN value will return what’s sensed at the pin. Did
you account for the write buffer on the CM3?

Questions, I know… And you should post a complete program, not
just a fragment.

-- Paul.

From:lpc2000@yahoogroups .com
[mailto:lpc2000@ yahoogroups. com] On Behalf Of pra bu
Sent: 15 April 2010 12:01
To: lpc2000@yahoogroups .com
Subject: Re: [lpc2000] Re: GPIO read gives wrong value in 17xx(it needs
delay)

Hi all,
Here is my observations.

Test case 1:(With optimization - Os)

Step 1:
I have configured any one
GPIO(ex.P0.1) as Output.
Step 2:
Set that GPIO as High.
Step 3:
Read that GPIO and Print the
GPIO value using printf().Here GPIO value is 0.This is wrong.
Step 4:
Again read that GPIO and Print the
GPIO value using printf().Here GPIO value is 1.This is correct.

Test case 2:(With optimization - O0)

Step 1:
I have configured any one
GPIO(ex.P0.1) as Output.
Step 2:
Set that GPIO as High.
Step 3:
Read that GPIO and Print the
GPIO value using printf().Here GPIO value is 1.This is correct
Step 4:
Again read that GPIO and Print the
GPIO value using printf().Here GPIO value is 1.This also correct.

I have checked assembly code of these test cases.There is no issue
in code generation.

I have also tested same test cases on LPC2364.I couldn't see this Issue.

So This is not compiler related Issue.

Do we need to configure any registers? Is this expected behavior??if so,why we
didn't see this issue in LPC2364?

My setup(both 2364 and 1764):

Oscillator clock(Crystal) = 24 MHZ.
PLL0
Output clock = 288 MHZ.
CPU
clock
= 48 MHZ.

PCLK
= 12 MHZ.

PCLKSEL0,1
= 0 ;

FYI:We are using same HW board design for both LPC.One board is with LPC2364
and other
board is with LPC1764.

Thanks,

________________________________

From:pra bu

To: lpc2000@yahoogroups .com
Sent: Thu, 15 April, 2010 3:26:21 PM
Subject: Re: [lpc2000] Re: GPIO read gives wrong value in 17xx

Maybe there is a problem in the input signal hardware that
delays the signal?
We are using same
board design for both lpc1764 and lpc2364.Do we need to
change crystal for lpc1764 board ??? or any other thing in board ???

Thanks,

________________________________

From:alexander_ribero

To: lpc2000@yahoogroups .com
Sent: Wed, 14 April, 2010 11:12:12 PM
Subject: [lpc2000] Re: GPIO read gives wrong value in 17xx

Hi:

I'm using the LPC1752 and I haven't have any trouble reading /setting the GPIO
pins:

To read a GPIO pin:

uint32_t GPIO_P0_0_RX_ Read(void)
{
uint32_t result;

// Read current value
if((LPC_GPIO0- >FIOPIN & (1UL << 0)))
{
result = TRUE;
}
else
{
result = FALSE;
}

return (result);
}

To set HIGH pin:

void GPIO_P0.1_High( void)
{
LPC_GPIO0->FIOSET |= (1UL << 1);
}

To set LOW pin:

void GPIO_P0.1_Low( void)
{
LPC_GPIO0->FIOCLR |= (1UL << 1);
}

Maybe there is a problem in the input signal hardware that delays the signal?

Regards,

Alex

--- In lpc2000@yahoogroups
.com, pra bu wrote:
>
> hi all,
> after configuring, setting gpios,if i read that pin suddenly means it
gives wrong value.Again read means it gives correct value.i think It takes two
or more instruction cycle to update pin value in to this register.Anyone facing
this issue???any ideas?
>
> Thanks,
> ____________ _________ _________ __
> From: "prabuisin@. .."
> To: lpc2000@yahoogroups
.com
> Sent: Tue, 13 April, 2010 1:06:07 PM
> Subject: [lpc2000] GPIO read gives wrong value in 17xx
> hi all,
> Is any one facing following Issue?
>
> I have set some gpios(leds). LEDs are on.But if i read that gpio value
means
> it gives value 1.I have set 15th bit of PCONP also.So i am suspecting
> gpio reads(FIOPIN register)??? i am using lpc17xx.h from FreeRTOSdemo
code.
>
> any idea about what wrong in this issue???
> Thank
>
> Send free SMS to your Friends on Mobile from your Yahoo! Messenger.
Download Now! http://messenger.
yahoo.com/ download. php
>

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download
Now! http://messenger.
yahoo.com/ download. php

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download
Now! http://messenger. yahoo.com/ download. php

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php
Il 15/04/2010 13.23, pra bu ha scritto:
Arghhhhh.... you don't read who answer to your questions/problems....
>
> Hi ,
> here is my code.
>
> #define GPIO0_SET(n) (GPIO0->FIOSET |= (1 <<
> (n))) WRONG!!!
#define GPIO0_SET(n) (GPIO0->FIOSET = (1 << (n)))
> #define GPIO0_CLR(n) (GPIO0->FIOCLR |= (1 <<
> (n))) WRONG!!!
#define GPIO0_CLR(n) (GPIO0->FIOCLR = (1 << (n)))
> #define GPIO0_DIR_OUT(n) (GPIO0->FIODIR |= (1 << (n)))
> #define GPIO0_MASK(n) (GPIO0->FIOMASK &= ~(1 << (n)))
> this matters but depends as you write data in the set and clr regs.
>
> void testGPIO()
> {
> /* Have already set 15th bit of PCONP,pinsel regsiter for gpio*/
> GPIO0_DIR_OUT(0);
> GPIO0_MASK(0);(tested with setting mask and without setting
> mask.same result)
> GPIO0_SET(0);
> dbgprintf("Pin 0.0 Set is:%d\n",GPIO0_READ(0)); gives wrong vale
> dbgprintf("Pin 0.0 Set is:%d\n",GPIO0_READ(0));gives correct value
> }
>
> Same issue when clear gpio.
>
> So, did you fix the bug in your program related to FIOSET and FIOCLR
> before posting?
> Ans : still now i didn't this bug.
> Did you account for the write buffer on the CM3?
> Ans: not understand
> Thanks,
>
> *From:* Paul Curtis
> *To:* l...
> *Sent:* Thu, 15 April, 2010 4:34:22 PM
> *Subject:* RE: [lpc2000] Re: GPIO read gives wrong value in 17xx(it
> needs delay)
>
>
>
> So, did you fix the bug in your program related to FIOSET and FIOCLR
> before posting?
>
>
>
> Reading the PIN value will return what’s sensed at the pin. Did you
> account for the write buffer on the CM3?
>
>
>
> Questions, I know… And you should post a complete program, not just a
> fragment.
>
>
>
> -- Paul.
>
>
>
> *From:* lpc2000@yahoogroups .com [mailto:lpc2000@ yahoogroups. com]
> *On Behalf Of *pra bu
> *Sent:* 15 April 2010 12:01
> *To:* lpc2000@yahoogroups .com
> *Subject:* Re: [lpc2000] Re: GPIO read gives wrong value in 17xx(it
> needs delay)
>
>
> Hi all,
> Here is my observations.
>
> Test case 1:(With optimization - Os)
>
> Step 1:
> I have configured any one GPIO(ex.P0.1) as Output.
> Step 2:
> Set that GPIO as High.
> Step 3:
> Read that GPIO and Print the GPIO value using printf().Here
> GPIO value is 0.This is wrong.
> Step 4:
> Again read that GPIO and Print the GPIO value using
> printf().Here GPIO value is 1.This is correct.
>
> Test case 2:(With optimization - O0)
>
> Step 1:
> I have configured any one GPIO(ex.P0.1) as Output.
> Step 2:
> Set that GPIO as High.
> Step 3:
> Read that GPIO and Print the GPIO value using printf().Here
> GPIO value is 1.This is correct
> Step 4:
> Again read that GPIO and Print the GPIO value using
> printf().Here GPIO value is 1.This also correct.
>
> I have checked assembly code of these test cases.There is no issue
> in code generation.
>
> I have also tested same test cases on LPC2364.I couldn't see this Issue.
>
> So This is not compiler related Issue.
>
> Do we need to configure any registers? Is this expected behavior??if
> so,why we didn't see this issue in LPC2364?
>
> My setup(both 2364 and 1764):
>
> Oscillator clock(Crystal) = 24 MHZ.
> PLL0 Output clock = 288 MHZ.
> CPU clock = 48 MHZ.
> PCLK = 12 MHZ.
> PCLKSEL0,1 = 0 ;
>
> FYI:We are using same HW board design for both LPC.One board is with
> LPC2364 and other
> board is with LPC1764.
>
> Thanks,
>
>
>
> *From:* pra bu
> *To:* lpc2000@yahoogroups .com
> *Sent:* Thu, 15 April, 2010 3:26:21 PM
> *Subject:* Re: [lpc2000] Re: GPIO read gives wrong value in 17xx
>
>
>
> Maybe there is a problem in the input signal hardware that delays the
> signal?
>
> We are using same board design for both lpc1764 and lpc2364.Do
> we need to
> change crystal for lpc1764 board ??? or any other thing in board ???
>
> Thanks,
>
>
>
> *From:* alexander_ribero
> *To:* lpc2000@yahoogroups .com
> *Sent:* Wed, 14 April, 2010 11:12:12 PM
> *Subject:* [lpc2000] Re: GPIO read gives wrong value in 17xx
>
>
>
> Hi:
>
> I'm using the LPC1752 and I haven't have any trouble reading /setting
> the GPIO pins:
>
> To read a GPIO pin:
>
> uint32_t GPIO_P0_0_RX_ Read(void)
> {
> uint32_t result;
>
> // Read current value
> if((LPC_GPIO0- >FIOPIN & (1UL << 0)))
> {
> result = TRUE;
> }
> else
> {
> result = FALSE;
> }
>
> return (result);
> }
>
> To set HIGH pin:
>
> void GPIO_P0.1_High( void)
> {
> LPC_GPIO0->FIOSET |= (1UL << 1);
> }
>
> To set LOW pin:
>
> void GPIO_P0.1_Low( void)
> {
> LPC_GPIO0->FIOCLR |= (1UL << 1);
> }
>
> Maybe there is a problem in the input signal hardware that delays the
> signal?
>
> Regards,
>
> Alex
>
> --- In lpc2000@yahoogroups .com ,
> pra bu wrote:
> >
> > hi all,
> > after configuring, setting gpios,if i read that pin suddenly means
> it gives wrong value.Again read means it gives correct value.i think
> It takes two or more instruction cycle to update pin value in to this
> register.Anyone facing this issue???any ideas?
> >
> > Thanks,
> >
> >
> >
> >
> > ____________ _________ _________ __
> > From: "prabuisin@. .."
> > To: lpc2000@yahoogroups .com
> > Sent: Tue, 13 April, 2010 1:06:07 PM
> > Subject: [lpc2000] GPIO read gives wrong value in 17xx
> >
> >
> > hi all,
> > Is any one facing following Issue?
> >
> > I have set some gpios(leds). LEDs are on.But if i read that gpio
> value means
> > it gives value 1.I have set 15th bit of PCONP also.So i am suspecting
> > gpio reads(FIOPIN register)??? i am using lpc17xx.h from
> FreeRTOSdemo code.
> >
> > any idea about what wrong in this issue???
> > Thank
> >
> >
> >
> > Send free SMS to your Friends on Mobile from your Yahoo! Messenger.
> Download Now! http://messenger. yahoo.com/ download. php
>
> >
> Send free SMS to your Friends on Mobile from your Yahoo! Messenger.
> Download Now! http://messenger. yahoo.com/ download. php
> Send free SMS to your Friends on Mobile from your Yahoo! Messenger.
> Download Now! http://messenger. yahoo.com/ download. php
>
> Send free SMS to your Friends on Mobile from your Yahoo! Messenger.
> Download Now! http://messenger.yahoo.com/download.php
>
On 15/04/2010 12:23, pra bu wrote:
> Hi ,
> here is my code.
>
> #define GPIO0_SET(n) (GPIO0->FIOSET |= (1 << (n)))
> #define GPIO0_CLR(n) (GPIO0->FIOCLR |= (1 << (n)))
> #define GPIO0_DIR_OUT(n) (GPIO0->FIODIR |= (1 << (n)))
> #define GPIO0_MASK(n) (GPIO0->FIOMASK &= ~(1 << (n)))
Sorry to say - this thread is getting really boring. You have not taken
the advice already given to you, so why ask again?

I can't wait until you try doing something difficult.
Regards,
Richard.

+ http://www.FreeRTOS.org
Designed for Microcontrollers. More than 7000 downloads per month.

+ http://www.SafeRTOS.com
Certified by T as meeting the requirements for safety related systems.

>
> void testGPIO()
> {
> /* Have already set 15th bit of PCONP,pinsel regsiter for gpio*/
> GPIO0_DIR_OUT(0);
> GPIO0_MASK(0);(tested with setting mask and without setting mask.same result)
> GPIO0_SET(0);
> dbgprintf("Pin 0.0 Set is:%d\n",GPIO0_READ(0)); gives wrong vale
> dbgprintf("Pin 0.0 Set is:%d\n",GPIO0_READ(0));gives correct value
> }
>
> Same issue when clear gpio.
>
>
> So, did you fix the bug in your program related to FIOSET and
> FIOCLR before posting?
> Ans : still now i didn't this bug.
> Did
> you account for the write buffer on the CM3?
> Ans: not understand
>
>
> Thanks,
>
>
> ________________________________
> From: Paul Curtis
> To: l...
> Sent: Thu, 15 April, 2010 4:34:22 PM
> Subject: RE: [lpc2000] Re: GPIO read gives wrong value in 17xx(it needs delay)
>
>
> So, did you fix the bug in your program related to FIOSET and
> FIOCLR before posting?
>
> Reading the PIN value will return what’s sensed at the pin. Did
> you account for the write buffer on the CM3?
>
> Questions, I know… And you should post a complete program, not
> just a fragment.
>
> -- Paul.
>
> From:lpc2000@yahoogroups .com
> [mailto:lpc2000@ yahoogroups. com] On Behalf Of pra bu
> Sent: 15 April 2010 12:01
> To: lpc2000@yahoogroups .com
> Subject: Re: [lpc2000] Re: GPIO read gives wrong value in 17xx(it needs
> delay)
>
>
>
>
> Hi all,
> Here is my observations.
>
> Test case 1:(With optimization - Os)
>
> Step 1:
> I have configured any one
> GPIO(ex.P0.1) as Output.
> Step 2:
> Set that GPIO as High.
> Step 3:
> Read that GPIO and Print the
> GPIO value using printf().Here GPIO value is 0.This is wrong.
> Step 4:
> Again read that GPIO and Print the
> GPIO value using printf().Here GPIO value is 1.This is correct.
>
> Test case 2:(With optimization - O0)
>
> Step 1:
> I have configured any one
> GPIO(ex.P0.1) as Output.
> Step 2:
> Set that GPIO as High.
> Step 3:
> Read that GPIO and Print the
> GPIO value using printf().Here GPIO value is 1.This is correct
> Step 4:
> Again read that GPIO and Print the
> GPIO value using printf().Here GPIO value is 1.This also correct.
>
> I have checked assembly code of these test cases.There is no issue
> in code generation.
>
> I have also tested same test cases on LPC2364.I couldn't see this Issue.
>
> So This is not compiler related Issue.
>
> Do we need to configure any registers? Is this expected behavior??if so,why we
> didn't see this issue in LPC2364?
>
> My setup(both 2364 and 1764):
>
>
> Oscillator clock(Crystal) = 24 MHZ.
> PLL0
> Output clock = 288 MHZ.
> CPU
> clock
> = 48 MHZ.
>
> PCLK
> = 12 MHZ.
>
> PCLKSEL0,1
> = 0 ;
>
> FYI:We are using same HW board design for both LPC.One board is with LPC2364
> and other
> board is with LPC1764.
>
> Thanks,
>
> ________________________________
>
> From:pra bu
>
> To: lpc2000@yahoogroups .com
> Sent: Thu, 15 April, 2010 3:26:21 PM
> Subject: Re: [lpc2000] Re: GPIO read gives wrong value in 17xx
>
>
> Maybe there is a problem in the input signal hardware that
> delays the signal?
> We are using same
> board design for both lpc1764 and lpc2364.Do we need to
> change crystal for lpc1764 board ??? or any other thing in board ???
>
> Thanks,
>
> ________________________________
>
> From:alexander_ribero
>
> To: lpc2000@yahoogroups .com
> Sent: Wed, 14 April, 2010 11:12:12 PM
> Subject: [lpc2000] Re: GPIO read gives wrong value in 17xx
>
>
> Hi:
>
> I'm using the LPC1752 and I haven't have any trouble reading /setting the GPIO
> pins:
>
> To read a GPIO pin:
>
> uint32_t GPIO_P0_0_RX_ Read(void)
> {
> uint32_t result;
>
> // Read current value
> if((LPC_GPIO0- >FIOPIN & (1UL << 0)))
> {
> result = TRUE;
> }
> else
> {
> result = FALSE;
> }
>
> return (result);
> }
>
> To set HIGH pin:
>
> void GPIO_P0.1_High( void)
> {
> LPC_GPIO0->FIOSET |= (1UL << 1);
> }
>
> To set LOW pin:
>
> void GPIO_P0.1_Low( void)
> {
> LPC_GPIO0->FIOCLR |= (1UL << 1);
> }
>
> Maybe there is a problem in the input signal hardware that delays the signal?
>
> Regards,
>
> Alex
>
> --- In lpc2000@yahoogroups
> .com, pra bu wrote:
>>
>> hi all,
>> after configuring, setting gpios,if i read that pin suddenly means it
> gives wrong value.Again read means it gives correct value.i think It takes two
> or more instruction cycle to update pin value in to this register.Anyone facing
> this issue???any ideas?
>>
>> Thanks,
>> ____________ _________ _________ __
>> From: "prabuisin@. .."
>> To: lpc2000@yahoogroups
> .com
>> Sent: Tue, 13 April, 2010 1:06:07 PM
>> Subject: [lpc2000] GPIO read gives wrong value in 17xx
>> hi all,
>> Is any one facing following Issue?
>>
>> I have set some gpios(leds). LEDs are on.But if i read that gpio value
> means
>> it gives value 1.I have set 15th bit of PCONP also.So i am suspecting
>> gpio reads(FIOPIN register)??? i am using lpc17xx.h from FreeRTOSdemo
> code.
>>
>> any idea about what wrong in this issue???
>> Thank
>>
>> Send free SMS to your Friends on Mobile from your Yahoo! Messenger.
> Download Now! http://messenger.
> yahoo.com/ download. php
>>
>
> Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download
> Now! http://messenger.
> yahoo.com/ download. php
>
> Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download
> Now! http://messenger. yahoo.com/ download. php
>
>
>
>
>
> Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php


The 2024 Embedded Online Conference