EmbeddedRelated.com
Forums

2 wire rs485

Started by Vasilis February 10, 2009
On Feb 12, 4:59=A0pm, "Steve at fivetrees" <st...@NOSPAMTAfivetrees.com>
wrote:
> "Vasilis" <VASILI3...@HOTMAIL.COM> wrote in message > > news:ae766683-c87e-453c-93da-1e2f1290eb6c@v19g2000yqn.googlegroups.com... > > ok, i'll try to be as precise as possible, but bear in mind i am a sw > engineer, i don't have much of an electronics knowledge. > > when i use the converter (which by the way is a JaRa 2102E(chinese)) i do > this: > - plug the converter to the serial port RS232 > - screw one end of each of two wires into, respectively, a hole marked d+=
/A
> and a hole d-/B on the converter side > - screw the other end of the wires to the holes of the meter i mentioned > before.(A and B)
Just one comment on this. Unless I have missed something major all these years, the A signal is D- and the B signal is D+. I think they do it this way to be compatible with single ended operation where the data is inverted between the UART and the cable. Sometimes individual companies buck this convention. That can make it very difficult to know how to connect the wires. Rick
On Thu, 12 Feb 2009 22:26:15 -0800 (PST), rickman <gnuarm@gmail.com>
wrote:

>On Feb 12, 5:24&#4294967295;pm, "Steve at fivetrees" <st...@NOSPAMTAfivetrees.com> >wrote: >> "Grant Edwards" <gra...@visi.com> wrote in message >> >> > I was talking about "shift-register empty" bits that went true >> > before the stop bit had been sent. >> >> Sorry, Grant ;). >> >> Even so - I've occasionally come across UART architectures which seem to use >> two shift registers in series. (Or perhaps I dreamed that?) Or, possibly, >> the shift register is indeed empty and the stop bit is added automagically? >> It's been a while, and perhaps my leedle grey cells are, comment dire en >> anglais, scrambled? > >Actually, I expect that is how most UARTs are made. The shift >register holds the start bit and the various other bits *other* than >the last stop bit (some UARTs let you program 2 or even 1.5 stop >bits). The last stop bit is just a constant 1 that is shifted into >the input end of the shift register. So the counter has reached zero >when the shift register is full of 1 data and the stop bit is being >sent. This is when the tx reg empty flag can go high and is 1 bit too >early for the RS-485 transmitter to be disabled.
Turning the transmitter off at the _start_ of the (first) stop bit is usually not an issue on a fail-safe terminated bus, since the fail-safe termination will pull the line to the ("1") state after the last actual data bit has been sent, which is first interpreted by the receiver as the stop bit state ("1") and after one character time it is interpreted as the idle state ("1") :-). Paul
"Grant Edwards" <grante@visi.com> wrote in message
news:J9CdnVS6Y-YV3AnUnZ2dnUVZ_h4AAAAA@posted.visi...
> > I've seen chipsets where that bit wasn't implimented correctly > and went active before the last stop bit was sent.
Which shouldn't be a problem since the idle state of the RS-485 lines should be '1' anyway. So disabling the driver before the stopbit is sent should result in the same line state. Meindert
On Thu, 12 Feb 2009 21:52:05 -0000, "Steve at fivetrees"
<steve@NOSPAMTAfivetrees.com> wrote:

>And that's assuming the A/B confusion issue doesn't result in so-called >failsafe biasing resulting in the exact opposite, i.e. a BREAK condition >i.e. continuous receive interrupts on every station. Seen *that* a couple of >times... grrrr...
IMHO, this is a very desirable situation, since it immediately obvious that something is wrong and problems can be easily fixed during the commissioning phase. It is much worse to have intermittent problems when the system is actually in use. With fail-safe termination it is easy to set up correctly the RS-232/485 converters and the cabling between the converters, just by observing the status LEDs, before even having the actual control systems installed. Especially with the 4 wire RS-422 there is one combination which works and quite a lot of ways connecting the 4 (or even 5) wires incorrectly:-). Paul
On Feb 12, 12:59=A0pm, "Steve at fivetrees"
<st...@NOSPAMTAfivetrees.com> wrote:
> So: everything works when you use the external converter, but not when yo=
u
> use a bare RS-485 interface. I'd suggest the missing ingredient is the > transmit control system in the converter. If you actively control the > transmitter on your bare interface, which means going tristate when you'r=
e
> not actively transmitting, then it'll work.
if i got this right, i have to send the same electrical signals that the converter sends? how can i find out wich signals to send without an oscilloscope?.... what do you mean by going tristate? thanks again,
> Steve
vasilis.
On 2009-02-13, Paul Keinanen <keinanen@sci.fi> wrote:

> Turning the transmitter off at the _start_ of the (first) stop > bit is usually not an issue on a fail-safe terminated bus, > since the fail-safe termination will pull the line to the > ("1") state after the last actual data bit has been sent, > which is first interpreted by the receiver as the stop bit > state ("1") and after one character time it is interpreted as > the idle state ("1") :-).
Yes, that's generally true for RS-485 with pull-up/down resistors when running at low baud rates. At high baud rates, the pull-up/down resistors might not be low-enough impedance to get the line charged to the "1" state before the point in the stop bit where the receiver starts to sample it. That's partiucularly true if it's a long bus, and the pull-up/down resistors are at one one, and the sender and receiver are at the other end. However, the systems where the start-bit truncation was most problematic were using half-duplex FSK modems rather than RS-485, and turning off carrier at the beginning of the stop bit definitely caused problems. Adding a 1-bit-time delay loop in the code that was polling the shift-register empty status fixed the problem, but it's ugly. -- Grant Edwards grante Yow! I'm pretending that at we're all watching PHIL visi.com SILVERS instead of RICARDO MONTALBAN!
"Vasilis" <VASILI3000@HOTMAIL.COM> wrote in message 
news:d2e9a0ab-9735-4719-9601-0c2b449b2ab9@e18g2000yqo.googlegroups.com...
On Feb 12, 12:59 pm, "Steve at fivetrees"
<st...@NOSPAMTAfivetrees.com> wrote:
> So: everything works when you use the external converter, but not when you > use a bare RS-485 interface. I'd suggest the missing ingredient is the > transmit control system in the converter. If you actively control the > transmitter on your bare interface, which means going tristate when you're > not actively transmitting, then it'll work.
>> if i got this right, i have to send the same electrical signals that the >> converter sends? <<
Basically, yes. In your original post you described two situations: - using an RS485 port on your board - using an RS232 port into an RS232-RS485 converter Either way, the RS485 signals should be identical. This isn't hard - but you do have to take into account that RS485 requires control of the transmitter. (And receiver, but you can either enable the receiver when the transmitter is disabled, or leave it enabled, in which case you'll receive your own transmissions.)
>> how can i find out wich signals to send without an oscilloscope?.... <<
You don't need a 'scope.
>> what do you mean by going tristate? <<
"Tristate" means "disconnected". "Tri" means third - so it's the third state. A transmitter can be low, high, or high-impedance (disconnected), i.e. tristate. In a 2-wire system only one device can transmit at a time. All other transmitters must be tristated. Steve -- http://www.fivetrees.com thanks again,
> Steve
vasilis.
"Paul Keinanen" <keinanen@sci.fi> wrote in message 
news:5pm6p49v0r3naacq0g1bqci518nb1tg367@4ax.com...
> > On RS-485, use one end with active fail safe termination (typically > the master) as a reference and check the RxData LED on all slaves when > the bus is idle. If the RxData LED is constantly lit on a specific > slave only, just reverse the D+ and D- connections on that slave.
Paul, I've never seen an RS-485 system with LEDs (and I have dealt with more than a few). Luxury ;). Also, I've rarely (until fairly recently) seen fail-safe termination *as standard*. (I include it in my designs, but hey... in my industry there seems to be an awful lot of broken RS-485 implementations out there...) And from other posts re power consumption when both termination and biasing are involved: there's a trick. AC-couple the termination resistor/s with e.g. 0.1uF. Works a treat ;). Steve -- http://www.fivetrees.com
Paul Keinanen wrote:
> CBFalconer <cbfalconer@yahoo.com> wrote: >> rickman wrote: >>> CBFalconer wrote: >>>
... snip ...
>>> >>>> Raise rts, await cts, send data, lower rts. You never send >>>> data without cts being asserted by the receiver. Those >>>> acronyms stand for request/clear to send. >>> >>> I thought this was an RS-485 interface. That only has tri-state >>> data signals between the two devices. The RTS signal is used to >>> enable the driver for transmission. I'm sure you know about >>> this. I expect you just didn't get the context. >> >> Yes, but you need to connect the interface to the line to send. >> rts does this. cts announces that the connection has been made. > > That CTS connection is only required for the RS-232 port and SW > driver. In practice, the CTS is simply connected to the RTS line > at the converter or the CTS could also be connected to the RTS > line (which going to the transceiver) at the RS-232 D9 connector > at the PC etc.
You are making unnecessary assumptions. For example, when you assert rts the line is busy. The interface cannot connect. When it can, it does so, and returns cts. Now you can send -- [mail]: Chuck F (cbfalconer at maineline dot net) [page]: <http://cbfalconer.home.att.net> Try the download section.
On Sat, 14 Feb 2009 00:25:38 -0000, "Steve at fivetrees"
<steve@NOSPAMTAfivetrees.com> wrote:

>"Paul Keinanen" <keinanen@sci.fi> wrote in message >news:5pm6p49v0r3naacq0g1bqci518nb1tg367@4ax.com... >> >> On RS-485, use one end with active fail safe termination (typically >> the master) as a reference and check the RxData LED on all slaves when >> the bus is idle. If the RxData LED is constantly lit on a specific >> slave only, just reverse the D+ and D- connections on that slave. > >Paul, I've never seen an RS-485 system with LEDs (and I have dealt with more >than a few). Luxury ;).
The LED is usually on the TTL side of an external RS-232/485 converter or PLC, but it is sufficient to tell the difference between the idle and the break condition. While putting a red/green low current LED and a series resistor directly across the A and B lines would technically violate the standard, this works quite well in practice, if this is used only on one or two stations at a time during the setup phase (i.e. using it as a break-out-box). Just use a DIP switch to activate the LED or use a separate screw terminal that can be jumpered to the B-line to complete the test circuit. While the standard only requires a +/-200 mV swing at the receiver, in practice the swing is much larger in any sensible system, thus, there are sufficient voltage swing to activate the LED.
>Also, I've rarely (until fairly recently) seen fail-safe termination *as >standard*. (I include it in my designs, but hey... in my industry there >seems to be an awful lot of broken RS-485 implementations out there...)
I only use masters in which the fail-safe termination can be activated. With the fail-safe termination at the master, just remember to add a 100-120 ohm termination at the opposite end of the bus. The intermediate stations along the bus should not have the fail-safe termination activated.
> >And from other posts re power consumption when both termination and biasing >are involved: there's a trick. AC-couple the termination resistor/s with >e.g. 0.1uF. Works a treat ;).
Which breaks the DC path and you have to use a separate signal ground. There are several tricks to reduce the bias current, but they all seem to have various drawbacks, but may be justified in a battery operated environment, but if the power levels controlled by the serial message is thousand or million times the bias current, why bother to optimize the bias current :-). Paul