EmbeddedRelated.com
Forums
Memfault Beyond the Launch

RS485 - MODBUS or PROFIBUS or ....

Started by eeboarder July 21, 2009
On Fri, 24 Jul 2009 02:03:21 GMT, "Core2Duo"
<Core2Duo@theinternet.com> wrote:

>if he does implement CAN bus, what chips do you recommend he use?.
For small systems built around a microcontroller, select one that in addition to the CAN controller also contains the other peripherals required by the final product. For stand-alone controllers, the Intel SJA1000 and Intel 82527 are the most common. The Intel controller is nice for small systems in which the CAN identifiers can be selected so that the ID filters on the chip can be effectively used. For master applications (such as in CanOpen master) or when high (interrupt) latency hardware/OS systems are used, the SJA1000 in PeliCan mode with 64 message Rx FIFO is very handy. All these chips have TTL I/O so an external transceiver chip is required for connecting to the actual CAN bus. For normal ISO 11898 CAN bus, the 82C250 is often used (up to 1 Mbit/s). For other bus standards (such as single wire), different transceiver must be used. Before actual CAN transceiver chips were implemented, ordinary RS-485 chips were used, in which the data controlled the Transmit enable pin to drive the bus into dominant state. Paul
"Not Really Me" <scott@validatedQWERTYsoftware.XYZZY.com> wrote in message
news:7cral9F28uaiiU1@mid.individual.net...
> Don't try this with SPI, the distance is too great. I think it is
unlikely
> to work over I2C for the same reason, but I have less direct experience
with
> that.
As Vladimir already pointed out: IDE, GPIB and Centronics were also single-ended at TTL level and all worked fine over at least 2 ft of flatcable. The SPI cable from my programmer is also 1 ft and I have never experienced any problems. Looking at the signals with my oscilloscope does not show any ringing, overshoot or reflection that matters. Meindert
On Tue, 21 Jul 2009 18:34:09 -0500, "eeboarder"
<jmeyer@emittechnologies.com> wrote:

>Also, all devices will be no more that four (4) feet from each other.
What ever is cheapest and easiest to implement and will be robust enough for what you want. Quite simple really.
On Thu, 23 Jul 2009 22:49:22 +0300, Paul Keinanen <keinanen@sci.fi>
wrote:

>On Thu, 23 Jul 2009 19:06:32 +0100, Paul Carpenter ><paul@pcserviceselectronics.co.uk> wrote: > >>In article <ZM-dnZZ6coutAvXXnZ2dnUVZ_tWdnZ2d@giganews.com>, >>nospam@nowhere.com says... >>> >>> >>> Paul Carpenter wrote: >>> >>> >>> > Until someone later wants to monitor what is happening and connects >>> > a TRUE RS232 device and blows your circuits. >>> >>> Paul, >>> >>> I agree that the TTL level signaling is not correct RS-232. However it >>> works just fine with the true RS-232 transceivers. It is handy to use a >>> pair of logic gates to interface an MCU to a COM port for debug or setup >>> purpose. >> >>Some employ a -ve threshold and get screwed by some PCs that only 0-some >>positive voltage often laptops. > >Sounds like the receiver is using a large hysteresis, with the >negative going transition well below 0 V. > >>> All RS-232 transceivers that I know of have the input threshold at about >>> +1.4V, so they accept the TTL level. On the TTL side, you need to clamp >>> the input, so it will take +/- 12V. > >The practical reason for a threshold well above 0 V is the problems >with powered down transmitters. An only or positive going transition >threshold at or below 0 V would cause a constant Break (Space) state >whenever the external transmitter is powered down. To avoid this, the >threshold is usually set above 0 V, giving a Idle (Mark) state, when >the transmitter is powered down or disconnected. > >Paul
Hmmm... That's an interesting point. What I have done in my product is to sort of "beef up" the RS232 receive end. Looks like alll RS-232 transmitters transmit + and - voltage levels, but hardly any of them xmit higher than +- 6 Volts these days. And I also noticed the bit about (esentially) TTL voltage levels and 0.5 V hysteresis. BTW, I use the ST232A parts because they pump up to around +- 10 V rather than 6 volts or so. So, I modified the receiver for abs(3V) hysteresis. So, the received signal must go higher than 1.5 V and less than -1.5V to change the received state, if sitting at 0.0 V ground. This should help noise rejection somewhat as well as be able to have some ground differntial Voltage between units of at least a few volts. So far this method is working great, and should pretty much keep the RS232 compatibility. Comments are very welcome on this. I am also using modbus so have a CRC check at the end of the packets and the data rate will not be required to be above, say, 56K baud. Normally, 19.2 K Baud. I did not like to waste another 2 wires with RS485 as well as having to terminate. I have also seen problems with so called RS485 systems at my last job. It wasn't all that reliable, but also, they messed with the implementation by using pullups and pulldowns (to guarantee +5V at the micro when comm was disconnected) and buildout resistors and R-C terminations, which definitely helped to screw up the workings. OK, I guess at that point is really wasn't RS485. boB

bob wrote:
> On Thu, 23 Jul 2009 22:49:22 +0300, Paul Keinanen <keinanen@sci.fi> > wrote:
> So, I modified the receiver for abs(3V) hysteresis. So, the received > signal must go higher than 1.5 V and less than -1.5V to change the > received state, if sitting at 0.0 V ground. This should help noise > rejection somewhat as well as be able to have some ground differntial > Voltage between units of at least a few volts. > > So far this method is working great, and should pretty much keep the > RS232 compatibility. Comments are very welcome on this. > > I am also using modbus so have a CRC check at the end of the packets > and the data rate will not be required to be above, say, 56K baud. > Normally, 19.2 K Baud.
The hysteresis won't buy you anything but the problems with the receiver occasionally stuck in the "break" state when the cable is disconnected. What could be useful is the simplest RC lowpass filter upfront the receiver. Set the RC cutoff frequency at about 1/2 of the bit rate. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Paul Keinanen wrote:

> For master applications (such as in CanOpen master) or when high > (interrupt) latency hardware/OS systems are used, the SJA1000 in > PeliCan mode with 64 message Rx FIFO is very handy. >
64 CAN message FIFO is on my wish list for the next generation stand alone CAN controller. Heinz
On Fri, 24 Jul 2009 14:41:15 -0500, Vladimir Vassilevsky
<nospam@nowhere.com> wrote:

> > >bob wrote: >> On Thu, 23 Jul 2009 22:49:22 +0300, Paul Keinanen <keinanen@sci.fi> >> wrote: > >> So, I modified the receiver for abs(3V) hysteresis. So, the received >> signal must go higher than 1.5 V and less than -1.5V to change the >> received state, if sitting at 0.0 V ground. This should help noise >> rejection somewhat as well as be able to have some ground differntial >> Voltage between units of at least a few volts. >> >> So far this method is working great, and should pretty much keep the >> RS232 compatibility. Comments are very welcome on this. >> >> I am also using modbus so have a CRC check at the end of the packets >> and the data rate will not be required to be above, say, 56K baud. >> Normally, 19.2 K Baud. > >The hysteresis won't buy you anything but the problems with the receiver >occasionally stuck in the "break" state when the cable is disconnected.
This can occur only if you disconnect the cable during active data transfer during the space (0) bit. Disconnecting the cable while the transmitter is in the idle (Mark) space does not cause this problem. One way around is to use a pulldown resistor at the input to the negative receiver supply voltage, which takes care of the cable disconnect problem. However, moving the hysteresis levels to say +0.5 V and +3.0V will also solve any problems associated with powered down transmitters.
>What could be useful is the simplest RC lowpass filter upfront the >receiver. Set the RC cutoff frequency at about 1/2 of the bit rate.
This may be usable in synchronous communication, in which each PLLs are used to synchronize the receiver clock at the start of connection or at least long preamble are used in front of a message frame. However, asynchronous communication is quite picky about detecting the leading edge of the start bit, so the signal should have a decent slave rate across the transition area. Thus, I would move the cutoff frequency at least 1-2 octaves higher. Paul
On Fri, 24 Jul 2009 22:31:55 +0200, Heinz-J&#4294967295;rgen Oertel
<hj.oertel@t-online.de> wrote:

>Paul Keinanen wrote: > >> For master applications (such as in CanOpen master) or when high >> (interrupt) latency hardware/OS systems are used, the SJA1000 in >> PeliCan mode with 64 message Rx FIFO is very handy. >> > >64 CAN message FIFO is on my wish list for the next generation stand alone >CAN controller.
Yes, you are right, the RxFIFO on the SJA1000 is only 64 bytes, so it could hold only 5-16 standard format messages. Anyway, this allows up to 0.5 ms interrupt latencies at 1 Mbit/s or 2 ms at 250 kbit/s. Paul
On 24 Jul 2009 14:28:01 -0500, bob <bob@bob.bob> wrote:

> Looks like alll RS-232 transmitters transmit + and - >voltage levels, but hardly any of them xmit higher than +- 6 Volts >these days.
The RS-232 standard was designed in the 1960&#4294967295;s to connect electrotechnical Teletypes (and early VDUs) to a modem and transfer it over existing telephone network to a central computer along with local devices. The modem was usually in the adjacent rack from the computer or Teletype, so the 15 m maximum distance was more than adequate and 20 kbit/s was more than even any baseband modem could carry over telephone wires. Typical current loop constant current sources had an open circuit voltage of 24-60 V and telephone circuit voltages are in the order of 40-60 V range. No wonder that the allowed voltages were so high. The minimum voltage levels are so high, that you could even drive directly some reed relays :-). The power dissipation was not an issue with the low speed, short low capacitance cable connections and since discrete semiconductors and resistors were used, it was easy to dissipate any power losses. The situation is quite different today, quite long cables are often used with a high cable capacitance. At each output transition, the cable capacitance must be charged or discharged through the transmitter to the corresponding supply voltage, in which some energy is dissipated to heat in the transmitter. With the current much higher line speeds used, these transitions occur much more frequently charging and discharging the line capacitance more frequently and hence dissipating a much larger average power in the transmitter. With integrated circuits and even with multiple transmitters on a same chip, the power dissipation would simply kill the chip if driving high capacitive loads at high speed using a high supply voltage. Looking at the situation at the receiver, the important thing is that the transition between -3 V to +3 V at the receiver is fast enough, compared to the line speed used. The transmitter is required to provide sufficient current in this voltage range to charge or discharge the distributed line capacitance. The problem with the cable distributed capacitance and distributed resistance is that the initial transmitter output voltage swing must be larger than +/-3V in order to achieve the +/-3 V voltage swing at the receiver in a realistic (non-infinite) time. Once the voltage at the receiver is outside +/-3 V, there is not much point in feeding large amounts of current into the line capacitance, so it is sufficient to feed the very small current consumed by the high input impedance receiver in the steady state. Clearly, the transmitter supply voltage must be larger than +/-3 V even assuming zero voltage loss switching to charge the cable distributed capacitance through the cable distributed resistance to achieve the +/-3 V swing at the receiver in reasonable time (say t=RC time constant). The +/-6V transmitter voltage swing is a good compromise, allowing at least 20 kbit/s into a low capacitance (<15 m) cable (as required by the RS-232C standard) with a reasonable power dissipation. Paul
On Fri, 24 Jul 2009 14:41:15 -0500, Vladimir Vassilevsky
<nospam@nowhere.com> wrote:

> > >bob wrote: >> On Thu, 23 Jul 2009 22:49:22 +0300, Paul Keinanen <keinanen@sci.fi> >> wrote: > >> So, I modified the receiver for abs(3V) hysteresis. So, the received >> signal must go higher than 1.5 V and less than -1.5V to change the >> received state, if sitting at 0.0 V ground. This should help noise >> rejection somewhat as well as be able to have some ground differntial >> Voltage between units of at least a few volts. >> >> So far this method is working great, and should pretty much keep the >> RS232 compatibility. Comments are very welcome on this. >> >> I am also using modbus so have a CRC check at the end of the packets >> and the data rate will not be required to be above, say, 56K baud. >> Normally, 19.2 K Baud. > >The hysteresis won't buy you anything but the problems with the receiver >occasionally stuck in the "break" state when the cable is disconnected.
OK, why would the increased hysteresis NOT buy me anything, as far as noise riding on the signal ? Say, a 1V P-P noise level ? Also, say there was a 1 V dc ground difference between the transmitter and receiver. boB
> >What could be useful is the simplest RC lowpass filter upfront the >receiver. Set the RC cutoff frequency at about 1/2 of the bit rate. > > > >Vladimir Vassilevsky >DSP and Mixed Signal Design Consultant >http://www.abvolt.com

Memfault Beyond the Launch