
You need to add some code to the library.
Open
mcp_can_dfs.h
, you need to add some code at about line 272:
#define MCP_16MHz_xxxkBPS_CFG1 (cfg1)
// xxx is the baud rate you need
#define MCP_16MHz_xxxkBPS_CFG2 (cfg2)
#define MCP_16MHz_xxxkBPS_CFG3 (cfg2)
Then let’s go to about line 390, add some code:
#define CAN_xxxKBPS NUM
// xxx is the baudrate you need, and NUM is a number, you need to get
a different from the other rates.
Open
mcp_can.cpp
, goto the function
mcp2515_configRate
(at about line 190),
then add some code:
case
(CAN_xxxKBPS)
:
cf
g1
= MCP_16MHz_xxxkBPS_CF
G1
;
cf
g2
= MCP_16MHz_xxxkBPS_CF
G2
;
cf
g3
= MCP_16MHz_xxxkBPS_CF
G3
;
break;
Then you can use the baud rate you need. And please give me a pull request at
github when you use a new rate, so I can add it to the library to help the other guys.
Projects
If you want to make some awesome projects with CAN-BUS shield, here’s some
projects for reference.