Rs485 and CAN on the same pins? - Page 1
Forum section: electronics / projects

author: max_torque
author_rank: Super Contributor
timestamp: May 06, 2022, 04:21:10 pm
content: I have two "controller" devices, one talks RS-485 to some slaves, the other talks CAN to some slaves. We currently fit one of the other depending on the system and slaves being used. In order to simplify our control devices, would it be possibly to have a single "controller" that shares its output pins between CAN and RS-485, although not at the same time, it would be a software selection over which bus type the data was sent, but no application would need both or need to change from a fixed set.Obviously it would be possible to have a "at build" hardware option on the pcb, ie to populate either the RS-485 stuff or the CAN stuff, but it would be really nice (at our low volumes) to have one standard hardware build, and use software to select which coms bus is used?Both buses are 120 ohm terminated and both are differential, but the voltage levels are different and CAN has a zero differential volts valid state but RS-485 doesn'tDo i need trancievers with known "passive" states, ie ones that can be effectively put to sleep and hence ignore any traffic on the bus?Anyone tried this before??

author: ajb
author_rank: Super Contributor
timestamp: May 06, 2022, 06:09:36 pm
content: Provided that both transceivers can withstand the voltage levels imposed by the other bus type and can have their driver outputs disabled when not in use, the only potential issue I see is the additional bus load provided by the extra inactive receiver. I'm not super familiar with CAN transceivers, but low unit load RS485 transceivers are readily available which would help mitigate that issue. If there aren't a ton of devices on the bus already then one additional shouldn't be much of an issue? RS485 has a common mode range of -7.5V to +12V, versus CAN's -2V to +7V, but transceivers with wider withstand ranges are common for both bus types, so that shouldn't be an issue. Most RS485 transceivers have both driver enable and receiver output enable pins that would allow you to share the rx line on the host side easily, but sharing the tx line might be trickier.

author: langwadt
author_rank: Super Contributor
timestamp: May 06, 2022, 06:30:45 pm
content: https://electronics.stackexchange.com/questions/108252/running-can-bus-with-rs-485-transceiver

author: Berni
author_rank: Super Contributor
timestamp: May 06, 2022, 06:35:43 pm
content: Yep you can even do it with the exact same transceiver and switch between RS485 and CAN protocol on the fly in software.That being said the CAN transceivers tend to be more resilient to bad things happening on the bus, so you can get one that can survive something like +/- 30V on the pins with no problem, not a lot of RS485 are that tough, but tend to be capable of higher speeds.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 06, 2022, 09:39:08 pm
content: It can be made to work, and on your bench it's probably not too difficult, but you will eat into margins and it's likely you get more errors due to misinterpreted data, due to wonky bits output to the cable, and the receiver misinterpreting them due to noise.An alternative you can do is to use both a CAN and an RS485 transceiver and just connect them in parallel, and only enable the chip you need at some time.It would be a bit more expensive because of the extra chip, but at least you are not abusing the chips t send the wrong protocol.

author: max_torque
author_rank: Super Contributor
timestamp: May 07, 2022, 11:12:38 am
content: At the volumes we are talking about, having parrallel transceivers on the pcb tied to the same output pins is fineWhat we can't easily do is to engineer in any extra pins because i would like the new pcb to be a drop in replacement for the original.

author: Siwastaja
author_rank: Super Contributor
timestamp: May 07, 2022, 11:21:45 am
content: Parallel transceivers, and obviously a few more MCU IO pins (UART + enable/direction signal(s) = 3-4 pins to RS485 transceiver, CAN + enable = 3 pins to CAN transceiver). This should be totally OK because most CAN and RS485 transceivers keep the bus alive even when powered down or in disabled (or listen-only) mode.

author: Berni
author_rank: Super Contributor
timestamp: May 07, 2022, 04:00:18 pm
content: Yep you can parallel a RS485 and CAN transceiver onto the same 2 wire bus. As long as one of them stays in the idle state and never transmits anything then it is like it's not even there.The only thing that might get in the way is using the RS485 biassed terminator on a CAN bus. But you can use CAN style termination on a RS485 bus if you use the transceivers that see 0V as a idle level rather than wanting to actually see some voltage on there.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 07, 2022, 10:54:56 pm
content: Quote from: max_torque on May 07, 2022, 11:12:38 amDoes that mean it has to be completely transparent to the software?Maybe you can switch the enable signals with a normal or solder jumper or a 0 Ohm resistor.The bias pulling for RS485 to have a defined bus state if all drivers are idle has always been a bit of a weak point for RS485, but maybe you can use it to your advantage here. Maybe you can sense the presense of such a biasing network and use it to select either the CAN or RS485 transceiver. I have not thought deep about it, but my first guess is it would take too much hardware, but that's up to you to figure out.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 07, 2022, 11:03:10 pm
content: Another Idea:And RS485 transmitter can be abused as a CAN transmitter by sending data to the enable pin instead of the data pin.Receiving CAN with a RS485 receiver needs extra hardware to get decent noise margins.Maybe two anti-parallel diodes in one of the bus signals, combined with an weak pullup or pulldown resistor on the IC side can help by creating an offset when the CAN bus is idle. A diode drop is also low enough to (probably) not cause mayor problems when sending, but it would make the bus slightly assymetrical.You could make it symmetrical by using two anti-parralel (maybe skottky?) diodes in each bus line.It's just some ideas and untested, and it all will eat in on your noise margins.Do with it as you wish.