View previous topic :: View next topic |
Author |
Message |
Sultan
Joined: 31 Jan 2012 Posts: 8
|
CAN bus speed 1 mb |
Posted: Tue Jun 12, 2012 5:39 am |
|
|
Hi
I want to increase CAN bus speed from 125k to 1MB. I made following changes to CAN header file.
prescalar =0
seg1 =3
propagation=0
seg2 =3
But!!!!!!!!!!!!!!!!
its not working!@#$
Any help would be welcome
Thanks |
|
|
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Tue Jun 12, 2012 6:19 am |
|
|
What is your processor clock rate? There are limitations on the allowed settings - yours don't look valid - and there are errata problems for many CAN equipped PICs.
Download the mbtime Microchip Controller Area Network (CAN) Bit Timing Calculator and use it to determine what settings will work. You may well not be able to get 1Mb/s with many PICs.
RF Developer |
|
|
Sultan
Joined: 31 Jan 2012 Posts: 8
|
|
Posted: Tue Jun 12, 2012 8:56 am |
|
|
Hi
I am using PIC18f4680 and clock frequency is 20 MHz. Datasheet says these are valid values for registers!!!!! |
|
|
RHA
Joined: 25 Apr 2006 Posts: 31 Location: Germany
|
|
Posted: Wed Jun 13, 2012 2:05 am |
|
|
You will need following :
Code: | #define CAN_BRG_SYNCH_JUMP_WIDTH 0 //synchronized jump width ( Tq = X+1)
#define CAN_BRG_PROPAGATION_TIME 0 //propagation time select ( Tq = X+1)
#define CAN_BRG_PHASE_SEGMENT_1 4 //phase segment 1 ( Tq = X+1)
#define CAN_BRG_PHASE_SEGMENT_2 2 //phase segment 2 time select ( Tq = X+1)
#define CAN_BRG_PRESCALAR 0 //baud rate generator prescalar (1Tq = (2 x (PRE + 1))/Fosc ) |
(You will get a clock of 0.1us and use 10 clocks for one bit, Sample point at 70%)
But with MCP2510 these settings are not valid. I donĀ“t know exactly if they are valid with PIC18F4680. |
|
|
Sultan
Joined: 31 Jan 2012 Posts: 8
|
|
Posted: Mon Sep 10, 2012 8:21 am |
|
|
Hi
Thanx a lot for your help. I tried these settings but they did not work. I also tried MBTime software that is tool to calculate bit timing for CAN bus by Microchip, but those settings did not work as well. are you sure there Are no other registers that need to be changed for 1 MB ?
Thanx |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Mon Sep 10, 2012 8:40 am |
|
|
Obvious comment applies, that the requirements to get the termination right get much more important at the higher rate, and remember the allowable stub length (and bus length), goes down as well.
You might want to look at the signals on the bus, and see if they look reasonably well shaped at the higher rates.
Best Wishes |
|
|
drolleman
Joined: 03 Feb 2011 Posts: 116
|
|
Posted: Mon Sep 10, 2012 8:44 am |
|
|
1mb is a nice number but reality in the phsical world may be a problem. scope your lines. or slowly ramp up the data rate, until it fails. if you are putting a full 1mb of data the 4680 may have problems digesting it. you may need to go to a higher performance chip.
just some suggestions |
|
|
Sultan
Joined: 31 Jan 2012 Posts: 8
|
|
Posted: Mon Sep 10, 2012 8:45 am |
|
|
Hi
Thanx. I tried to change speed to 200kbs,250kbs, 500kbs,600kbs...... but apart from 125kbs no speed setting is working. My other node is CAN analyzer. 200kbs is not that higher a speed but still???????????
need help!!!!!!!!!!!
thanx |
|
|
mglsoft
Joined: 18 Feb 2008 Posts: 48
|
|
Posted: Fri Sep 14, 2012 6:52 pm |
|
|
You should test the CAN bus using a 10 MHz xtal and the PLL enabled reaches 40 Mhz.
In my application I use the speed of 250 Kbps, but it could reach 500 to 800 Kbps with no problems with the bus, you can possibly get either 1 Mbps with a similar configuration. _________________ MGLSOFT |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Sat Sep 15, 2012 2:53 am |
|
|
As a comment, looking at the original numbers, the PIC data sheet has a requirement that prop+seg1 > seg2. As posted they are equal.
Best Wishes |
|
|
|