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.
How CANBUS transmission speed is set to 5 kb/s?
Moderator: Benj
- 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?
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.
Change to some new values, e.g. as follows
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.
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
Code: Select all
%a_SPI_Master_Byte(0x07); // CNF3 0x28
%a_SPI_Master_Byte(0xff); // CNF2 0x29
%a_SPI_Master_Byte(0x27); // CNF1 0x2A
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?
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.Change to some new values, e.g. as followsCode: 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
Having had a quick look I think the example above would give a CAN bit rate of 10kb/sCode: Select all
%a_SPI_Master_Byte(0x07); // CNF3 0x28 %a_SPI_Master_Byte(0xff); // CNF2 0x29 %a_SPI_Master_Byte(0x27); // CNF1 0x2A
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.