Dual can bus to a single mcu

Hello,
I need to connect two can buses to the arduino, but I also need to save space on the board.

At the moment I have connected two MCP2515 and two MCP2551. Both MCP2515 requires crystal oscillator, but I noticed that they have CLKOUT pin, so if I understand correctly I can use only one crystal oscillator for only one MCP2515 and then use it's CLKOUT pin as an oscillator to another MCP2515 CLK1/CLK2 pin. Would it work?

I was thinking about PIC18*** Mcu's, they have built-in can bus controller, but only single one. That's not enough for me.

If you have any other ideas how I could connect two can buses to a single MCU, let me know it, the less space it takes on the board, the better it would be.

Are you indicating that you have 2 separate can busses or you have a single can buss with 2 or 3 can bus nodes?

An example of 2 separate CAN busses would be 2 cars with a CAN buss and, for nodes, each car has a master control unit and multiple can bus devices attached to it. CAN buss wiki CAN bus - Wikipedia Electrical Properties is a good starting point on connecting multiple nodes to a single buss.

FYI, arduino DUE has 2 CAN Bus (CAN0 and CAN1). Only 3.3V transceivers are needed.

Idahowalker:
Are you indicating that you have 2 separate can busses or you have a single can buss with 2 or 3 can bus nodes?

An example of 2 separate CAN busses would be 2 cars with a CAN buss and, for nodes, each car has a master control unit and multiple can bus devices attached to it. CAN buss wiki CAN bus - Wikipedia Electrical Properties is a good starting point on connecting multiple nodes to a single buss.

I have 2 separate can buses. I'm connecting to the car, so it has 2 separate buses: low speed (windows, locking, audio), and high speed (engine, brakes).

ard_newbie:
FYI, arduino DUE has 2 CAN Bus (CAN0 and CAN1). Only 3.3V transceivers are needed.

Yes I know that, but what I mean is I'm making my own board that plugs in to the car's OBD2 port. Due uses ARM 32-bit mcu which is too big for my project and it would hard to solder onto the board, at least for me..

The DUE Core (100% DUE compatible board) has a much smaller footprint

I use a Freemantics ODBCII plug that reads the cars ODBC... The Freemantics communicates to the mcu via serial. If you price out your components and programming time to read the cars ODBC the Freemantics, I got mine for 30 bucks, is cheaper than building your own, comes in a nice case that plugs into your ODBC port, and saves a lot of time.

I actually don't wanna use any other board/dongle, because I am making my own one. What I want is some kind standalone MCU that has two can bus controllers. Arduino DUE standalone MCU (AT91SAM3X8E) would be an overkill for my project. I need something smaller like a 32 tqfp/ssop package, but I guess there's no such MCU, so I guess I'll be good with Atmega 328 MCU and a couple of MCP2515 & MCP2551.

So there's left one question that I asked in my first post. I looked at MCP2515 datasheet and it says that CLKOUT can be configured to act as clock out pin and OSC1 is marked as an input pin. So if I connect only one crystal oscillator to one MCP2515, then connect it's CLKOUT pin to another MCP2515's OSC1 pin, it should work, right?

Hi,
Have you looked at the canbus module, it is SPI.

If you are making your own canbus interface, as the 2515 is SPI you will be using a minimum of pins on the controller.

Tom... :slight_smile:

That's what I'm using at the moment. I have 2 of these modules connected to the Arduino Uno, but since I need to move everything onto single pcb, I need to use as less space as possible. That's why I want to know if I can use only one crystal oscillator for 2 MCP2515's, since 2 of them would use more space.

druckis3000:
That's what I'm using at the moment. I have 2 of these modules connected to the Arduino Uno, but since I need to move everything onto single pcb, I need to use as less space as possible. That's why I want to know if I can use only one crystal oscillator for 2 MCP2515's, since 2 of them would use more space.

The crystal is not the oscillator, the oscillator is inside the 2515, so it will not be possible to share one crystal between two 2515s.
Even having an external oscillator will mean more hardware.
Also remember small is not necessarily the best, make your prototype serviceable, repairable rather than small.
Get you project working before trying to make it small.
(Being an engineer I abhor miniaturisation for the sake of miniturisation, that makes service and repair impossible especially during development. :))

Tom.... :slight_smile:

My project is already finished and working, I just want to move everything from modules/boards to a single board OBD2 dongle. I need to make it small to avoid accidental hit by leg while getting in/out of the car ;D

I've already drawn the PCB in Fritzing, but before manufacturing it, I need to make sure that I did every possible thing to make it as small as possible. :smiley:

I might misunderstand about crystals and oscillators because I never made such things, only been using chinese modules. I found a topic about 2 MCP2515's and a single crystal: Two MCP2515 one crystal, how to set CLKOUT - Networking, Protocols, and Devices - Arduino Forum and after reading it, I have a clear answer to my question, but now another question came to my mind. Would it be possible to use one 16MHz crystal for Atmega328 MCU and use it's CLKOUT pin (I would divide frequency with prescaler by half) to drive one MCP2515 and then that MCP2515 CLKOUT would go to another MCP2515 OSC1?

If you have your project up and working then maybe this is a change too far, but anyway: STM32G474CET6 has 3 CAN FD controllers in a LQFP48, overall 9mmx9mm. Bit of a learning curve, but at least still easy to hand solder on a PCB.

1 Like

druckis3000:
My project is already finished and working, I just want to move everything from modules/boards to a single board OBD2 dongle. I need to make it small to avoid accidental hit by leg while getting in/out of the car ;D

Can you put it under the seat?
What does your project actually do?
Thanks.. Tom.. :slight_smile:

arduarn:
If you have your project up and working then maybe this is a change too far, but anyway: STM32G474CET6 has 3 CAN FD controllers in a LQFP48, overall 9mmx9mm. Bit of a learning curve, but at least still easy to hand solder on a PCB.

I will take a look at this, thanks.

TomGeorge:
Can you put it under the seat?
What does your project actually do?
Thanks.. Tom.. :slight_smile:

It's a function extender, you know, automatically closing windows, comfort blinker, showing more useful information in the dashboard than OEM does and so on.. ;D Unfortunately I can't put it wherever I want to. I need to have access to both can buses and electronic components in the car barely use (if any at all) both them. Additionally I would need to splice wires, where connecting dongle to the OBD2 port doesn't require it.

I guess that it'll be best if I change design to single crystal for 2 MCP2515's and that's it. Took a look at my PCB and single crystal for all project wouldn't save that much space :smiley: