Configure pin as open drain

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

Configure pin as open drain

1,366 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vinylrider on Tue Nov 10 09:39:35 MST 2015
Hello everyone,

i want to configure P1.27 and P1.28 ( lpc1769 ) as an open drain pins. I have externally used an 4,1kohm resistor as a pull up tied up to 3.3Volts. The problem is that after executing the following code in my multimeter i get always 0volts in both pins but it should be Vdd and GND respectively.
I cannot understand what is my fault! ??? I had configured these two pins as follows.

        LPC_PINCON->PINSEL3 &= ~(0b11<<22);
LPC_PINCON->PINSEL3 &= ~(0b11<<24);

LPC_GPIO1->FIODIR |= 1<<27;
LPC_GPIO1->FIODIR |= 1<<28;


LPC_PINCON->PINMODE_OD1 |= 1<<27;   //open drain
LPC_PINCON->PINMODE_OD1 |= 1<<28;//open drain


LPC_GPIO1->FIOPIN1 |= 1<<27;
LPC_GPIO1->FIOPIN1 &= ~(1<<28);


thank you very much for any help!
0 Kudos
Reply
4 Replies

1,324 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vinylrider on Tue Nov 10 10:56:03 MST 2015

Quote: R2D2

Quote: vinylrider
LPC_GPIO[color=#f00]1[/color]->FIOPIN[color=#f00]1[/color] |= 1<<27;



And what's that  :quest:



That is MY FAULT...THANK YOU !!!

it should be:
LPC_GPIO1->FIOPIN |= 1<<27;


i tested it and now it works just fine as it should!
0 Kudos
Reply

1,324 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Tue Nov 10 10:41:38 MST 2015

Quote: vinylrider
LPC_GPIO[color=#f00]1[/color]->FIOPIN[color=#f00]1[/color] |= 1<<27;



And what's that  :quest:
0 Kudos
Reply

1,324 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vinylrider on Tue Nov 10 10:15:31 MST 2015
sorry i meant
LPC_PINCON->PINSEL3 &= ~(0b11<<22);
LPC_PINCON->PINSEL3 &= ~(0b11<<24);
0 Kudos
Reply

1,324 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Tue Nov 10 10:00:06 MST 2015

Quote: vinylrider

LPC_PINCON->PINSEL3 &= ~([color=#f00]11[/color]<<22);
LPC_PINCON->PINSEL3 &= ~([color=#f00]11[/color]<<24);




What's that  :quest:    :~

0 Kudos
Reply