configuring I2C pins(5.2&5.3) as GPIO but not working

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

configuring I2C pins(5.2&5.3) as GPIO but not working

1,890 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Iyyappan on Mon Jan 11 23:39:01 MST 2016
Hi,

I am new to LPC1788.I need to use the I2C pins(5.2 & 5.3) as a GPIO on LPC1788 controller as given below.

Pinsel_ConfigPin(5,2,0);
Pinsel_ConfigPin(5,3,0);
GPIO_SetDir(5,(1<<2),1);//configured as output
GPIO_SetDir(5,(1<<2),1);//configured as output

I'm using this pins for External ADC.
while checking the User manual it says,
"For non-I2C operation, these pins remain open-drain and can only drive low,
regardless of how HS and HIDRIVE are set. They would typically be used with an
external pull-up resistor if they are used as outputs unless they are used only to sink
current. Leave HS = 1 and HIDRIVE = 0 (if applicable) to maximize compatibility with
other GPIO pins."

after adding Pull-Up register it remains low.
Labels (1)
0 Kudos
Reply
6 Replies

1,790 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by serge on Wed Jan 13 01:08:25 MST 2016
What is the value of the external resistor to VCC? As stated this is a true open-drain output.

As per datasheet:
Quote:
Open-drain 5 V tolerant digital I/O pad, compatible with I2C-bus 1 MHz specification.
It [u]requires[/u] an external pull-up to provide output functionality.

0 Kudos
Reply

1,790 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Tue Jan 12 04:57:49 MST 2016

Quote: Iyyappan
But it is in always low state only.whether i'm giving high or low the state of the pin is always low...



Then use the debugger to check PCONP, IOCON and Port settings  :O


0 Kudos
Reply

1,790 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Iyyappan on Tue Jan 12 04:18:12 MST 2016
hi ,

I need that the pin(5[2]) is always high.But it is in always low state only.whether i'm giving high or low the state of the pin is always low.please help me out with this problem.
0 Kudos
Reply

1,790 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Tue Jan 12 01:14:44 MST 2016

Quote: Iyyappan

 PDWN_SET//(5[2]) It is always high



And what's happening if you switch it 'always low' ?
0 Kudos
Reply

1,790 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Iyyappan on Tue Jan 12 01:05:41 MST 2016
Hi R2D2,
                thanks for the immediate response.yes.already did it.

   PDWN_CLR//low(5[2])
   Delay(100);
   PDWN_SET//(5[2]) It is always high

but still now I'm having the same response(its low but not going to high)..Is there any other way to make it work??
0 Kudos
Reply

1,790 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Tue Jan 12 00:04:20 MST 2016
Did you switch P5[2] / P5[3] high or low  :quest:
0 Kudos
Reply