Re: [PATCH] serial: Fix incorrect rs485 polarity on uart open

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-- 

Henri Roosen | Entwicklung Software

GINZINGER ELECTRONIC SYSTEMS GMBH

Tel.: +43 7723 5422 161

Mail: Henri.Roosen@xxxxxxxxxxxxx
Web: www.ginzinger.com

On Fri, 2022-08-05 at 10:18 +0200, Lukas Wunner wrote:
> On Thu, Aug 04, 2022 at 04:11:26PM +0000, Roosen Henri wrote:
> > On Thu, 2022-08-04 at 17:52 +0200, Lukas Wunner wrote:
> > > On Thu, Aug 04, 2022 at 02:38:23PM +0000, Roosen Henri wrote:
> > > > unfortunately this commit, which has been backported to v5.4.x,
> > > > seems
> > > > to break RS485 functionality on our iMX boards.
> > > 
> > > What exactly broke?  Are you seeing incorrect polarity after
> > > opening
> > > the tty but correct polarity after the first send? Or is polarity
> > > always incorrect?
> > 
> > I'm not sure about the state before opening, I have to measure that
> > when I'm back at the office.
> > 
> > After opening, the polarity is always incorrect (inverted) when
> > this
> > patch is applied. We open the tty and try to receive, which now
> > fails
> > because the rs485 transmitter is on.
> 
> Does reception work after you send something?

No, it does not. This is because RTS is high during reception.

I'll provide you some oscilloscope screenshots off-list, but in words,
with this patch:
- the RTS is low at boot
- there is a small glitch (high-low pulse) when configuring the speed
  using 'stty -F /dev/ttymxc2 230400 raw -echo'
- RTS goes high when receiving, using 'cat /dev/ttymxc2'
- after stopping the cat command, RTS stays high
- RTS goes low for a few microseconds then high, just before
  transmitting the first data using 'echo hello > /dev/ttymxc2'
- RTS stays high while sending data
- RTS goes low after sending data, and stays low

Without this patch, RTS is only high during data transmission.

> 
> Please provide the contents of the pinctrl_uart2_rs485 node in your
> DT.

#define UART_PAD_CTRL (                 \
		PAD_CTL_ENABLED |       \
		PAD_CTL_SION_OFF |      \
		PAD_CTL_HYS_ON |        \
		PAD_CTL_PUS_100K_UP |   \
		PAD_CTL_PUE_ON |        \
		PAD_CTL_PKE_ON |        \
		PAD_CTL_ODE_OFF |       \
		PAD_CTL_SPEED_MED |     \
		PAD_CTL_DSE_40ohm |     \
		PAD_CTL_SRE_FAST)

pinctrl_uart2_rs485: uart2rs485grp {
	fsl,pins = <
		MX6UL_PAD_UART2_RX_DATA__UART2_DCE_RX   UART_PAD_CTRL
		MX6UL_PAD_UART2_TX_DATA__UART2_DCE_TX   UART_PAD_CTRL
		MX6UL_PAD_UART2_RTS_B__GPIO1_IO23       UART_PAD_CTRL
	>;
};

> 
> Thanks,
> 
> Lukas



Ginzinger electronic systems GmbH
Gewerbepark 3
4950 Altheim

www.ginzinger.com <https://www.ginzinger.com/>
Firmenbuchnummer: FN 364958d
Firmenbuchgericht: Ried im Innkreis

UID-Nr.: ATU66521089

Diese Nachricht ist vertraulich und darf nicht an andere Personen weitergegeben oder von diesen verwendet werden. Verständigen Sie uns, wenn Sie irrtümlich eine Mitteilung empfangen haben.
This message is confidential. It may not be disclosed to, or used by, anyone other than the addressee. If you receive this message by mistake, please advise the sender.

Attachment: smime.p7s
Description: S/MIME cryptographic signature


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux