Using GPIO to pull a signal down

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Using GPIO to pull a signal down

1,964件の閲覧回数
perdrix
Contributor II

I have a signal line that has a 3.3kOhm pull-up resistor to 3.3V.

I running code on an LPC2388 and trying to pull the line down to logic low using an FIO pin.

The IO pins I am using are configured thus:

 

FIO0DIR |= (1<<2);          // P0.2 is output
FIO0DIR |= (1<<3);          // P0.3 is output
FIO0DIR |= (1<<23);         // P0.23 is output
FIO0DIR |= (1<<24);         // P0.24 is output
FIO0DIR |= (1<<25);         // P0.25 is output
FIO0DIR |= (1<<26);         // P0.26 is output
//
// Set all these pins to have neither a pull-up nor a pull-down resistor
//
PINMODE0 |= 0x000000A0;
PINMODE1 |= 0x0AA00000;

 

The problem is that when I use FIOCLR to set the pins to logic zero, the actual voltage I measure is just under 1.4V (1.392V), which is definitely not logic low.

What am I doing wrong please?
Thanks, David

0 件の賞賛
返信
6 返答(返信)

1,923件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

For example, if you want to set/clear P0.2 pin  and use the FIO to access, you can use the code:

SCS|=1<<0; //set SCS[GPIOM]=1 which can access the fast GPIO port
FIO0DIR |= (1<<2);          // P0.2 is output mode
FIO0SET|=1<<2;
FIO0CLR|=1<<2;

Pls have a try

BR

XiangJun Rong

0 件の賞賛
返信

1,916件の閲覧回数
perdrix
Contributor II

I had already set SCS |= 1; (NOT 1<<2 = that is the bit for the EMC).

I am already using FIO0CLR to attempt to pull the line down with the results I described.

0 件の賞賛
返信

1,888件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

If you still fail to set/clear GPIO, pls post all the code so that we can have a review.

BR

XiangJun Rong

0 件の賞賛
返信

1,905件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

When the GPIO is configured as GPIO output mode, the GPIO pin is a push/pull pin, in other words, FIO0SET instruction will set the GPIO pin, FIO0CLR will clear the GPIO pin.

If the pin is in a middle voltage, I suppose that the pin is in input mode.

Pls try the following code and give me a result if the pin can be set or cleared.

BR

XiangJun Rong

SCS|=1<<0; //set SCS[GPIOM]=1 which can access the fast GPIO port
FIO0DIR |= (1<<2);          // P0.2 is output mode
FIO0SET|=1<<2;
FIO0CLR|=1<<2;

 

0 件の賞賛
返信

1,885件の閲覧回数
perdrix
Contributor II

Problem found - earth connection had come adrift!  Sorry to take your time

0 件の賞賛
返信

1,882件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Glad to hear that you have found the cause.

BR

XiangJun Rong

0 件の賞賛
返信