I have a problem developing USB -> RS485 Driver. We have a USB
- Serial Device(RS232/RS485) which is implemented as a Vendor
Specific Device.
We have developed a driver which uses the Class IOSerialDriverSync
& IORS232SerialStreamSync which works fine when the device is in
RS232 mode but does'nt work when the device is put in RS485 Mode.
The question is do i need to implement a driver based on
IOSerialDriverSync & IOSerialStreamSync to work with the USB -
>serial(RS485) Device or else can i make some modifications in the
present driver regarding flowcontrol logic to make it work with
the device put in RS485 mode.
Can anyone please suggest me on how i can make my driver work with
the USB->Serial(RS485) Device.
We may need more information but here are some ideas.
--- 1 ---
IIRC, RS485 is differential (like RS422) but it runs over only one
pair of data wires. This means that the transmitters and receivers on
the bus must "take turns" when communicating. It also means that
there must be extra hardware (the TX driver must be turned off when
receiving, for example).
This also means that some logical protocol is used so the nodes on
the bus know when to listen and when to talk. This interaction with
the protocol makes doing RS485 "interesting" because it means that to
really work correctly you need userland software that understands the
protocol being used. A master/slave(s) setup where a master sends a
request and a slave responds works well on RS485 (since such a
protocol, lacking command queueing) is inherently half-duplex anyway.
So when you say that your hardware supports RS485 are you sure? It's
a single +/- data pair for both transmit and receive? RS232/422
modules are more common in my experience as they are full-duplex (can
transmit and receive at the same time). All three forms can use flow
control signals to control how fast characters are sent (to prevent
overflowing the receiver's buffers) but that's different from the
"turn taking" that RS485 must do.
Are you just looking at the data from the serial API or do you have a
scope on the lines?
In addition to these details, when you say it "doesn't work" can you
be more specific? What exactly fails? Can the Mac transmit but not
receive, receive but not transmit, neither, or are there error
messages in system.log, etc.
Happy to help further if I can. Best of luck!
-Mike