How CANBUS transmission speed is set to 5 kb/s?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
nnnnff
Posts: 107
Joined: Tue Oct 04, 2011 8:55 am
Has thanked: 3 times
Been thanked: 6 times

How CANBUS transmission speed is set to 5 kb/s?

Post by nnnnff »

CANbus transmission speed in macro Settings are: 125 KB/s, 250 KB/s, 500 KB/s, 1000 KB/s.
Now I want other transmission speed, such as: 5 KB/s.
How should I do? Help me!thank you.

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times

Re: How CANBUS transmission speed is set to 5 kb/s?

Post by LeighM »

What hardware are you using?
e.g. External CAN controller such as MCP2515 or a processor with internal CAN, if so, which one?

nnnnff
Posts: 107
Joined: Tue Oct 04, 2011 8:55 am
Has thanked: 3 times
Been thanked: 6 times

Re: How CANBUS transmission speed is set to 5 kb/s?

Post by nnnnff »

I use the MCP2515.
How should I do? thank you.

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times

Re: How CANBUS transmission speed is set to 5 kb/s?

Post by LeighM »

Have a look at the MCP2515 data sheet and the configuration registers CNF1, CNF2 and CNF3 and then you could customise the Init code of the CAN component.

Code: Select all

	%a_SPI_Master_Byte(%a_CNF3_VAL);         	// CNF3      0x28
	%a_SPI_Master_Byte(%a_CNF2_VAL);         	// CNF2      0x29
	%a_SPI_Master_Byte(%a_CNF1_VAL);         	// CNF1      0x2A
Change to some new values, e.g. as follows

Code: Select all

	%a_SPI_Master_Byte(0x07);         	// CNF3      0x28
	%a_SPI_Master_Byte(0xff);         	// CNF2      0x29
	%a_SPI_Master_Byte(0x27);         	// CNF1      0x2A
Having had a quick look I think the example above would give a CAN bit rate of 10kb/s
I don’t think you will be able to get down to 5kb/s with a 20MHz clock, you might have to change that too.

nnnnff
Posts: 107
Joined: Tue Oct 04, 2011 8:55 am
Has thanked: 3 times
Been thanked: 6 times

Re: How CANBUS transmission speed is set to 5 kb/s?

Post by nnnnff »

LeighM wrote:Have a look at the MCP2515 data sheet and the configuration registers CNF1, CNF2 and CNF3 and then you could customise the Init code of the CAN component.

Code: Select all

	%a_SPI_Master_Byte(%a_CNF3_VAL);         	// CNF3      0x28
	%a_SPI_Master_Byte(%a_CNF2_VAL);         	// CNF2      0x29
	%a_SPI_Master_Byte(%a_CNF1_VAL);         	// CNF1      0x2A
Change to some new values, e.g. as follows

Code: Select all

	%a_SPI_Master_Byte(0x07);         	// CNF3      0x28
	%a_SPI_Master_Byte(0xff);         	// CNF2      0x29
	%a_SPI_Master_Byte(0x27);         	// CNF1      0x2A
Having had a quick look I think the example above would give a CAN bit rate of 10kb/s
I don’t think you will be able to get down to 5kb/s with a 20MHz clock, you might have to change that too.

Post Reply