CAN bus over fiber - How can it be done? - Page 1
Forum section: electronics / projects

author: AndersJ
author_rank: Frequent Contributor
timestamp: September 11, 2018, 10:13:12 am
content: I want to replace copper cable with industry standard fiber components.In the simplest case I want a point to point CAN extender/repeater.Better even, is if a CAN bus can be implemented using fiber cable.Do suitable components exist?Is this at all possible within a reasonable budget, say USD10-20 per node?

author: Rerouter
author_rank: Super Contributor
timestamp: September 11, 2018, 11:11:02 am
content: On a single mode fiber yes, however the optical routing I would leave to you, because the fiber does not suffer from external interference you treat it as a single ended signal instead of differential, from there decide whether presence of light or lack of light works best for your circuits and wire up to your liking.

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: September 11, 2018, 11:15:13 am
content: Isn't canbus wired or? Can fiber lines be wired or?

author: Rerouter
author_rank: Super Contributor
timestamp: September 11, 2018, 11:21:48 am
content: canbus is generally a piggyback bus, however he only described point to point, so assuming 2 nodes.There are optical splitters that could be used for a true multi drop network, but no idea what you can get away with on the cheap.

author: digsys
author_rank: Unknown
timestamp: September 11, 2018, 11:28:23 am
content: I make Fiber to all types of HW converters - incl RS485, CAN, I2R, SPI, SCI etc etc and they don't have to bejustend<>end. If you want a small groupinoriginalformat, it's just a bit of smart logic. The most common setup is to carry a HOST > long distance fiber > native multi-node.

author: filssavi
author_rank: Frequent Contributor
timestamp: September 11, 2018, 11:29:43 am
content: I'd say that anything can be done, given enough time and money...In this case it depends on what you want to do1) if you want to use optical fiber to connect two distant canbus hubs than it is very easy just connect the can TXD and RXD from the can transceiver to your fiber transceiver at both sides and be done with it, in this case the optical fiber is just an extension of the electrical wires2) doing a fully optical CANbus network doesn't make any sense since it would be extremely expensive

author: AndersJ
author_rank: Frequent Contributor
timestamp: September 11, 2018, 11:33:05 am
content: Yes,CAN is wire-or, sort of.Listening nodes generate a ack while the sender simultaneously transmits its message.That is one of my major concerns.Yes,point to point is a start.I also want the entire multi node CAN bus on fiber.I’m sure this is extremely difficult.That is why I seek assistance.

author: digsys
author_rank: Unknown
timestamp: September 11, 2018, 11:53:10 am
content: Quote from: AndersJUse the force Luke .. use the Force :-) If you study it logically, it really isn't that hard / complex. The one time I can't post my cct, as it is still used in security.

author: taydin
author_rank: Frequent Contributor
timestamp: September 11, 2018, 12:04:27 pm
content: If it's wire-or logic, then it seems this is only a matter of converting light on/off to logic 1/0 at the receiver and the opposite at the transmitter. Once everything is at the logic 1/0 level, existing CAN should work just the same. Am I missing something?

author: AndersJ
author_rank: Frequent Contributor
timestamp: September 11, 2018, 12:13:25 pm
content: taydin, I don’t think you are missing anything.If the active ack bit means light is ON in the fiber,then I believe the receivers will be able to generate the ack.I’m not familiar with how fiber tranceivers work.I assume they connect via a PECL driver to the CAN controller.I have seen 155 Mb/s fiber tranceivers, but they cost USD100.What tranceiver type, fiber and fiber connectors are appropriatefor moderate bit rates, up 1 Mb/s?

author: digsys
author_rank: Unknown
timestamp: September 11, 2018, 12:59:06 pm
content: Quote from: AndersJThere's heaps of these types of modules out there -www.apacoe.com.tw/files/LM32-A3S-Px-N-ST-V1.1.pdfThis is 1 series I use. Multi-mode, Single-mode, ST, SCAll you need is 3V3/5V and signal in/out. Nothing to learn or design. Easy peasy :-) .. any speed you want

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: September 11, 2018, 01:17:01 pm
content: But how do you wire-or a fiber? You'd have to be able to drive the same fiber from any/both node/ends at the same time.

author: AndersJ
author_rank: Frequent Contributor
timestamp: September 11, 2018, 01:45:32 pm
content: QuoteThanks for your suggestions.Much appreciated since this technology is new to me.There are many devices to choose from.- What tranceiver and fiber would you recommend for a 2-5 km 1 MB/s connection?- Are these components stocked by the standard distributors, or will I need to contact the factory directly?

author: digsys
author_rank: Unknown
timestamp: September 11, 2018, 02:01:12 pm
content: Quote from: GeorgeOfTheJungleNot sure your question but - Those modules have a Txd and an Rxd .. They pair to their partner Rxd and Txd at the other end. ie Txd > Rxd , Rxd > TxdAs for ALL the fancy bus logic, you do that with discrete logic driving the fiber. Example of a Fiber <> RS232 converter I made ages ago.

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: September 11, 2018, 02:14:44 pm
content: But TxD and RxD are the same thing in a wired-or line, and must be open collector. At the very least you're going to need some glue to interface that properly with a canbus, me thinks.

author: digsys
author_rank: Unknown
timestamp: September 11, 2018, 02:20:18 pm
content: Quote from: GeorgeOfTheJungleCorrect .. you have CAN driver interface logic at each end, you then "create" Txd / Rxd / Ack / Idle etc with the logic. The sky is the limit, even create your own super_CAN logic :-)EDIT: If you mean ... using a single bi-directional fiber ... well, there's NO LAW that says you can't split each end into individual Rxd / Txd .. heck you can even ADD2 more lines for ACK / NACK. >4 fiber lines. Rxd/Txd fiber pairs are far easier and cheaper to implement. You're simply splitting the signal up into it's componentsat the HOST and rebuilding them at the other end.

author: digsys
author_rank: Unknown
timestamp: September 11, 2018, 02:32:45 pm
content: Quote from: AndersJYes. This was just an example of a real simple converter - ~115Kb is all I needed. In my reply above, I listed SingleMode / Multimode driver pairs.If you check their site, they make all sorts of fiber modules, and there is a single bi-directional device out there. It was a pain to use, so I didn't complete a PCB.Planet and Moxa make HEAPS of off-the-shelf converters, of all types, even do mixed modes. Good prices as well.

author: SparkyFX
author_rank: Frequent Contributor
timestamp: September 11, 2018, 10:43:55 pm
content: Can´t have low impedance light, right? That requires inverting the logic levels (recessive=dark=1, dominant=light=0) might work if the fiber transceiver actually would read during send and translate properly to electrical levels. Then the distance and speed might be an issue.At least if it needs to be a full featured CAN, because not only the ACK needs to be active high, but the whole arbitration phase during message id transmission is active high, remote frames require wirespeed too.So any kind of buffering would be a problem if you´d need to NACK frames or get near maximum bus load.

author: digsys
author_rank: Unknown
timestamp: September 11, 2018, 11:54:33 pm
content: Fiber systems have come a looong way- this is just one example of what is out there -https://www.moxa.com/product/ICF-1170I.htmSome of the techniques out there ... I've played with some of these ... you can do 8 bit data on a single beam - intensity is decoded into 256 levels and we senda reference level pulse before each "data byte" - the decoder then SETS the base line. I've also seen bi-directional 8 bit data - different modulation techniquessort out the direction and the data. Fiber is pretty awesome, the shlt you can do with it :-)If you ask - "Jimmy, how did you know what direction / tristate?" .. the old trick was to have a 1-2R resistor in series with the data lines. High speed op-ampswould sense the direction and immediately switch on Txd or Rxd mode. You had a "hold delay" to cover the 0V period, say 25% longer than the max expected.It didn't matter if you "strayed" into the next frame, as there is always a "dead zone" ... sort of like RS232 samples 16+ times every bit and collects an average.As long as you got it right in the center, good to go. Heaps of clever tricks.

author: girts
author_rank: Contributor
timestamp: September 12, 2018, 12:51:02 am
content: Due to ACK propagation delay is important, no simple solutions possible.Must use gateway at each side and organize hardware / software stack. Result - 2 subnets. What's between them is up to you: optics, RS485, RF - everything you wish and prefer.

author: amyk
author_rank: Super Contributor
timestamp: September 12, 2018, 01:46:11 am
content: Propagation delay in fiber is the speed of light. Could be even faster than regular copper wire.

author: girts
author_rank: Contributor
timestamp: September 12, 2018, 02:25:07 am
content: Quote from: amyk on September 12, 2018, 01:46:11 amSpeed of light in glass = about 2/3 speed of light in vacuum. In addition, path is not straight.So... we get same 5 nanoseconds per meter as for cat5 twisted pair.

author: timpattinson
author_rank: Contributor
timestamp: September 12, 2018, 02:31:53 am
content: A completely off the shelf system, though a little pricy:https://www.peak-system.com/PCAN-LWL.214.0.html?&L=1

author: Leiothrix
author_rank: Regular Contributor
timestamp: September 12, 2018, 02:44:33 am
content: Quote from: amyk on September 12, 2018, 01:46:11 amPlus the gate delays in the converter boxes at both ends, it all adds up.It is certainly something that needs to be considered if you have strict timing requirements.

author: IDEngineer
author_rank: Super Contributor
timestamp: September 12, 2018, 01:40:49 pm
content: There seems to be some confusion here. I think everyone knows the data but we're talking about different things.1) The CAN network itself is, indeed, a "wired or" type of system. Each node can be either dominant or recessive. Data on the differential pair is bidirectional, can be "controlled" by a single node, collisions can occur, etc. There is no separate TX and RX data path, the two are combined on one differential pair.2) On the circuit side of the CAN transceiver interface chips, there ARE separate TX and RX signals. Those wires are single direction, no collisions occur.Connecting the separate TX and RX signals (item 2 above) using two optical fibers is straightforward.But I believe what the OP wants is a CAN network (item 1 above, the differential pair) that uses an optical fiber instead of a differential copper pair. That isn't going to be straightforwardsince implementing a "wired or" system with optics is, well, challenging. Sure it's possible to use interference to cancel light... keeping the phasing aligned is left as an exercise for the reader.As for the discussions of timing and propagation delays - CAN has specs for those with the usual inverse relationship between bit rate and distance. Fiber isn't going to be slower than an equivalent copper-based electrical connection so the standard calculations can safely be used. But let's worry about those details after the OP gets his bidirectional wired-or optical link working....

author: girts
author_rank: Contributor
timestamp: September 12, 2018, 03:48:59 pm
content: Quote from: IDEngineer on September 12, 2018, 01:40:49 pmHighly likely you will get problems because CAN engine monitors Rx state and compares it with Tx state. Because of arbitration.Although, method can work for short distances.

author: IDEngineer
author_rank: Super Contributor
timestamp: September 12, 2018, 11:28:07 pm
content: Quote from: girts on September 12, 2018, 03:48:59 pmThe CAN interface chip handles arbitration, retransmission, etc. internally. The chip does not care if its TX and RX signals passed through an optical link on their way to the chip.

author: langwadt
author_rank: Super Contributor
timestamp: September 12, 2018, 11:37:18 pm
content: Quote from: IDEngineer on September 12, 2018, 01:40:49 pmwith out thinking too much it should be straight forward, light is dominant, dark is recessive

author: girts
author_rank: Contributor
timestamp: September 13, 2018, 01:28:59 am
content: Quote from: IDEngineer on September 12, 2018, 11:28:07 pmNot right. Just study what is CAN.CAN engine continuously monitors what happens on line. Every node can send at ANY time. All nodes are equal (no master/slave ideology, all are masters). If one node sends,allremaining nodes send ACK as dominant bits on line. No ACK - sender repeats message until it is acknowledged (this may cause totally overloaded bus caused by one "damaged" node). Arbitration is based on message ID and so on...

author: IDEngineer
author_rank: Super Contributor
timestamp: September 13, 2018, 02:14:14 am
content: Quote from: girts on September 13, 2018, 01:28:59 amTrue.QuoteNot quite. There is priority based on the CAD ID value, with lower values having higher priority. If two nodes transmit at precisely the same time, the lower ID will "win" and the higher ID will back off. Since the lowest ID will always win, you can think of it as a "master" (though it does not formally grant access to individual nodes).The chip really doesn't care if its TX and RX signals are run through a pair of optical links. Logically, that is exactly the same as if they remained electrical. Presuming this is an MCU environment, neither the MCU nor the CAN interface chip know or care what happens to those two signals between them unless you introduce excessive latency. Again, I'm talking about the logic level TX and RX signals - not the differential pair that is the CAN network itself.

author: girts
author_rank: Contributor
timestamp: September 13, 2018, 02:47:09 pm
content: Quote from: IDEngineer on September 13, 2018, 02:14:14 amWhat is not quite? That's what we are talking about. Node must see what happens on Rx line.If propagation is too large, there will be issue. You are limited up to 1 meter, I think. Hard wired. Delay in optics most likely makes this close to impossible and unreasonable anyway. Because you add some delay between Tx and Rx.That's all to say.

author: IDEngineer
author_rank: Super Contributor
timestamp: September 13, 2018, 03:03:31 pm
content: Quote from: girts on September 13, 2018, 02:47:09 pmSomehow I don't think we're communicating here. We seem to be talking about two different things. I'll wait for others to chime in.

author: langwadt
author_rank: Super Contributor
timestamp: September 13, 2018, 05:08:01 pm
content: Quote from: girts on September 13, 2018, 02:47:09 pmafair Bosch specs something like 30meters for 1Mbit CAN

author: max_torque
author_rank: Super Contributor
timestamp: September 13, 2018, 05:52:39 pm
content: The critical factor is that CAN transceivers (the bit that converters the mono-directional single ended TX and RX TTL level signals from the CAN controller logic into a single, differential bus) are wired to always return the differential bus's state back via the RX line. As a result, as the TX line toggles out the bits onto the bus, the RX line loops those bits back to the controller on the RX line. In this way, the controller can monitor the state of the bus, and detect collisions (because say it requests a recessive state on the bus, but gets a Dominant state back on the RX pin, it knows there's been a collision and stops transmitting). Message acknowledgment also operates, where any node that has received a valid message adds an extra dominant bit onto the bus at the end of that message. That way, the sending node knows that someone else is actually connected to the bus (of course it doesn't' know who has heard, just that someone has!).So, if you want to replace the "OR'd" wired bus with an optical version, you need to include some way of "reflecting" the TX back onto the RX line in each node, optically or electrically in the same way that a standard CAN transceiver would do!

author: max_torque
author_rank: Super Contributor
timestamp: September 13, 2018, 05:55:34 pm
content: Some useful reading here:http://ems-wuensche.com/about-can/can-extend-optical-article.html

author: IDEngineer
author_rank: Super Contributor
timestamp: September 13, 2018, 06:03:40 pm
content: Quote from: max_torque on September 13, 2018, 05:52:39 pm...which is why I said, in the context of doing it optically:Quote

author: knapik
author_rank: Regular Contributor
timestamp: September 15, 2018, 02:25:55 pm
content: This is something that I've been working on a lot currently for my student project. I'll let you all know if I figure out anything, and I'lldefinitelybe interested in monitoring this thread

author: knapik
author_rank: Regular Contributor
timestamp: September 16, 2018, 04:55:38 am
content: Quote from: max_torque on September 13, 2018, 05:55:34 pmYep, that was definitely useful. It gave me the right information which I should be searching for, so thank you very much!For AndersJ, I found a TI CAN FD repeater reference design. In here they're using two transceivers back to back, and they show the arbitration logic used to handle that in the schematic.http://www.ti.com/tool/TIDA-01487#technicaldocuments

author: 336V
author_rank: Newbie
timestamp: February 21, 2023, 11:46:33 pm
content: This was existing thread in 2018 I just discovered. Is it dead?I'd like to know if someone succeeded to create physical CAN connection over a fiber or any other optical way.Dominant/recessive = light on/light off seems very straight forward substitution of copper with light. Multiple nodesshould not be an issue if there's a light sources (LEDs) from any node produce light into a medium, say a piece of opaqueplastic, with photodetectors around it connected to all receiving nodes, so all nodes sense light/no light just like allwould electrically sense dominant/recessive voltage on a twisted copper pair CAN bus.Any thoughts?Thanks!