View previous topic :: View next topic |
Author |
Message |
newby
Joined: 26 Sep 2004 Posts: 32
|
Optimal CAN settings for long distance communications ? |
Posted: Thu Sep 28, 2006 11:21 pm |
|
|
I would like to use CAN for communications between uCs over distances > 100m.
The baud rate is not the problem, 50 - 100 kbits are enough.
I am also able to use the CAN bit timing calculators, but i need an advice how to set the different phases in an optimal way for this purpose.
The AN574 which should deal with this topic, is no longer available at the microchip homepage.
How should i set the different quantas and so on ?
Thanks for any helpful advice ! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
newby
Joined: 26 Sep 2004 Posts: 32
|
|
Posted: Sat Sep 30, 2006 2:57 am |
|
|
AN754 is very interesting, also according to osc accuracy.
I am facing the following problems now:
- I use the CCS CAN-test board
- With the standard CAN settings used in the examples, 125 kbit
- My external CAN-board uses an 8 MHz ceramic resonator, CAN also configured for 125 kBits, 18F2680
- The test board uses the PCA82C251, my board the MCP2551
Problem:
If I connect my board (CAN-L/H, VSS, VDD) to the CCS test board using CAN-H and CAN-L (of the MCP2551), I am not able to establish a functioning connection.
If I don't use the MCP2551 and wire directly from the TX and RX pins of the uC to the TX and RX pins of the CCS-CAN test board, then everything works fine....
As far as I know the PCA82C251 and MCP2551 should work together - but they don't ?
I checked the connections and soldering of the MCP2551, seems to be fine. I also get an output out of the MCP2551.
Is there anything else I have to keep in mind ?!? |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
|
newby
Joined: 26 Sep 2004 Posts: 32
|
|
Posted: Sun Oct 01, 2006 9:05 am |
|
|
Well, if i connect the CAN-boards using the CAN-L/H lines (MCP2551) then there are 15 small spikes on the TX of the 18F2680.
If i connect per RX and TX directly without MCP2551, i see a different pattern (far more complex) and the connection is working.
Is the MCP2551 not "strong enough" to take over the CAN-Bus ? Iīm not an expert but is this pattern (15 peaks) a sign that the 18F2860 is waiting and not able to get a "call connected signal" ?
I tried a 1kOhm PU on the TX line from the 18F2680, change nothing in both cases (using TX & RX and CAN-L/H). I donīt think that i need a PU, i can see the signal on the RX & TX without PU. |
|
|
Ttelmah Guest
|
|
Posted: Sun Oct 01, 2006 9:31 am |
|
|
Small spikes like this are common, where required resistors are not present. As the driver gates switch, there is enough internal capacitance to induce a tiny 'edge'on the signal lines. Have you got the terminating resistor present between Can-H, and Can-L at the end of the bus?. Normally 120R at each end of the bus. These are _required_, both providing signal termination, and a DC path for the drive outputs (which for Can-L, is a 'pull-down' only device, and for Can-H, a 'pull-up' only device). Without these, the bus will almost certainly be reporting a permanent 'dominant' state, which will prevent the PIC from being able to drive the bus.
Best Wishes |
|
|
newby
Joined: 26 Sep 2004 Posts: 32
|
|
Posted: Sun Oct 08, 2006 1:15 am |
|
|
Well i found the mistake, a quite stupid one.
It was not the 120 Ohm resistor, I don't use one because for the distances and bit rates I use at the moment, I don't need one.
According to the datasheet of the MCP2551, the slew rate (V/us) of the signals can be influenced using an additional resistor called Rset. This Rset can be selected according to a figure and this figure shows that the slew rate doesn't change anymore with increasing resistance above about 100 kOhm - it levels out asymptotically.
Because I didn't know which slew rate I need and just thought "if all values above 100 kOhm" gives the same result, I don't use a resistor which means Rset = xyz MOhm and that?s OK..... But it wasn't ! I have put in a 10 kOhm resistor and from that on it works !
Thanks to all of you guys ! |
|
|
Pedr0
Joined: 08 Sep 2008 Posts: 3
|
|
Posted: Sun Oct 05, 2008 4:49 am |
|
|
Someone knows what I have to change to have 250kbps with a 20MHz crystal ? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Oct 05, 2008 9:06 am |
|
|
The post given on page 1 of this thread has full instructions.
Follow the instructions and do it. |
|
|
Tufican
Joined: 23 Feb 2011 Posts: 10 Location: Turkey- izmir
|
|
Posted: Fri Oct 07, 2011 2:48 pm |
|
|
newby wrote: | Well i found the mistake, a quite stupid one.
It was not the 120 Ohm resistor, I don't use one because for the distances and bit rates I use at the moment, I don't need one.
According to the datasheet of the MCP2551, the slew rate (V/us) of the signals can be influenced using an additional resistor called Rset. This Rset can be selected according to a figure and this figure shows that the slew rate doesn't change anymore with increasing resistance above about 100 kOhm - it levels out asymptotically.
Because I didn't know which slew rate I need and just thought "if all values above 100 kOhm" gives the same result, I don't use a resistor which means Rset = xyz MOhm and that?s OK..... But it wasn't ! I have put in a 10 kOhm resistor and from that on it works !
Thanks to all of you guys ! |
Hi guys
I have a stupid problem and I can't solve this :(
I can set my baudrates 50k 100k 150k 200k.
But I can't see 250k and 500k.
why??
Its not a software problem :( I'm using your codes
and I'm using original ccs c canbus development kit :((
Please help me.
When I set my baud rate to 500k,
I see this from logic analyzer. This loop forever.
But when I set again to <200,
I see this true one.
I check my registers.
I check my program.
I check everything but i cant increase my baudrate from200k. :((
Please help me.
can be my bus line resistors is unaviable to high speed can
i look my resistors between can h and can L
its 7k ohm
i think its must be 120 ohm ?
Last edited by Tufican on Fri Oct 07, 2011 3:34 pm; edited 2 times in total |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Oct 07, 2011 2:55 pm |
|
|
You should have asked this in your CAN bus baudrate thread from earlier
this week. You should still continue it there, instead of here:
http://www.ccsinfo.com/forum/viewtopic.php?t=46445
But, to get help you need to answer these questions:
What's your PIC for this test ?
What is the oscillator frequency for the PIC ?
What's your CCS compiler version ?
Where's your (very short, but compilable) test program so we can try to
duplicate the problem ? By short, I mean 20 lines, if you can. I don't
mean 100 or 200 lines. We don't want to look at long test programs.
Where is the description of how you are connecting your logic analyzer
to the circuit ? What pins on the PIC or CAN bus driver chip is it
connected to ?
In other words, post all the details so we can duplicate your test setup
(both hardware and software) and see the problem and maybe try to
solve it. |
|
|
tienchuan
Joined: 25 Aug 2009 Posts: 175
|
|
Posted: Mon Jan 27, 2014 1:15 am |
|
|
Quote: | But for a short cable and normal drivers, I think 500 ns should work fine |
Hi PCM Programmer.
I'm have a trouble when calculate propagation time delay to config baud speed.
I'm building a CAN network with 40 node, bus length about less than 250m, at one node I used PIC18F4680(integrated CAN driver ) and MCP2551 to transceiver CAN signal.
I read in App note AN754 and it show:
tprop= 2*(tbus + tcmp+ tdrv)
And I have a question why you calculated 500ns for propagation time delay?
I hope you will soon reply for me.
Thanks and regards ! _________________ Begin Begin Begin !!! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jan 27, 2014 2:09 am |
|
|
My advice is to search http://www.google.com for this
Quote: | How to calculate CAN bus propagation time delay |
and also search for this:
Quote: | site:microchip.com/forums "CAN bus" propagation time delay |
|
|
|
|