Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

RS485 UART RTS control issues.

Featured Replies

Hello. Im trying to configurate and adapt OrangePI Zero 2W board to a custom extension board with multiple RS485 drivers.

For now, im trying to configurate a single secondary UART (UART2) to initialize with muxed Rx\Tx pins and in RS485 (with software driven RTS pin).

My current DT overlay is:

Spoiler

/dts-v1/;
/plugin/;

/ {
    compatible = "allwinner,sun50i-h616", "allwinner,sun50i-h618";

    fragment@0 {
        target = <&uart2>;

        __overlay__ {
            status = "okay";
            pinctrl-names = "default";
            pinctrl-0 = <&uart2_rs485_pins>;
            rts-gpios = <&pio 7 4 0>; // PH4 in ACTIVE HIGH
            linux,rs485-enabled-at-boot-time;
            rs485-rts-active-high;
            rs485-rts-delay = <55000 55000>; // Delay are set huge to visiually check RTS with scope, with 1/50 it still do not work.
        };
    };

    fragment@1 {
        target = <&pio>;
        __overlay__ {
            uart2_rs485_pins: uart2_rs485_pins {
                pins = "PH5", "PI6";
                function = "uart2";
            };
        };
    };
};

 

And it is partially works. Works as UART. Able to send and receive data with muxed Rx\Tx.
For RTS... its complicated. Seems RTS(PH4 GPIO) are initialized and acquired by UART2 software, and stay low during initial idling.

After im trying to send any data (echo 123 >> /dev/ttyS2), RTS goes HIGH and stuck in this state before reboot.


Im have tried to send big blob at 9600 and check the RTS with statserial.
But as i see, RTS is 1 (active???) from inital to complete and after, and never changes. 
 

 

  • Author

I have found, what is an old issue, first noted long ago in https://stackoverflow.com/questions/45813755/linux-8250-rs485-rts-troubleshooting
The user has noted, what it possible misuse of TEMT\THRE IRQs. 

Spoiler

image.thumb.png.bda5a15291c6290d79fcd09486111d76.png

 

Looking at 6.12 kernel 8250 drivers, i have found it was changed in the part what was the topic in stackoverflow post.
https://github.com/torvalds/linux/commit/b54f7a922d334014071ddaea313a045781024f4d

 

I am novice linux user and have lack of understanding many things, including tty to phys architecture and it settings.

Maybe im been able to try fix driver itself (have experience to write baremetal IRQ driver rs485 & uart drivers and modbus stack), but i have really big issues with linux modules building and etc.   

 

There are also another evidence about RTS\RS485 issues on 8250 in links below.

And mention of some "RS485" state machine, "RS485 software emulation" what "may be buggy" in topic i cant find now.

 

Edited by reasonx

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.