Author Topic: Switching / Multiplexing CAN Bus  (Read 3155 times)

0 Members and 1 Guest are viewing this topic.

Offline jnzTopic starter

  • Frequent Contributor
  • **
  • Posts: 593
Switching / Multiplexing CAN Bus
« on: October 05, 2018, 08:26:55 pm »
I tried the search and didn't see a great answer.

I have 500kbps CAN Bus coming in on pins 1-2 and 1Mbit CAN on pins 3-4. I have one CAN module and only ever need to use 1 bus at a time. So my options are to split the lines somehow. 

  • Running current is not an issue.
  • I can wake on either bus.
  • Non-isolated CAN bus, typical stuff.
  • The termination should be different for the 1mbps bus and the 500kpbs buses.
  • I am space limited on the PCB! Cost limited after space but it's definitely #2.

My options as I see them...

1. Run dual transceivers. Sub options: 
A. Use transceivers that I can power down with a mosfet or some other switch, most transceiver claim to disconnect from bus when unpowered. 
B. Put transistor/switch on the lines between the micro and transceiver. So in this way I can stop the RX and TX signals from getting to the "wrong" transceiver at any time. pin >> termination transceiver >> switch >> micro 
C. Use the Micro's pin remapping. Carefully place the transceivers so that they are wired to valid micro lines, but internally in the micro I can switch these. This seems like the best option - but I'm planning for the possibility that I can't remap for some reason. (seems like best option) 

2. Split/Mux the CAN Bus lines to a single transceiver. So that pin >> transistor/switch >> termination >> transceiver >> micro.


Things I'm not sure of:
  • Best option?
  • Others options?
  • Not entirely sure how to determine if splitting or multiplexing transceivers will work or if it might add too much capacitance or some other weird electrical issue.
  • There are special transceivers with SLEEP pins (vs Standby which would NOT work as it allows signals to RX) but I didn't want to lock into a specific transceiver unless there was a good reason.
Any advice would be very welcome! Thanks



 

Offline abraxa

  • Frequent Contributor
  • **
  • Posts: 377
  • Country: de
  • Sigrok associate
Re: Switching / Multiplexing CAN Bus
« Reply #1 on: October 06, 2018, 07:01:29 am »
You write "I can wake on either bus", which to me sounds like "Either bus can send at any time and I need to wake up then". Is this correct? If so, how would you do this with a single transceiver?

Even with two transceivers, how would you do this? Do you have WUP frames or do you need to wake up on *any* incoming frames?

From what I gather, it could make sense to explore the option to have one bus attached to the MCU's CAN peripheral and an external CAN controller attached via SPI for the second bus - e.g. https://www.microchip.com/wwwproducts/en/MCP25625
 

Offline CM800

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: 00
Re: Switching / Multiplexing CAN Bus
« Reply #2 on: October 06, 2018, 03:11:10 pm »
Could always get an MCU with two CAN peripherals.
 

Offline jnzTopic starter

  • Frequent Contributor
  • **
  • Posts: 593
Re: Switching / Multiplexing CAN Bus
« Reply #3 on: October 06, 2018, 03:34:04 pm »
Adding can modules is not an option.
 

Offline jnzTopic starter

  • Frequent Contributor
  • **
  • Posts: 593
Re: Switching / Multiplexing CAN Bus
« Reply #4 on: October 06, 2018, 03:37:36 pm »
You write "I can wake on either bus", which to me sounds like "Either bus can send at any time and I need to wake up then". Is this correct? If so, how would you do this with a single transceiver?

Even with two transceivers, how would you do this? Do you have WUP frames or do you need to wake up on *any* incoming frames?

From what I gather, it could make sense to explore the option to have one bus attached to the MCU's CAN peripheral and an external CAN controller attached via SPI for the second bus - e.g. https://www.microchip.com/wwwproducts/en/MCP25625

I can wake from either bus as in it doesn’t matter if I’m “switched” to A or B bus. But during the normal runtime I might need to switch once or twice.

Adding module isn’t in the cards. The new MCP3527/2518 is small, but imagine I only wrote about 1 bus, but the problem can extend to 4 or 8 buses.
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3146
  • Country: ca
Re: Switching / Multiplexing CAN Bus
« Reply #5 on: October 06, 2018, 03:51:17 pm »
If your MCU has PPS, you can use it to switch between transceivers. No need to power transceivers down. They're harmless if you don't transmit anything.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: Switching / Multiplexing CAN Bus
« Reply #6 on: October 06, 2018, 03:53:58 pm »
I'd use multiple transceivers anyway because in the end you have to make sure the CAN busses are seperated (which is what the transceiver are designed to do). Secondly: IIRC CAN transceivers have rx and tx enable lines so connect all the RX and TX together and use the enable lines as a mux.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21681
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Switching / Multiplexing CAN Bus
« Reply #7 on: October 06, 2018, 10:44:54 pm »
FYI, don't use an analog switch to change the physical bus.  The required voltage range is much wider than VCC to GND.

Opto relays may be an option, but mind the resistance and capacitance.  Mechanical relays are still king, but you will lose space that way.

Duplicate PHYs is not a bad idea, and yeah, if you can route that on the MCU that's nice.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline jnzTopic starter

  • Frequent Contributor
  • **
  • Posts: 593
Re: Switching / Multiplexing CAN Bus
« Reply #8 on: October 06, 2018, 11:51:55 pm »
Tim,

Good info. My main plan is remapping, but I definitely have a future application with the same issue that remapping won’t work.

So if you couldn’t remap, is there a dpdt switch or mosfet solution that might be able to switch the 0-5V line between micro and transceiver? I figure that might be the better place to switch. That’s not PHY layer CAN, I don’t really know the exact term for that (TTL?)
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21681
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Switching / Multiplexing CAN Bus
« Reply #9 on: October 07, 2018, 01:27:57 am »
On the logic side, an analog switch aka mux/demux will do fine.  Probably 74HC4xxx something, or any of the usual switch thingies.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline jnzTopic starter

  • Frequent Contributor
  • **
  • Posts: 593
Re: Switching / Multiplexing CAN Bus
« Reply #10 on: October 08, 2018, 06:05:43 pm »


So... It seems my two options if I'm committed to multiple transceivers and can not remap at the micro are:

1. Disconnect or switch the module to transceivers TX / RX lines. Using a selectable switch or mux on the CMOS (ttl?) side. My transceivers are always powered and this seems a little wasteful, but I can limit all of my muxing to a single buffer/switch.

2. Utilize the feature Transceiver disengages from bus when not powered (zero load) and use small high side drivers to power or cut power to the transceivers themselves. Just make sure that I power only the transceiver that I should be using at the time. Benefit of saving a little power by absolutely turning off the transceiver and I might be able to find an appropriate dual or quad transistor package that is space efficient for this purpose (can transceiver can draw up to 70mA or so).


Switch the logic lines route or switch the power on/off?
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3461
  • Country: it
Re: Switching / Multiplexing CAN Bus
« Reply #11 on: October 08, 2018, 06:07:46 pm »
There are many transceivers with a logic level shutdown input, don't need to switch the transceiver off
 

Offline dgtl

  • Regular Contributor
  • *
  • Posts: 183
  • Country: ee
Re: Switching / Multiplexing CAN Bus
« Reply #12 on: October 08, 2018, 07:08:43 pm »
No need to shutdown anything, just set txd to recessive state (high). It would be nice to use can transceivers with dominant timeout so when something happens, the stuck-on dominant would not kill the bus for the rest of the devices on the bus. I would definitely keep the busses separate and avoid any muxing before transceivers (only relay would be acceptable). There is a lot of possibilities to go wrong at the signal levels, the can transceivers have specially designed inputs for that kind of stuff.
Using the mux inside uc is the simplest way. Just wire up both transceivers and configure the tx pins to gpio output high or gpio input (with external pullup resistor on board, that's anyway wise to have). Then mux the inputs between gpio and can.
If input mux is not available, add external logic to mux/demux the inputs. There are a lot of possible solutions, ie digital logic, analog mux chips, transiceivers with 3-state outputs etc.
Or just find an uc with two can peripherals. There are a lot, ie STM32F2 and upwards.
 

Offline jnzTopic starter

  • Frequent Contributor
  • **
  • Posts: 593
Re: Switching / Multiplexing CAN Bus
« Reply #13 on: October 10, 2018, 10:09:36 pm »
There are many transceivers with a logic level shutdown input, don't need to switch the transceiver off

Know any off hand? Because while almost all have standby, that won't work because it leaves receive pulses open for wakeup.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf