CAN_Library icon indicating copy to clipboard operation
CAN_Library copied to clipboard

How to instantiate lib for using two MCP2515 controllers?

Open igittigitt opened this issue 7 years ago • 2 comments

I'd like use two MCP2515 controllers for filtering/gateway a midspeed CAN-Bus (125kbs). All your examples, and even the documentation did not mention this setup. All the examples did not explicit instantiate from a class, they just simple use "CAN.".

So i tried to do: CAN TOBUS(9); but this gave me an error while compiling. Also CANClass TOBUS(9); did not work. Even CAN_MCP2515 TOBUS(9); failed.

What do i do wrong? Could you please provide an example for it?

igittigitt avatar Jun 29 '17 06:06 igittigitt

The MCP2515 code wasn’t originally designed to utilize more than one controller. I don’t currently have an example, and I don’t think I have hardware to support that for testing.

I’ll take a look at the code to see if there is an easy modification I can make, but at the moment the support is for only a single MCP2515.

McNeight avatar Mar 09 '18 16:03 McNeight

FWIW the MCP_CAN_lib does support two MCP's, see the example https://github.com/coryjfowler/MCP_CAN_lib/blob/master/examples/Dual_CAN/Dual_CAN.ino . Not sure how much of their code you used, though.

eudoxos avatar Apr 07 '18 18:04 eudoxos