Markus
March 30, 2006, 8:50pm
1
Hello
I’m using a LPC2138. I would like just to set the output port pin P0.3.
To do that, i’ve done the following:
1.) Clear PINSEL0 bit 6 and 7 → Define as GPIO
2.) Set IO0DIR bit 3 → Define as Output
3.) Set IO0SET bit 3 → Set Port0 bit 3
Looks simple. But the port bit is not set!
For sure I’m doing something wrong. But what?
Internaly I’m using Timer0 Match0 to produce a system time tick.
But the function is not used out of the port. Or maybe this a problem?
Thanks for any suggestions.
Markus
P0.3 is also used for SDA, so it’s an open drain output (for I2C compliance).
Open-drain means it can only sink current, not source it, or in other words it can only pull a signal low, not high. You could put an external pull-up on it.
Markus
March 31, 2006, 10:52am
3
Hi
Thank you for this tip. Yes it works with a pullup resistor.
In the User Manual under the topic “Pin description” you can
read the following text:
P0.3/SDA0/MAT0.0/EINT1, 26[3] I/O:
P0.3 — General purpose digital input/output pin
I/O SDA0 — I2C0 data input/output. Open drain output (for I2C compliance)
O MAT0.0 — Match output for Timer 0, channel 0
I EINT1 — External interrupt 1 input
And this can definitely be misunderstood. General purpose
digital input/output pin sounds Push-Pull to me.
Anyway, it works
Markus
So glad I found this post.
I have the same pins not sourcing current properly. Went to town disabling peripherals to make it go.
Indeed the manual was confusing. It seemed like it was an open drain when I2C was enabled.