uart to RS485 (TXenable/RTS gpio pin)

Post Reply
hucka
Posts: 3
Joined: Thu Nov 05, 2015 8:28 pm
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

uart to RS485 (TXenable/RTS gpio pin)

Post by hucka »

Hello,
we need small reliable computer with RS485 for our control systems. Odroid-C1+ seems to be perfect for us. But problem is with RS485.

We can not use usb/RS485 converter
(reasons:
1-st: Converter RS485 must by built in one box with computer = conector rs485 must by part of computer case
2-nd: we still do not trust USB to much)

The best solution for us is use UART from gpio pins (create own converter board gpio/RS485). But problem is TX-enable pin (we need half duplex RS485).

My question:
Is it possible to set some gpio pin to generate RTS (TX-enable) signal for UART? (generated by hardware)


Thanks! :)

User avatar
tobetter
Posts: 7775
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 428 times
Been thanked: 1198 times
Contact:

Re: uart to RS485 (TXenable/RTS gpio pin)

Post by tobetter »

hucka wrote:Hello,
we need small reliable computer with RS485 for our control systems. Odroid-C1+ seems to be perfect for us. But problem is with RS485.

We can not use usb/RS485 converter
(reasons:
1-st: Converter RS485 must by built in one box with computer = conector rs485 must by part of computer case
2-nd: we still do not trust USB to much)

The best solution for us is use UART from gpio pins (create own converter board gpio/RS485). But problem is TX-enable pin (we need half duplex RS485).

My question:
Is it possible to set some gpio pin to generate RTS (TX-enable) signal for UART? (generated by hardware)


Thanks! :)
Based on the schematic, #13 for RTS and #15 for CTS could be dedicated for your purpose. But we may need to change .dts for pin configuration and test.

hucka
Posts: 3
Joined: Thu Nov 05, 2015 8:28 pm
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: uart to RS485 (TXenable/RTS gpio pin)

Post by hucka »

Thanks for reply! Could I ask you, how do you estimate your tests? (We need find suitable computer in a short time.)

User avatar
tobetter
Posts: 7775
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 428 times
Been thanked: 1198 times
Contact:

Re: uart to RS485 (TXenable/RTS gpio pin)

Post by tobetter »

hucka wrote:Thanks for reply! Could I ask you, how do you estimate your tests? (We need find suitable computer in a short time.)
I am not able to start the test immediately, but I guess it would be fine to test with two C1+ for cross wiring for RXD-TXD and RTS-CTS.

hucka
Posts: 3
Joined: Thu Nov 05, 2015 8:28 pm
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: uart to RS485 (TXenable/RTS gpio pin)

Post by hucka »

Ok, please let me know tests results as soon as possible :)

User avatar
odroid
Site Admin
Posts: 37371
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1785 times
Been thanked: 1139 times
Contact:

Re: uart to RS485 (TXenable/RTS gpio pin)

Post by odroid »

Change the DT file and the RTS/CTS will work.

Code: Select all

 kernel/arch/arm/boot/dts/meson8b_odroidc.dts 
Before

Code: Select all

                b_uart_pins:b_uart{
                        amlogic,setmask=<4 0x0300>;
                        amlogic,pins="GPIOX_16", "GPIOX_17";
                        amlogic,pullup=<1>;
                        amlogic,pullupen=<1>;
                };
After

Code: Select all

                b_uart_pins:b_uart{
                        amlogic,setmask=<4 0x03C0>;
                        amlogic,pins="GPIOX_16", "GPIOX_17", "GPIOX_18", "GPIOX_19";
                        amlogic,pullup=<1>;
                        amlogic,pullupen=<1>;
                };
Note that RTS/CTS pins can be found in our schematics.
http://www.hardkernel.com/main/products ... &tab_idx=2

Code: Select all

GPIOX.BIT18(UART_CTS_B, Pin# 15),  GPIOX.BIT19(UART_RTS_B , Pin# 13) 

vfperri
Posts: 4
Joined: Thu Apr 25, 2019 5:39 am
languages_spoken: english
ODROIDs: ODROID C1+; ODROID C2; ODROID XU4; ODROID N2
Has thanked: 0
Been thanked: 0
Contact:

Re: uart to RS485 (TXenable/RTS gpio pin)

Post by vfperri »

Hi, is there any way to make some UART of the ODROID C2 work with CTS/RTS enabled? Thanks! Victor

User avatar
odroid
Site Admin
Posts: 37371
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1785 times
Been thanked: 1139 times
Contact:

Re: uart to RS485 (TXenable/RTS gpio pin)

Post by odroid »

Find RTS/CTS signals in the C2 schematics and change DT(DeviceTree) file.
https://dn.odroid.com/S905/Schematic/od ... 171114.pdf

vfperri
Posts: 4
Joined: Thu Apr 25, 2019 5:39 am
languages_spoken: english
ODROIDs: ODROID C1+; ODROID C2; ODROID XU4; ODROID N2
Has thanked: 0
Been thanked: 0
Contact:

Re: uart to RS485 (TXenable/RTS gpio pin)

Post by vfperri »

odroid wrote:
Thu Apr 25, 2019 8:50 am
Find RTS/CTS signals in the C2 schematics and change DT(DeviceTree) file.
https://dn.odroid.com/S905/Schematic/od ... 171114.pdf
I already found the signals in the C2 schematics but don't realize how to change the file.

User avatar
odroid
Site Admin
Posts: 37371
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1785 times
Been thanked: 1139 times
Contact:

Re: uart to RS485 (TXenable/RTS gpio pin)

Post by odroid »

Which pins do you want to use for RTS/CTS?
Did you look into C2 device tree file?

vfperri
Posts: 4
Joined: Thu Apr 25, 2019 5:39 am
languages_spoken: english
ODROIDs: ODROID C1+; ODROID C2; ODROID XU4; ODROID N2
Has thanked: 0
Been thanked: 0
Contact:

Re: uart to RS485 (TXenable/RTS gpio pin)

Post by vfperri »

odroid wrote:
Thu Apr 25, 2019 11:27 am
Which pins do you want to use for RTS/CTS?
Did you look into C2 device tree file?
I want to use GPIOX_14 and GPIOX_15. In the device tree file I found the following:

uart_A: serial@c11084c0 {
compatible = "amlogic, meson-uart";
reg = <0x0 0xc11084c0 0x0 0x14>;
interrupts = <0 26 1>;
status = "okay";
clocks = <&clock CLK_XTAL>;
clock-names = "clk_uart";
fifosize = < 128 >;
pinctrl-names = "default";
pinctrl-0 = <&a_uart_pins>;
};

But I didn't find the "a_uart_pins" definition.

lsc1117
Posts: 222
Joined: Thu Aug 22, 2013 12:46 am
languages_spoken: english
Location: South Korea
Has thanked: 3 times
Been thanked: 27 times
Contact:

Re: uart to RS485 (TXenable/RTS gpio pin)

Post by lsc1117 »

Is this the line you're looking for?
https://github.com/hardkernel/linux/blo ... .dtsi#L369

vfperri
Posts: 4
Joined: Thu Apr 25, 2019 5:39 am
languages_spoken: english
ODROIDs: ODROID C1+; ODROID C2; ODROID XU4; ODROID N2
Has thanked: 0
Been thanked: 0
Contact:

Re: uart to RS485 (TXenable/RTS gpio pin)

Post by vfperri »

lsc1117 wrote:
Tue Apr 30, 2019 11:50 am
Is this the line you're looking for?
https://github.com/hardkernel/linux/blo ... .dtsi#L369
Just perfect!, thank you very much!

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 3 guests