CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

CAN bus speed 1 mb

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Sultan



Joined: 31 Jan 2012
Posts: 8

View user's profile Send private message

CAN bus speed 1 mb
PostPosted: Tue Jun 12, 2012 5:39 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jun 12, 2012 6:19 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jun 12, 2012 8:56 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Jun 13, 2012 2:05 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Sep 10, 2012 8:21 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Sep 10, 2012 8:40 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Sep 10, 2012 8:44 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Sep 10, 2012 8:45 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Sep 14, 2012 6:52 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Sep 15, 2012 2:53 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group