Reply by jyaron May 3, 20062006-05-03
http://forum.microchip.com/upfiles.aspx/14132/7D0C88B65D2D4772896FB4BB1A8D8153.JPG



Reply by jyaron May 1, 20062006-05-01
http://forum.microchip.com/tm.aspx?m=156898



Reply by Neil April 26, 20062006-04-26
Hans-Bernhard Broeker wrote:
> Neil <NeilKurzm@worldnet.att.net> wrote: >> Roberto Waltman wrote: > >>> Correct. The nodes can be connected to the main trunk with stubs of no >>> more than few inches, so what you describe below will most likely >>> work. >>> >> J1939 says the stub can be up to 1 meter. Is this true for an CAN buses? > > I'll assume you meant "for all CAN buses"... > > Not really. J1939 is not about all CAN buses, but only about those up > to 250 kb/s. For faster buses, 1 meter stubs would be trouble, > especially if they're really just that: stubs, cables directly coupled > the bus line, without any impedance compensation. > > It's called CAN "bus", as opposed to a ring, star, tree or network, > for a reason. Cabling it otherwise is possible, but you have to be > quite careful to avoid nasty problems with signal reflections at the T > joints. > >> Based on my non-EE reading of that spec He could be OK with 1 resistor >> on each his left most and right most connector. No? > > Probably. His bus is so short that at 500 kb/s he may even get away > with using only *one* terminator, anywhere on the bus. That's because > his entire bus cabling combined appears to be shorter than 1 meter. > >
Thanks. After my current project my 1st J1939 is next. I hope I have picked up enough here to avoid the easy mistakes.
Reply by Hans-Bernhard Broeker April 25, 20062006-04-25
Neil <NeilKurzm@worldnet.att.net> wrote:
> Roberto Waltman wrote:
> > Correct. The nodes can be connected to the main trunk with stubs of no > > more than few inches, so what you describe below will most likely > > work. > > > J1939 says the stub can be up to 1 meter. Is this true for an CAN buses?
I'll assume you meant "for all CAN buses"... Not really. J1939 is not about all CAN buses, but only about those up to 250 kb/s. For faster buses, 1 meter stubs would be trouble, especially if they're really just that: stubs, cables directly coupled the bus line, without any impedance compensation. It's called CAN "bus", as opposed to a ring, star, tree or network, for a reason. Cabling it otherwise is possible, but you have to be quite careful to avoid nasty problems with signal reflections at the T joints.
> Based on my non-EE reading of that spec He could be OK with 1 resistor > on each his left most and right most connector. No?
Probably. His bus is so short that at 500 kb/s he may even get away with using only *one* terminator, anywhere on the bus. That's because his entire bus cabling combined appears to be shorter than 1 meter. -- Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.
Reply by Neil April 25, 20062006-04-25
Roberto Waltman wrote:
> Mike Noone <mnoone.uiuc.edu@127.0.0.1> wrote: >> Roberto Waltman wrote: >>>> When don't you need a terminating resistor? >>> You always need the terminating resistors in a CAN network, not in >>> *individual* nodes. Normally they would be installed in the two nodes >>> that are farther apart, at opposite ends of a network segment. >>> >>From what you and Peter are saying - normally a CAN bus is just one long >> pair of wires with nodes along the way, and then resistors at the two ends. > > Correct. The nodes can be connected to the main trunk with stubs of no > more than few inches, so what you describe below will most likely > work. >
J1939 says the stub can be up to 1 meter. Is this true for an CAN buses? Based on my non-EE reading of that spec He could be OK with 1 resistor on each his left most and right most connector. No?
>> The way I designed it on my system, I have one primary board using an >> AT91SAM7X256, and then there are 6 connectors on this board, going to 6 >> different CAN devices. So each connector has +6V, +3.3V, GND, CANH, and >> CANL on it. Each CAN device is about 10cm away from the connector. Is there >> a good solution for this, while maintaining the individual connectors? >> Would it work for me to just add a resistor on the AT91SAM7X256 board, and >> then add a resistor on one of the 6 other boards? Alternatively, I could >> pull the CAN wires from the connectors and just run one long wire that goes >> between all 6 nodes and then to the main board. > > This will probably be better. In a system I was involved with some > time ago, the CAN bus connecting several devices was an (open) loop, > beginning and ending in the same board, with nodes "hanging" from it > at different locations. > > Remember that the purpose of the termination Rs is not just to provide > the correct impedance to avoid reflections, etc. as it seems you > believed originally. Their main function is to "pull" the voltage in > the CANH/L lines together when no node is driving them. > > The "dominant" state is CANH driven high, (obviously) CANL driven low. > The "recessive" level is both lines at the same voltage, via the > terminating resistors and all drivers in high-Z condition. > > Now going back to your setup, it may work as is, if you put a > termination resistor (1/2 the value) in the main board only. > (it may be necessary to experiment with different bit rates) > but you may run into trouble if you need in the future to add more > nodes farther away than the current ones. > > > > >> Then, it would be a clear >> call where I'd put the other terminating resistor. Would that be best?
Reply by Hans-Bernhard Broeker April 24, 20062006-04-24
Mike Noone <nleahcim@gmail.com> wrote:

> I looked through the resistors I have on hand and they're most very > large (in the Ks) so my choices were limited. I found a stash of 80.6 > ohms that I use with LEDs, so I tried putting one of those on the > AT91SAM7X256 board. It seems to work a whole lot better, though I'm > still getting odd results that I do not understand.
Those aren't due to the resistor values. 80 Ohms is not perfect, but close enough. Your logic analyzer will quite certainly not be able to spot the the backlash from such slightly off termination, anyway.
> it repeats that message forever. If you notice the M1 to M2 length, it > seems to nearly match with the expected 500Khz frequency (1/2.086252E-6 > = 479.3Khz). I believe this is due to an aproximation I had to do due > to the odd frequency the AT91 chip is running at.
Approximation is bad news. Being off by 20/500 = 4% between CAN controllers' t_q clocks means pretty much guaranteed failure on CAN bus. Depending on your bus timing parameters, you'll want to be off by less than 1% --- and the longer the bus, the closer the match has to be. If remotely possible design all CAN t_q lengths on the bus to be the same. It can be necessary to use a separate CAN controller with its own quartz to this end, if you don't have a choice for the CPU's main clock. This really would be a good time for you to step back from the hardware for a while; sit down with the CAN spec or a CAN textbook, and learn your way through it. Don't just read it, work it. You could start with your oscilloscope trace and actually parse it by hand. Find out what each and every bit of that signal means. If you don't invest in this learning, you risk getting yourself even deeper into a situation where you're creating problems faster than you solve them. -- Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.
Reply by Dave April 24, 20062006-04-24
On Mon, 24 Apr 2006 11:28:25 -0700, Mike Noone wrote:

> I looked through the resistors I have on hand and they're most very > large (in the Ks) so my choices were limited. I found a stash of 80.6 > ohms that I use with LEDs, so I tried putting one of those on the > AT91SAM7X256 board. It seems to work a whole lot better, though I'm > still getting odd results that I do not understand. Here's a screen > from my logic analyzer: > > https://netfiles.uiuc.edu/mnoone/www/More%20CAN%20oddness.jpg > > it repeats that message forever. If you notice the M1 to M2 length, it > seems to nearly match with the expected 500Khz frequency (1/2.086252E-6 > = 479.3Khz). I believe this is due to an aproximation I had to do due > to the odd frequency the AT91 chip is running at. The other chips > should be running at exactly 500Khz. Could that be causing the problem? > By the way, the message I'm *trying* to send is a standard data frame > with identifier = 1 and 8 data bytes = 0xAAAAAAAA55555555. The message > that appears to be being sent is > 000001000001011100000100000100000100000100000111101000100100 followed > by 29 1s.
Break out your scope and look at the CAN bus. The Kvaser pics show busses with incorrect/no termination and their effects. It looks like your CAN controller is not recognizing the received bits correctly and is attempting error recovery--it does this when the "error" is recognized rather than attempting to complete transmission. ~Dave~
Reply by Grant Edwards April 24, 20062006-04-24
On 2006-04-24, Mike Noone <nleahcim@gmail.com> wrote:

> it repeats that message forever. If you notice the M1 to M2 length, it > seems to nearly match with the expected 500Khz frequency (1/2.086252E-6 >= 479.3Khz). I believe this is due to an aproximation I had to do due > to the odd frequency the AT91 chip is running at. The other chips > should be running at exactly 500Khz.
Your baud rates mismatch by 4%? If your baud rates really do mismatch by 4%, I don't think it's going to work.
> Could that be causing the problem?
What problem?
> By the way, the message I'm *trying* to send is a standard data frame > with identifier = 1 and 8 data bytes = 0xAAAAAAAA55555555. The message > that appears to be being sent is > 000001000001011100000100000100000100000100000111101000100100 followed > by 29 1s. > > Can anybody make any sense of this?
You need to spend some time reading up on how CAN bus works instead of trying random shit and posting the resulting waveform to Usenet to see if anybody can make any sense of it for you. -- Grant Edwards grante Yow! Are you guys lined up at for the METHADONE PROGRAM visi.com or FOOD STAMPS??
Reply by Mike Noone April 24, 20062006-04-24
Allright I'm posting from the lab where we don't have usenet access, so
bear with me as I have to use google groups.

I looked through the resistors I have on hand and they're most very
large (in the Ks) so my choices were limited. I found a stash of 80.6
ohms that I use with LEDs, so I tried putting one of those on the
AT91SAM7X256 board. It seems to work a whole lot better, though I'm
still getting odd results that I do not understand. Here's a screen
from my logic analyzer:

https://netfiles.uiuc.edu/mnoone/www/More%20CAN%20oddness.jpg

it repeats that message forever. If you notice the M1 to M2 length, it
seems to nearly match with the expected 500Khz frequency (1/2.086252E-6
= 479.3Khz). I believe this is due to an aproximation I had to do due
to the odd frequency the AT91 chip is running at. The other chips
should be running at exactly 500Khz. Could that be causing the problem?
By the way, the message I'm *trying* to send is a standard data frame
with identifier = 1 and 8 data bytes = 0xAAAAAAAA55555555. The message
that appears to be being sent is
000001000001011100000100000100000100000100000111101000100100 followed
by 29 1s.

Can anybody make any sense of this?

-Mike

Grant Edwards wrote:
> On 2006-04-24, Mike Noone <mnoone.uiuc.edu@127.0.0.1> wrote: > > >>> Hi Dave - thanks alot for the response. I looked at the Kvaser > >>> page, but the pictures are all of the CANH and CANL signals. I > >>> was a little worried about the voltages on these signals > >> > >> You're worried about the voltages? What sort of transceivers > >> are you using? > > > > I'm using a TI SN65HVD231. I simply didn't know the max > > voltage my logic analyzer could handle, and I didn't exactly > > feel like risking an $11K machine... > > Um, OK, but the max CANH and CANL voltages are the same as the > max CANTX and CANRX voltages. > > >>> so I thought it'd be easier to debug looking at the CANTX and > >>> CANRX signals. It's the oddest thing - in the datasheets for > >>> the CAN devices that I'm using (Atmel AT91SAM7X256 and > >>> Microchip MCP2515) they talk all about the protocol, speed, > >>> bit length, etc. But they make no mention of what the signal > >>> should actually look like. > >> > >> I'm looking at the MCP2515 datasheet and there are diagrams > >> showing exactly what frames contain on pages 9 through 13. > > > > Right - and that's what I was expecting to see > > > >>> I mean I'm fully familiar with what bits should be where and > >>> all of that, > >> > >> Well then, you know what the signals should look like: A 1 bit > >> is 5V, and a 0 bit is 0V. > > My bad, you're using 3.3V parts not 5V parts. > > >>> Does that look like anything I should recognize? If it > >>> matters, the devices are only about 20cm away from each other > >>> and I'm not using terminating resistors. (I didn't think > >>> they'd be necessary when the transmission lines were so short, > >>> though it'd be easy enough to add them in if needed) > >> > >> You _have_ to have terminating resistors. They're not just > >> there for supressing reflections. CAN trasceivers only drive > >> in one direction and rely on the terminating resistors to > >> return the bus to the "idle" state. > > > > OK, I'll add them in. It's odd, most of the CAN boards I look > > at have a jumper to enable/disable the terminating resistor. > > That's because you generally want one terminating resistor at > each end of the bus. If you've got 15 devices on the bus, you > only want to enabled the terminating resistors on the 2 "end" > devices. If you left the terminating resistors enabled on all > 15 devices, the DC impedance of the bus would be too low to > drive reliably. > > > Thus I assumed it was only needed when dealing with long > > transmission lines. > > Nope. > > It would help a lot if you spent a few minutes reading about > how CAN works. You're using an ISO 11898-2 physical layer, so > pay attention to stuff about that implimentation: > > http://www.algonet.se/~staffann/developer/CAN.htm > http://www.canopen.us/faq/0137.htm > http://www.kvaser.com/index.htm > > Quoting from that last page: > > Bus Termination > > An ISO 11898 CAN bus must be terminated. This is done using a > resistor of 120 Ohms in each end of the bus. The termination > serves two purposes: > > 1. Remove the signal reflections at the end of the bus. > 2. Ensure the bus gets correct DC levels. > > An ISO 11898 CAN bus must always be terminated regardless of > its speed. I'll repeat this: an ISO 11898 CAN bus must > always be terminated regardless of its speed. For laboratory > work just one terminator might be enough. If your CAN bus > works even though you haven't put any terminators on it, you > are just lucky. > > > > When don't you need a terminating resistor? > > You never don't need a terminating resistor. > > In the real world, you need one terminating resistor on each > end of the bus. For short buses (e.g. on a bench), you can > usually get by with just one resistor anywhere on the bus. > > -- > Grant Edwards grante Yow! If I pull this SWITCH > at I'll be RITA HAYWORTH!! Or > visi.com a SCIENTOLOGIST!
Reply by Peter Dickerson April 24, 20062006-04-24
"Mike Noone" <mnoone.uiuc.edu@127.0.0.1> wrote in message
news:Xns97AF74BB12830mnooneuiucedu127001@63.240.76.16...
> Roberto Waltman <usenet@rwaltman.net> wrote in > news:pdtp42lql0p8q2eacq7cv5mm6lj0psu9qn@4ax.com: > > > Mike Noone <mnoone.uiuc.edu@127.0.0.1> wrote: > >>OK, I'll add them in. It's odd, most of the CAN boards I look at have a > >>jumper to enable/disable the terminating resistor. Thus I assumed it was > >>only needed when dealing with long transmission lines. > >> > >>When don't you need a terminating resistor? > > > > You always need the terminating resistors in a CAN network, not in > > *individual* nodes. Normally they would be installed in the two nodes > > that are farther apart, at opposite ends of a network segment. > > > > Ohh boy. Now I'm wishing I had previously read up on CAN a bit more than I > did. I thoguht I had read everything I needed to know - but obviously not!
I think someone suggested as much earlier in the thread.
> From what you and Peter are saying - normally a CAN bus is just one long > pair of wires with nodes along the way, and then resistors at the two
ends.
> The way I designed it on my system, I have one primary board using an > AT91SAM7X256, and then there are 6 connectors on this board, going to 6 > different CAN devices. So each connector has +6V, +3.3V, GND, CANH, and > CANL on it. Each CAN device is about 10cm away from the connector. Is
there
> a good solution for this, while maintaining the individual connectors?
It seems that you have created a CAN star rather than a CAN bus. With only 10 cm per node you have a fair chance that it will work with a single 1/2 value resistor (or two std resistors on the two longest lengths) providing you don't go to fast.
> Would it work for me to just add a resistor on the AT91SAM7X256 board, and > then add a resistor on one of the 6 other boards? Alternatively, I could > pull the CAN wires from the connectors and just run one long wire that
goes
> between all 6 nodes and then to the main board. Then, it would be a clear > call where I'd put the other terminating resistor. Would that be best?
Best, but it's work trying the star first if changing the plumbing is a big hassle. Peter