LPC176x Pins P0.27 [I2C0-SDA0] and P0.28 [I2C0-SCL0] - how to drive as GPIO output?

cancel
Showing results for 
Search instead for 
Did you mean: 

LPC176x Pins P0.27 [I2C0-SDA0] and P0.28 [I2C0-SCL0] - how to drive as GPIO output?

374 Views
NXP Employee
NXP Employee
Content originally posted in LPCWare by teslabox on Wed Mar 23 03:34:32 MST 2016
Hi everyone,

I try to drive pins P0.27 and P0.28 as output (GPIO) in my LPCXpresso LPC1769 Rev. C to control my LCD display but these pins don't change the states. I connected pull-up resistor 10 kOhm from P0.27 and P0.28 to +3,30 V DC (VCC of LPCXpresso PCB) but it gives no changes...
Labels (1)
0 Kudos
6 Replies

45 Views
NXP Employee
NXP Employee
bump
0 Kudos

45 Views
NXP Employee
NXP Employee
Content originally posted in LPCWare by teslabox on Thu Mar 31 11:16:57 MST 2016
Hi everyone after one day!

I changed operations FIOPIN register to FIOSET and FIOCLR registers and it works proper just like that!
I run two LCD 4 lines x 20 characters HD44780 simultaneously/at the same time without any problem.

Thank you very very much!
0 Kudos

45 Views
NXP Employee
NXP Employee
Content originally posted in LPCWare by teslabox on Wed Mar 30 11:29:23 MST 2016

Quote:
Any special reason why don't you use Set and Clear registers  Quest  Puzzled


Some time ago someone (on the another forum) wrote me that this register changing is better and faster (to be honest - I don't have too big experience with FIOPIN & FIOSET/FIOCLR differences).
Maybe tommorow I will try change it to FIOSET and FIOCLR registers.



Quote:
Have you ...

Set the pin functions to GPIO?
Set the pins to output?
Removed any port masking?
Enabled clocking to the GPIO/IO unit?

Provide more details!


I'm just using default settings of pin funtions (default is GPIOs in PINSEL register) in output state as I wrote before.
I'm not using any masking.... and my clock for GPIO/IO is also default value.
0 Kudos

45 Views
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Thu Mar 24 02:44:14 MST 2016
Any special reason why don't you use Set and Clear registers  :quest:  :~

LPC_GPIO0->FIOSET = (1<<27); 

LPC_GPIO0->FIOCLR = (1<<27); 
0 Kudos

45 Views
NXP Employee
NXP Employee
Content originally posted in LPCWare by teslabox on Thu Mar 24 01:33:44 MST 2016
Hi Mike!

Thank You for your reply!


Quote:

Set the pin functions to GPIO?
Set the pins to output?
Removed any port masking?
Enabled clocking to the GPIO/IO unit?

Provide more details!



I'm just doing:

LPC_GPIO0->FIODIR |= (1<<27); // Set pin P0.27 as output pin
LPC_GPIO0->FIODIR |= (1<<28); // Set pin P0.28 as output pin
LPC_GPIO0->FIOPIN |= (1<<27); // Set pin P0.27 (output) in high level, used external pull-up resistor 10 kOhm
LPC_GPIO0->FIOPIN |= (1<<28); // Set pin P0.28 (output) in high level, used external pull-up resistor 10 kOhm

or 

LPC_GPIO0->FIOPIN &=~(1<<27); // Set pin P0.27 (output) in low level, used external pull-up resistor 10 kOhm
LPC_GPIO0->FIOPIN &=~(1<<28); // Set pin P0.28 (output) in low level, used external pull-up resistor 10 kOhm


I have also noticed that my LCD HD44780 works properly at pin configuration:

RS - P0.8
RW - P0.7
EN - P0.6
D4 - P1.30
D5 - P1.31
D6 - P0.21
D7 - P0.22

but if I change pin D4 from P1.30 to P0.2, P0.3, P0.27, P0.28, .... than LCD doesn't work properly
0 Kudos

45 Views
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Wed Mar 23 12:03:06 MST 2016
Have you ...

Set the pin functions to GPIO?
Set the pins to output?
Removed any port masking?
Enabled clocking to the GPIO/IO unit?

Provide more details!
Show the code (and use code tags for God's sake!)
The pin setup and pin change parts.

Otherwise, how can you expect anyone to know what you did wrong?

Cheers, Mike.
0 Kudos