Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: USB ->Serial(RS485) Driver



On Oct 19, 2006, at 8:49 AM, Michael Cashwell wrote:
On Oct 19, 2006, at 11:22 AM, Dean Reece wrote:
RS232 is full-duplex (independent Tx and Rx lines) and is used for point-to-point connections. RS485 commonly uses a shared data line and multi-drop topologies. To support this, there must be a mechanism at the driver level to gate the transmitter for each node, and a protocol to select which node can transmit at any given time.

The IOSerialDriverSync & related classes assume a full-duplex point-to-point communication channel, and don't have any built-in capabilities regarding line turnaround. You should in theory be able to implement this control protocol in your driver, such that the superclasses don't need to know or care about the line control (when it isn't your turn to talk, act as if you are flow- controlled off).

This is what I've seen. A node's TX driver is controlled directly by a UART pin such that when the UART has bits going out it drives the bus. When it doesn't, it listens to that same bus. It handles the pre/post TX enable timing for you based solely on there being bits going out.


This means that the logical client (the presumably user-land software that's sending and receiving the bytes) must somehow "agree" with the other node(s) on the bus so they take turns transmitting. It doesn't have to be modeled as as hardware flow- control IF there is some agreement about who has the TX "token" and how it's passed logically between nodes. This is was I was referring to when I mentioned a simple request/response protocol. That makes it clear who's turn it is to TX.

Because there's only one data pair this is true even if it's just a point-to-point link between two nodes.

Yep - if the UART can automatically gate the transmitter, then that is best and doesn't require much in the way of special driver management (other than enabling this feature). Then the high-level software just avoids sending data when it isn't its turn. If the gating is manual, the driver will have to step up and handle it.


If your RS485 link is wired as a full-duplex point-to-point link, then your driver should probably work as-is, unless you need something extra to enable the transmitters.

I do not believe this is physically possible. RS485 is by definition a "shared pair" medium that thus must be half-duplex. RS422 is the differential analog of RS232 and has 2 data pairs. I believe that "full-duplex RS485" is a contradiction in terms even for just 2 devices.

Probably true. I mentioned it because I've seen talk of "four-wire RS-485", which is probably just RS-422, but I haven't examined it closely enough to know that it isn't some hybrid beast. Also, some RS-422/485 controllers require you to bridge the Rx and Tx lines with jumpers when in 485 mode, so it is possible to have a controller in Rs-485 mode with separate Rx and Tx lines; I just don't know if such a configuration is in any way useful and distinct from RS-422.


Cheers,
 - Dean
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-drivers/email@hidden

This email sent to email@hidden
References: 
 >USB ->Serial(RS485) Driver (From: "VAMSI" <email@hidden>)
 >Re: USB ->Serial(RS485) Driver (From: Dean Reece <email@hidden>)
 >Re: USB ->Serial(RS485) Driver (From: Michael Cashwell <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.