EmbeddedRelated.com
Forums
Memfault Beyond the Launch

RS-485 -----> converter -----> USB --------> Linux

Started by Christiano January 6, 2014
What I need to study to make a program that reads data from a converted RS-485 output? Is Linux environment and Language C.
On 1/6/2014 4:54 PM, Christiano wrote:
> What I need to study to make a program that reads data from a converted RS-485 output? Is Linux environment and Language C. >
RS232 to usb to linux should be trivial. Can you translate 485 to 232?
On 2014-01-07, Christiano <christiano@engineer.com> wrote:
> What I need to study to make a program that reads data from a converted RS-485 output? Is Linux environment and Language C.
Sounds like you will learn a lot by doing it. Have fun. -- Mike McGinn KD2CNU "More kidneys than eyes."
On 7/01/2014 8:54 AM, Christiano wrote:
> What I need to study to make a program that reads data from a converted RS-485 output? Is Linux environment and Language C. >
<https://www.google.com.au/#q=rs485+to+usb+converter+linux>
On Mon, 6 Jan 2014 16:54:18 -0800 (PST), Christiano
<christiano@engineer.com> wrote:

>What I need to study to make a program that reads data from a converted RS-485 output? Is Linux environment and Language C.
Use an Ethernet/serial(RS-485) converter and it will work from any operating system (and any operating system version) supporting socket (TCP) or even only UDP connections.
On Mon, 06 Jan 2014 18:24:00 -0800, mike <ham789@netzero.net> wrote:

>On 1/6/2014 4:54 PM, Christiano wrote: >> What I need to study to make a program that reads data from a converted RS-485 output? Is Linux environment and Language C. >> >RS232 to usb to linux should be trivial.
Be careful with serial port numeration issues if you have two identical adapters.
>Can you translate 485 to 232?
While conversion from RS-232 to RS-422 would be trivial, just make the voltage translation. For 2 wire RS-485 the situation is more complicated, since you need the data direction control (basically transmit enable). For big and heavy operating systems like Linux or Windows, turning on and off the RS-485 with explicit commands by the host over USB may be far too unreliable (unpredictable latencies), so the USB converter itself must generate the transmit enable signal. Especially the transmit disabling is critical since if the transmitter is on too long after the frame, the other part may start the reply and cause a bus conflict.
http://www.ftdichip.com/Products/Modules/USBRSxxx.htm
On 2014-01-07, Christiano <christiano@engineer.com> wrote:

> What I need to study to make a program that reads data from a > converted RS-485 output? Is Linux environment and Language C.
Get a USB dongle that either includes RS-485 hardware support or an RS-232 USB dongle that supports automatic half-duplex RTS toggle under Linux (that way it will work properly with an RS-232<->RS485 converter). Alternatively, you can sometimes find RS-485 converters that handle line direction automatically and don't require RTS to be toggled -- but converters like that are hard to find and usually expensive. I do a lot of serial programming on Linux, and if I were you instead of C I'd use Python and either PosixSerial or pyserial, but it's your funeral. http://www.python.org/ http://pyserial.sourceforge.net/ http://www.panix.com/~grante/files/python/PosixSerial.py PosixSerial is a very thin wrapper around the Posix/Linux API that has been tested only on Linux. pyserial has much better documentation and is portable across Linux, Windows and MacOS (the Linux support in pyserial is based on PosixSerial). PosixSerial supports only Python 2.x, I'm not sure about pyserial. If you really want to use C, then get a copy of "Serial Programming Guide for POSIX Operating Systems" by Michael Sweet. There are old copies available for free http://www.cmrr.umn.edu/~strupp/serial.html http://ulisse.elettra.trieste.it/services/doc/serial/ It looks like you have to pay for more recent versions. http://www.lulu.com/us/en/shop/michael-sweet/serial-programming-guide-for-posix-operating-systems/ebook/product-17501940.html Do NOT pay any attention to the TLDP serial programming HOWTO: http://tldp.org/HOWTO/Serial-Programming-HOWTO/ It has many errors and omissions. -- Grant Edwards grant.b.edwards Yow! HUGH BEAUMONT died at in 1982!! gmail.com
On 2014-01-07, Grant Edwards <invalid@invalid.invalid> wrote:

> I do a lot of serial programming on Linux, and if I were you instead > of C I'd use Python and either PosixSerial or pyserial, but it's your > funeral. > > http://www.python.org/ > http://pyserial.sourceforge.net/ > http://www.panix.com/~grante/files/python/PosixSerial.py > > PosixSerial is a very thin wrapper around the Posix/Linux API that has > been tested only on Linux. pyserial has much better documentation and > is portable across Linux, Windows and MacOS (the Linux support in > pyserial is based on PosixSerial). PosixSerial supports only Python > 2.x
FWIW, I just updated PosixSerial so it works with Python 3.2 -- Grant Edwards grant.b.edwards Yow! Are you mentally here at at Pizza Hut?? gmail.com
On Mon, 06 Jan 2014 18:24:00 -0800, mike wrote:

> On 1/6/2014 4:54 PM, Christiano wrote: >> What I need to study to make a program that reads data from a converted >> RS-485 output? Is Linux environment and Language C. >> > RS232 to usb to linux should be trivial. > Can you translate 485 to 232?
There's USB to RS485 adapters out there. I've been out of the game for too long to know who the players are any more, but a quick web search should be helpful. Black Box used to be one of the go-to places; they had everything, albeit it steep prices. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com

Memfault Beyond the Launch