Welcome to the forum   
Welcome Guest! To enable all features please Registers on the forum or Register.

Notification

Icon
Error

Share
Options
View
Go to last post in this topic Go to first unread post in this topic
Offline Webmaster  
#1 Posted : 15 May 2020 19:31:38(UTC)
Webmaster


Joined: 25/07/2001(UTC)
Posts: 11,161
In another recent topic about the Märklin implementation of the CAN bus, there were some out-of-context posts praising USB instead.

I thought that the out of context posts were interesting and needed a topic of its own. Smile

Let's see if we can discuss the differences and pros/cons of different serial bus wiring systems...
Just to get us all some more common knowledge and design philosophy views about the technical bits that surround us.


I'm going bold with my "helicopter view" about how eg CAN & USB work with a very simplified ancient computer network technician view on it...

- CAN is like an IBM Token Ring computer network from the 80's. Each active connected unit is a self serving "master" unit, claims the network resources when addressed and forwards other packets.
- USB is point to point with a "master/slave" just like the good old IBM SDLC from the 70's with a hub/controller and use point to point connection from the connected units to the controller.

A very simplified view of USB, of course, since SDLC is synchronous over 2 wires and USB is asynchronous over 2 wires - but "master/slave" was the point in my logic... BigGrin


So - please enlighten us all with your opinions, thoughts and advice regarding serial bus communication in an understandable way so even I can understand. Smile
Juhan - "Webmaster", at your service...
He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Old Chinese Proverb]
thanks 3 users liked this useful post by Webmaster
Offline clapcott  
#2 Posted : 16 May 2020 03:34:09(UTC)
clapcott

New Zealand   
Joined: 12/12/2005(UTC)
Posts: 2,433
Location: Wellington, New_Zealand
My understanding is at odds with the comparing of Token ring with CAN (Physical)

Token ring (802.5) offers a physical implementation (the cable) for single direction of travel. When an installation wiring is complete it is literally a ring.
If the ring is disrupted there is a loopback using a separate (backup) pair of wires in the cable.
Even the node/junction to device (PC) cable uses separate pairs of wires for receive and transmit.
https://en.wikipedia.org...al_Token_Ring_Wiring.jpg

This one directional implementation meant no (minimal) CDCA (= Collision detection - Collision avoidance)
e.g., those that remember telephone "Party lines" where you needed to lift the handset and listen for a while or ask "Working?"

CAN is far more aligned with Ethernet (at least the original Xerox 802.3 and 10Base2 implementation around at the same time that Token ring was contending with).
The ability and cost saving of two wires in the cable won out when CDCA solutions were defined.
https://networkencyclope...9/08/10base2-network.jpg

Of course ethernet today is , assumed by many, to mean the RJ45 implementation with full duplex (4 wire) solution.
This is NOT the same thing as the 2 wire implementation of a CAN bus.

Before going further I would ask for some clarification about what the model railway modeler is needing from "bus"
I can think of at least 3 aspects
- Power (e.g. for the Mobile Station or remote throttle)
- command/response path
- track synchonisation (RailSync for boosters)

If you do not need to provide power (e.g. a L88 has its own power) then you may factor out that aspect
If you do not expect to use boosters, then the railsync aspect can be discounted

For the Command/Response , two wires are needed at a minimum, but that is the least of the problems.
At this point you move from the physical to the protocol/language aspect. HOWEVER the faster you talk and the more information you wist to transfer the greater the need for the quality and configuration of the wire to cope.
Peter
thanks 3 users liked this useful post by clapcott
Offline kiwiAlan  
#3 Posted : 16 May 2020 05:33:24(UTC)
kiwiAlan

United Kingdom   
Joined: 23/07/2014(UTC)
Posts: 8,104
Location: ENGLAND, Didcot
Originally Posted by: Webmaster Go to Quoted Post

I'm going bold with my "helicopter view" about how eg CAN & USB work with a very simplified ancient computer network technician view on it...

- CAN is like an IBM Token Ring computer network from the 80's. Each active connected unit is a self serving "master" unit, claims the network resources when addressed and forwards other packets.


vaguely, sort of - it is much more than that.
The CAN message has a field at the beginning which allows the message to set it's priority This field is either 11 bits or 29 bits long, and while setting a message priority is the primary function, it can also be used to define message types.

So if more than one device tries to transmit its message at the same time the message with the highest priority takes charge of the bus (I won't describe how it is done, it gets a bit complex) and the lower priority messages realize this is not their time to transmit so back off and try again after the high priority message has finished its transmission. So in the context of the Marklin CAN bus if a device is attempting to transmit a speed change command to the controller, and another device is attempting to communicate that the STOP button has been pressed, then the STOP message will get priority to cause the master controller to turn off track voltage. Any device can attempt to transmit at any time (subject to delay times between messages) and the most important message will get through, with lower priority messages being delayed.

At the receiving end the CAN controllers typically have several filtering mechanisms that allow messages to be sorted into different buffers. So in a Marklin CAN implementation messages could be filtered as Loco speed control, function control messages, and messages for signals and points, each being sorted into separate receive buffers, allowing the program in the controller to deal with each message type separately rather than having to sort them itself. This can produce coding efficiency in the program.

A Token Ring Network requires a master controller that the CAN Bus system does not have. The Token Ring Controller sends a Token onto the network with any messages for devices on that network as a complete packet. As each device receives the packet it looks for any message inside the packet for it, removes it from the packet, reassembles the packet, then attaches any message it has for the another device to the end, and transmits the packet to the next device in the string. Each device on the network does this until the last device eventually sends the packet back to the Network Controller. By this point any messages originally sent by the controller should have been removed. The Controller can now form up another packet of messages with the Token to send on its way. The controller does one other important function in dealing with timeouts due to a Token not being returned or being corrupted in going around network by waiting for the network to go inactive for a period and then sending a new token with message packet.

An important difference between Token Ring and Ethernet is that there will never be message collisions on the network as any device cannot transmit until it has the Network Token in its 'possession'. A result of this is that as a network gets busy an Ethernet network may slow down because of message collisions, while a Token Ring network will keep working up to maximum data capacity. However on a lightly loaded network Ethernet will give better performance as a message goes direct to the destination instead of having to pass through up to every device on the network.


Originally Posted by: Webmaster Go to Quoted Post

- USB is point to point with a "master/slave" just like the good old IBM SDLC from the 70's with a hub/controller and use point to point connection from the connected units to the controller.

A very simplified view of USB, of course, since SDLC is synchronous over 2 wires and USB is asynchronous over 2 wires - but "master/slave" was the point in my logic... BigGrin

So - please enlighten us all with your opinions, thoughts and advice regarding serial bus communication in an understandable way so even I can understand. Smile


USB is a polled network with a master device (typically a PC) as the controller, asking each device on the network in turn if it has any data to transmit, or sending data to a device. On a single USB port this will take 1ms per device (given in the USB specification), Any data movement between devices has to be done by the master, requiring two transfers across the USB Bus, if both devices are on the same port of the master. The master cabinet may have multiple ports, but this may be because there is a USB Hub on the motherboard, so transfers may still be slowed down by the bottleneck between there and the master processor.

The USB Bus has had various speed upgrades over the years which have enabled faster data transfers for devices like video cameras and hard drives, but devices like thumb drives (USB sticks, whatever other name they get given) are speed limited by the memory technology inside them, especially when writing. Devices like SSD drives use other techniques like having lots of internal RAM buffer to maintain transfer speeds of written data.

When it comes to devices like laptops it is surprising how many of the built in devices are using the USB Bus. Items like Bluetooth, Wifi, wired LAN and CD/DVD drives are often all USB devices connected through an internal USB Hub. If using Windows it is normally possible to trace these connections using the Device Manager.

Data transfer on USB is by a self clocking data stream, where the data coding method allows the bit clock to be recovered at the receiving end. This allows subtle differences in device clock rates by the two end devices along with any hubs or repeaters inbetween without causing data recovery problems at high data rates.

thanks 3 users liked this useful post by kiwiAlan
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

| Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.305 seconds.