Raspberry Pi RS-485 Interface

Thread Starter

Sensacell

Joined Jun 19, 2012
3,784
I am considering using the Raspberry Pi to control a machine I am designing.

The machine has a half-duplex RS-485 network, running 115,200 baud, with multiple drops.

I have been reading a bit on the web about how to go about implementing this.
Looking at the available interface boards, some seem to have really simplistic implementations, as bad as using the TXD line to enable the RS-485 transceiver chip!! Some solutions using GPIO pins seem to require the user to manually switch the transmit enable, which will be terribly slow and awkward.

I need to poll and control a bunch of stuff with minimal latency, requiring back-to-back query and response cycles, I cannot afford to worry about the TX/RX switchover timing.

Has this been resolved on a kernel level? With a GPIO pin that can turn around transmit/receive with uS timings?
Can anyone suggest a well-designed board to do this?
 

MrChips

Joined Oct 2, 2009
34,807
Half-duplex RS-485 operation requires the sender to disable TX mode after transmitting. This is mandatory with no exceptions.
The TX code has to ensure that the last character has been completely shifted out before disabling TX mode. Furthermore, most systems would introduce a given delay period before turning off the TX. Along with that, most systems would introduce a given turn-around delay before responding to a transmitted message.

What you do with the RX mode is up to you. Some systems will disable the local RX. Other systems will leave the RX mode enabled and will monitor the network data during its own transmission. This loop-back will allow the system to detect collisions.

Look that how the RS-485 chip is wired. If the /RE and DE pins are joined to the same control signal then you cannot have loop-back testing.
If /RE and DE can be controlled independently then you can loop-back your own data.
 

ErnieM

Joined Apr 24, 2011
8,415
While I just got my Pi a couple weeks ago I did notice it has four USB ports. As long as you can find a software driver for Linux you could use any off the shelf USB to 485 converter.
 
Top