Switching / Multiplexing CAN Bus - Page 1
Forum section: electronics / general

author: jnz
author_rank: Frequent Contributor
timestamp: October 05, 2018, 08:26:55 pm
content: 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 >> microC.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

author: abraxa
author_rank: Frequent Contributor
timestamp: October 06, 2018, 07:01:29 am
content: 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

author: CM800
author_rank: Frequent Contributor
timestamp: October 06, 2018, 03:11:10 pm
content: Could always get an MCU with two CAN peripherals.

author: jnz
author_rank: Frequent Contributor
timestamp: October 06, 2018, 03:34:04 pm
content: Adding can modules is not an option.

author: jnz
author_rank: Frequent Contributor
timestamp: October 06, 2018, 03:37:36 pm
content: Quote from: abraxa on October 06, 2018, 07:01:29 amI 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.

author: NorthGuy
author_rank: Super Contributor
timestamp: October 06, 2018, 03:51:17 pm
content: 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.

author: nctnico
author_rank: Super Contributor
timestamp: October 06, 2018, 03:53:58 pm
content: 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.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 06, 2018, 10:44:54 pm
content: 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

author: jnz
author_rank: Frequent Contributor
timestamp: October 06, 2018, 11:51:55 pm
content: 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?)

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 07, 2018, 01:27:57 am
content: On the logic side, an analog switch aka mux/demux will do fine. Probably 74HC4xxx something, or any of the usual switch thingies.Tim

author: jnz
author_rank: Frequent Contributor
timestamp: October 08, 2018, 06:05:43 pm
content: 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 featureTransceiver 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?

author: JPortici
author_rank: Super Contributor
timestamp: October 08, 2018, 06:07:46 pm
content: There are many transceivers with a logic level shutdown input, don't need to switch the transceiver off

author: dgtl
author_rank: Regular Contributor
timestamp: October 08, 2018, 07:08:43 pm
content: 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.

author: jnz
author_rank: Frequent Contributor
timestamp: October 10, 2018, 10:09:36 pm
content: Quote from: JPortici on October 08, 2018, 06:07:46 pmKnow any off hand? Because while almost all have standby, that won't work because it leaves receive pulses open for wakeup.