Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8013

Interfacing (DSI, CSI, I2C, etc.) • Re: CM4 UARTs - simultaneous access not working reliably when in RS485 mode?

$
0
0
The general idea of what the overlay is doing looks OK, but the implementation is flawed - the additional settings are applied in the wrong place, and get lost. There are two problems with the overlay (and the others in that PR: https://github.com/raspberrypi/linux/pull/6820):
1. The label "rs485" is on the wrong node, so when you set e.g.:

Code:

dtoverlay=uart3,rs485,rs485_rts_on_delay=5
you end up with something like this (before it is applied):

Code:

...rs485: fragment@2 {rs485-rts-delay = <5>;target = <&uart3>;__overlay__ {linux,rs485-enabled-at-boot-time;rs485-rts-delay = <0 0>;};};
Moving the label solves the problem:

Code:

fragment@2 {target = <&uart3>;rs485: __dormant__ {linux,rs485-enabled-at-boot-time;rs485-rts-delay = <0 0>;};};
2. rs485-rts-active-low is a boolean property - it's value is true if the property is present, and false if it is absent. However, the rs485_invert_rts override is treating it as if it is a string, then assigning nothing to it, so it ends up as an empty string. For this, we correct the declaration to make a boolean:

Code:

rs485_invert_rts = <&rs485>,"rs485-rts-active-low?";
I'll create a PR with the fixes.
Thank you very much Phil, great work! I appreciate you sorting it and putting in a PR.
While the PR is open, would it be possible/practical to add full-duplex support at the same time using "rs485-rx-during-tx", like below?

Code:

fragment@2 {target = <&uart3>;rs485: __dormant__ {linux,rs485-enabled-at-boot-time;rs485-rts-delay = <0 0>;};};__overrides__ {ctsrts = <0>,"=1";rs485 = <0>,"=1=2";rs485_invert_rts = <&rs485>,"rs485-rts-active-low?";rs485_full_duplex = <&rs485>,"rs485-rx-during-tx?";rs485_rts_on_delay = <&rs485>, "rs485-rts-delay:0";rs485_rts_off_delay = <&rs485>, "rs485-rts-delay:4";};
This solves the issue I found with my previous changes to the UART overlays, but unfortunately this will not affect the problems that I am having with simultaneous access in RS485 mode, so if anyone has any ideas I would be very grateful - thanks!

Statistics: Posted by AdamWTracerco — Tue Dec 16, 2025 2:51 pm



Viewing all articles
Browse latest Browse all 8013

Trending Articles