[SOLVED] Using the console rx/tx pins on XU4/HC1/2 as standard GPIO pins

Post Reply
User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

[SOLVED] Using the console rx/tx pins on XU4/HC1/2 as standard GPIO pins

Unread post by mad_ady » Sun Aug 25, 2019 3:28 am

I may need a gpio pin on a HC2 to attach an IR blaster to, so I thought to myself, why not repurpose rx/tx pins from the serial port for the job? I already know you can disable the serial port from both uboot and kernel as documented on the wiki, but can you change the pin role and demote it to gpio via dtb changes? Or are they wired to uart blocks and their purpose can't be changed?
Last edited by mad_ady on Fri Aug 30, 2019 11:24 pm, edited 1 time in total.

User avatar
odroid
Site Admin
Posts: 32130
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 119 times
Been thanked: 292 times
Contact:

Re: Using the console rx/tx pins on XU4/HC1/2 as standard GPIO pins

Unread post by odroid » Mon Aug 26, 2019 10:14 am

It seems to be a good idea for HC1/HC2 users.
We never thought about it. I think the Rx/Tx pins can be used as GPIO.

Because the output power from the 4-pin connector is only 1.8V, the actual usability quite limited.
Do you know any IR LED can work with 1.5~1.8V power instead of 3.0~3.3V?

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Using the console rx/tx pins on XU4/HC1/2 as standard GPIO pins

Unread post by mad_ady » Mon Aug 26, 2019 1:03 pm

Well, my circuit uses a transistor with the base hooked up to the gpio through a resistor and the transistor emmiter connected to gnd, while the collector is in series with the IR led and connected to 5V.
Now that you mention it - I assumed I could get 5V from the UART as well, but I don't have 5V there...

Ok, change of plans (though I need to do more research). Could I hook up a reed switch to one of the pins? One end would be connected to 1.8V and the other to a gpio.

User avatar
odroid
Site Admin
Posts: 32130
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 119 times
Been thanked: 292 times
Contact:

Re: Using the console rx/tx pins on XU4/HC1/2 as standard GPIO pins

Unread post by odroid » Mon Aug 26, 2019 7:04 pm

It seems to be possible.

We will check whether we can change the Rx/Tx function to GPIOs or not.
These users thanked the author odroid for the post:
mad_ady (Mon Aug 26, 2019 7:11 pm)

User avatar
odroid
Site Admin
Posts: 32130
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 119 times
Been thanked: 292 times
Contact:

Re: Using the console rx/tx pins on XU4/HC1/2 as standard GPIO pins

Unread post by odroid » Tue Aug 27, 2019 2:43 pm

You don't need to disable the Rx/Tx function by editing/compiling device-tree file.
Just export the GPIO and it will work.

Code: Select all

UART2.RXD - GPA1.0 - 179(GPIO Export Number) - CON1.3
UART2.TXD - GPA1.1 - 180(GPIO Export Number) - CON1.2
Once you export it, you can check it via cat /sys/kernel/debug/gpio
These users thanked the author odroid for the post:
mad_ady (Tue Aug 27, 2019 7:18 pm)

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Using the console rx/tx pins on XU4/HC1/2 as standard GPIO pins

Unread post by mad_ady » Tue Aug 27, 2019 7:18 pm

Thank you, I'll try it next week hopefully!

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Using the console rx/tx pins on XU4/HC1/2 as standard GPIO pins

Unread post by mad_ady » Fri Aug 30, 2019 11:23 pm

Thanks odroid! I can confirm that I can control the two pins from sysfs as you mentioned. You might want to add this information to the HC1/2/XU4 wiki for people with desperate need of a GPIO :)
I will need to figure out what I can use for power - for HC1/2 one can get 5V from the SATA pins. It shouldn't be hard to solder a wire to a sata pin.
Image

User avatar
odroid
Site Admin
Posts: 32130
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 119 times
Been thanked: 292 times
Contact:

Re: [SOLVED] Using the console rx/tx pins on XU4/HC1/2 as standard GPIO pins

Unread post by odroid » Wed Sep 04, 2019 1:43 pm

Added the new item to this WiKi page.
https://wiki.odroid.com/odroid-xu4/trou ... ose_io_pin
These users thanked the author odroid for the post:
mad_ady (Wed Sep 04, 2019 2:43 pm)

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 2 guests