Page 1 of 1

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

Posted: Sun Aug 25, 2019 3:28 am
by mad_ady
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?

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

Posted: Mon Aug 26, 2019 10:14 am
by odroid
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?

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

Posted: Mon Aug 26, 2019 1:03 pm
by mad_ady
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.

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

Posted: Mon Aug 26, 2019 7:04 pm
by odroid
It seems to be possible.

We will check whether we can change the Rx/Tx function to GPIOs or not.

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

Posted: Tue Aug 27, 2019 2:43 pm
by odroid
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

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

Posted: Tue Aug 27, 2019 7:18 pm
by mad_ady
Thank you, I'll try it next week hopefully!

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

Posted: Fri Aug 30, 2019 11:23 pm
by mad_ady
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

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

Posted: Wed Sep 04, 2019 1:43 pm
by odroid
Added the new item to this WiKi page.
https://wiki.odroid.com/odroid-xu4/trou ... ose_io_pin