Page 1 of 1

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

Posted: Tue Oct 01, 2013 3:04 am
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.

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

Posted: Tue Oct 01, 2013 9:02 am
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?

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

Posted: Tue Oct 01, 2013 9:19 am
by nnnnff
I use the MCP2515.
How should I do? thank you.

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

Posted: Tue Oct 01, 2013 12:17 pm
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.

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

Posted: Tue Oct 01, 2013 1:29 pm
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.