CAN physical and transport layer
CAN is a field bus. It operates with the CSMA/CA (Carrier Sense Multiple Access / Collision Avoidance) method. It means that collisions during bus access
are avoided by a so called bitwise arbitration. The bits are coded NRZ-L (Non Return to Zero – Low).
A cyclic redundancy check (CRC) and other safety mechanisms provide a secure transmission. For synchronisation a mechanism called “bit stuffing” is used. CAN is a multi-master system, i.e. several equal bus nodes can be connected without a bus master supervising the communication. In principle a CAN bus can be realized with copper wire or in fibre optic cable.
The common CAN implementation with copper wire operates with differential signals, transmitted via two wires: CANHIGH, CANLOW. Therefore CAN has a good common mode rejection ratio.
Data is transmitted with bits that can either be dominant or recessive. The dominant (0) always overwrites the recessive (1).
The topology of a CAN network is a line, which can be extended by stubs. The maximum length of a stub is limited to 0,5m.
The network always has to be terminated on both ends with 120 Ohm each (between CANHIGH and CANLOW). Other locations or values are not allowed.
The arbitration mentioned before is used to control the bus access of the nodes by prioritization of the CAN-Identifier of the different messages.
Every node monitors the bus. If more than on node wants access on the bus, the node with the highest priority of the messages ID succeeds and the other nodes retreat until there is “silence” on the bus (see below example). Technically the first dominate bit of the ID send overwrites the corresponding recessive
bit of the other IDs. In case that more than one node uses the same CAN-ID an error occurs only at a collision within the rest of the frame.
In principle a CAN-ID should only be used by a single node.

Due to the arbitration there is a ranking of the messages. The message with the lowest ID has the highest priority and therefore it has almost instant access on the bus. The exception is that an ongoing transmission will not be interrupted. So time critical messages should be assigned to the high priority CAN-IDs, but even then there is no determination in the time of transmission (non-deterministic transmission).
For the arbitration all nodes have to be synchronised. Due to the lack of a separate clock signal, the transmission of many identical bits in line would lead to the loss of synchronisation. The so called bit-stuffing is used to prevent this case. After five equal bits a complementary bit will be inserted into the transmission (the application will not notice). So the nodes can keep up resynchronising on the bit edges (see below figure).

A CAN network can operate with baud rates up to 1 Mbit/s.
Due to the necessary synchronisation of the nodes, the maximum delay caused by the length of the cable has to be limited.
The limitation corresponds with the baudrate. There is a common recommendation of the maximum cable length at several baud rates:

CANopen
CANopen is a specified higher protocol (layer 7 protocol)

With CANopen it is possible to transfer larger amounts of data, emergency telegrams and process data.
CANopen describes how the communication is performed. That means that parameters to configure a device are transmitted in a defined form (profile).
A CANopen profile defines objects representing the different functions of a device. These objects form a table called object dictionary.
The communication profile defines the basic services and parameters of a CANopen device (e.g. service data objects SDOs, process data objects PDOs, used CAN-IDs, etc.).
The device profile defines the specific functions of a device family (e.g. encoders, i/o devices, …).
For encoders the device profile is the encoder profile CiA 406.