Linux embedded and direction control of RS485 transceiver

I have an half-duplex RS485 bus with 10-20 different nodes. Some of them are 8-bit MCU based, one of them could be Linux embedded.

It's half-duplex, so it's important for the transmitter node to disable the driver as soon as the last transmitted bit is shifted out.

Many small low-cost MCU has interrupt on transmission complete, so the delay of disabling the driver is usually on the order of microseconds.

Some new Cortex-M MCUs have an automatic control of external RS485 transceiver, so the delay is really zero.

What happens in Linux embedded systems? Many of them are based on NXP i.MX CPUs and it seems they aren't able to control the RS485 direction in hardware, but some code is needed. This approach could increase the delay of disabling the driver in the order of milliseconds.

Is it possible that a powerful CPU isn't able to control RS485 driver in hardware?

Reply to
pozz
Loading thread data ...

Look very carefully _when_ the interrupt occurs. Some UARTs generate an interrupt when the last character is moved from the FIFO into the shift register, some (also) generate an interrupt, when actually the (last) stop bit has completely shifted out from the shift register.

If you turn off the Tx based of the FIFO to shift register interrupt, the Tx can be turned off, while the last character is actually being transmitted and the 'fail safe' termination will pull the line to "1" i.e. idle. The receiver often gets the last character as FF, FE,.. , F0 etc. especially at low line speeds.

This is the proper way of doing low latency half duplex. Otherwise, you have to add some extra delay, before the slave starts the response.

Reply to
upsidedown

You should use the RS232 handshake signals (i.e. the RTS signal) in order to do that. i.MX UARTs should support them, but it doesn't look very straightforward indeed:

formatting link

--
Fletto i muscoli e sono nel vuoto.
Reply to
dalai lamah

Il 24/03/2021 11:48, dalai lamah ha scritto:

Yes, you can use RTS, but some software MUST change a register bit to move that signal!!!

Reply to
pozz

Den 2021-03-24 kl. 00:06, skrev pozz:

Atmel (now Microchip) ARM products has a serial port which supports handling the RS-485 direction in hardware. It also has an interrupt which is triggered after a programmable delay has occured without any receied characters.

Reply to
A.P.Richelieu

Similar for recent STM32 U(s)arts.

--
Uwe Bonnes                bon@elektron.ikp.physik.tu-darmstadt.de 

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt 
--------- Tel. 06151 1623569 ------- Fax. 06151 1623305 --------- 
(Phone also available during "mobile work")
Reply to
Uwe Bonnes

Il 09/05/2021 13:24, A.P.Richelieu ha scritto:

I know SAM D family MCUs has a nice SERCOM peripheral with RS485 direction in hardware.

But my discussion was for Linux embedded, so MPUs (Cortex-A).

Reply to
pozz

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.