How hard would it be to alter the CAN module

Moderator: Benj

Post Reply
JAW
Posts: 30
Joined: Tue Jun 16, 2009 2:25 pm
Been thanked: 4 times
Contact:

How hard would it be to alter the CAN module

Post by JAW »

Hi Guys,

How hard would it be to alter the CAN module so I can use lower data rates for longer distances ? I know from reading the datasheet that the crystal on the CAN chip would need to be altered. Software wise how hard would this be? I know nothing aboutC or how you write your modules but I have a project that needs to go over 1Km !

Regards

JAW

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: How hard would it be to alter the CAN module

Post by Benj »

Hello JAW,

The CAN component in Flowcode has an option to alter the data rate. Therefore it is actually fairly simple.

Simply go into the CAn component properties, Untick the Use suggested settings tick box and change the Bus Rate to suit your requirements.

JAW
Posts: 30
Joined: Tue Jun 16, 2009 2:25 pm
Been thanked: 4 times
Contact:

Re: How hard would it be to alter the CAN module

Post by JAW »

Hi Benj,

I want to drop the data rate lower than your minimum 125 Kbs. I know this involves altering the crystal connected to the CAN chip but what about in terms of software alteration?

Regards

JAW

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: How hard would it be to alter the CAN module

Post by Benj »

Hello Jaw,

If you use the custom code feature for the CAN and edit the defines section of code and then look for the following 3 lines of code.

Code: Select all

#define CNF1_VAL  		%d
#define CNF2_VAL  		%e
#define CNF3_VAL  		%f
These 3 values are passed to control the 3 baud registers for the CAN device. Microchip has a document available that details how to go about setting up the baud rate using these registers. Simply switch the %x values for the actual numeric values you need to pass to the registers to allow for the desired baud.

Post Reply