RE: Long, Low speed CAN bus
"John Dammeyer" <[email protected]> Fri, 1 Nov 2019 18:17:30 -0700
| Newsgroups | gmane.comp.hardware.bus.can |
|---|---|
| Message-ID | <[email protected]> |
Hi Chuck, I've not worked with longer than 500' so I may not be able to answer all = your questions. Remember the CAN drivers always need at least one termination resistor = for the drive circuit to function. I believe, but perhaps someone can = correct me, the impedance of a cable is usually listed at a specific = frequency like 1MHz or 10MHz and for CAN bus it's normally 120 Ohm. A quick and easy way is with a pulse generator and scope. https://www.edn.com/electronics-blogs/scope-junction-blogs/4431974/Quick-= --dirty-cable-length---impedance-measurement What you will find is that if you don't have the cable properly = terminated the reflection may or may not impact your messages. = Generally the reflection is only an issue when it disrupts messages at = specific points along the cable. =20 Think of that pebble you throw in the pond. The ripples that spread out = are like a sine wave slowly decreasing in amplitude. If you measure the = depth of the pond at the mid sine wave point at any spot it will be the = same depth. But move to the crest or the trough of the wave and the = pond depth changes because the water is lower or higher than the = midpoint. The reflection off the end of the transmission line is like that crest = and trough. As it travels back along the network cable, if it happens = to have a crest or trough at a point where a CAN device is measuring the = bits, you will end up with a damaged message. That node may be really = unreliable while one 3' further down works perfectly. What's worse is it's not just a pulse but a sequence and all but one = message may be received perfectly but one will be intermittent. Very = hard to find the reason. So I think you do need to look at termination as important. Another thing often overlooked is the CAN DC ground. For those kinds = of distances and cable resistance you have to address common mode = difference between the signal (relative to ground) and the signal at the = other end relative to its own ground. Remember, unlike RS485 or RS422 = the current doesn't change direction for a 0 verses a 1. So although = the receivers may well measure the difference they are also referenced = to ground. So for those kinds of distances using isolated CAN drivers where the = power supply for the drivers accompanies the signal may work better. = Ie. Opto isolators on the TTL side. The CAN devices are driven from a = 24V or 48V power supply regulated down to 5V for the driver. = Individual node driver current is small enough that the difference in = ground between the ends of the cable won't cause common mode issues. You see that approach showing up in POE systems. So take your cable. Start with a 5V 80uS pulse and look for the = reflection to determine the impedance and termination needed. And look = at the edge rounding. Next transmit 6.25kHz (80uS ON, 80uS OFF) and = look at the signal at the other end with respect to rounding of the = edges. Maybe use a CAN driver to do this instead. If you don't have isolated CAN power/signal then make sure the testing = you do has a DC current load simulating the real system. =20 This should give you an idea of where your sample point should be. The = 80% might be too far into the bit period. Or maybe it's perfect. =20 In either case Mike Schofield's BitTime software shows you can get 8500 = meters with 83% sample point. So distance for the ACK bit to return = isn't an issue. Just some ideas. John Dammeyer > Environment: > Very low speed. ~ 12,500 bps. > Controller: MCP2515 > Driver: MCP2551 > Clock source 14.7456 MHz crystal divided by 2 my ATMega1284 processor = * > Lightning/Surge protection using GDT, TBU, TVS *** > Current MCP2515 bus timing parameters: > BRP 24 > SJW 2 ** > Samples 1 > PSEG 8 > PSEG1 4 > PSEG2 3 > My understanding is that the above values result in a sample point > of 80% >=20 > * New board design uses separate 7.3728 MHz crystal for the CAN = drivers > (new > board has two controller/driver sets). >=20 > ** Never have understood this value well enough to intelligently pick = a > value. >=20 > *** The TBU adds about 11 ohms of resistance to each of CH & CL. This = is in > series with the driver at each location, not in series with the cable = from > site-to-site. >=20 > My Issue ... >=20 > The bus is very long. I have measured the round-trip cable resistance = at > about 85 ohms per 1,000 feet. >=20 > In one bench test using a 564' length of CAT-5 to simulate field = cable, four > trips through the cable resulted in a length of 2,256 feet and a = round-trip > resistance of about 191 ohms. >=20 > Using 120 ohm terminators the signal level (using a scope) was below = 1.2v > (differential) so the driver did not decode the signal. >=20 > I removed the terminators and it was obvious on the scope that that = was bad > because there was no resistance to discharge the cable capacitance = (large RC > discharge time). >=20 > I then tried 1k terminators and all worked fine. For the final test I = had 7 > controllers at one end and two at the other generating a total of = about 15 > messages per second. >=20 > I could see that there was some RC discharge curve effects but, I = assume, > because I am using very low speed and sampling at 80% this was ok. >=20 > Above 2k total (two 4k resistors) RC effects started cause errors = (recessive > did not drop low enough, fast enough). >=20 > Showing voltage levels from near (higher) and far (lower) ends of the = cable > (20ms/div, all traces 1v/div): > https://tinyurl.com/yywjxkyc >=20 > Showing the RC effects (500 us/div): > https://tinyurl.com/y38gz52y >=20 > My Conclusion ... >=20 > In my usage (low bps), cable mismatch, reflections, etc. caused by = wrong > terminators, stubs, etc. are not as important to getting maximum = distance at > is the signal amplitude. >=20 > Questions ... >=20 > Am I right in my conclusion (proper cable termination not important to = me, > for maximum distance use larger 'terminators')? There is still a = distance > limit due to timing as a result of the travel time of the ACK bits = from the > far end of the cable. There is also a limit on how large the = 'terminators' > can be because the RC discharge time will become significant at some = point. >=20 > Do my bus timing values look reasonable? (sometimes seems like a = 'black > art') >=20 > Can someone give me more insight into what value I should use for SJW? = My > understanding is that this addresses clock jitter but I doubt that's = an > issue with my low bps rate. >=20 > Regards, >=20 > Chuck Hackett > Tampa, Florida, USA >=20 > -- > Archives and useful links: http://groups.yahoo.com/group/CANbus > Subscribe and unsubscribe at www.vector.com/canlist/ > Report any problems to <[email protected]> -- Archives and useful links: http://groups.yahoo.com/group/CANbus Subscribe and unsubscribe at www.vector.com/canlist/ Report any problems to <[email protected]>