Project 1
CAN is primarily based totally on a -twine connection among nodes withinside the community, i.e. all nodes are sharing the identical bodily conversation bus, a way of message/records collision avoidance is obligatory to guarantee a secure records switch and to keep away from delays because of the vital recuperation of right bus situations after the collision. A collision can also additionally arise while or extra nodes withinside the community try to get admission to the bus at clearly the identical time, which can also additionally bring about unwelcome effects, including bus get admission to delays or maybe destruction/harm of messages. There are numerous techniques of collision avoidance among the numerous fieldbus structures and in maximum instances the collision avoidance is really a collision “repair”, which calls for an unspecified bus recuperation time, consequently taking over precious bandwidth, and generally outcomes withinside the destruction of the message. CAN averts message/records collisions with the aid of using the use of the message ID of the node, i.e. the message with the very best precedence (= lowest message ID) will advantage get admission to to the bus, even as all different nodes (with decrease precedence message IDs) transfer to a “listening” mode. Not best is the CAN arbitration cycle executed in a predictable, i.e. constant, time, the CAN specification additionally ensures that low-precedence messages who misplaced the arbitration will begin a brand new arbitration as quickly because the bus is to be had again. Thus CAN gives a non-unfavourable bus arbitration.
Principle of Bus Arbitration
The arbitration discipline follows proper after the SOF (Start of Frame) bit and it consists of of the message ID and the RTR (Remote Transmission Request) bit. Per definition, CAN nodes aren't worried with facts approximately the machine configuration (e.g. node address), therefore CAN does now no longer assist node IDs. CAN records transmissions are outstanding through a completely unique message identifier (eleven/29 bit), which additionally represents the message precedence. A low message ID represents a excessive precedence. High precedence messages will advantage bus get entry to inside shortest time even if the bus load is excessive as a result of decrease precedence messages. Picture 6.1.2 indicates an instance in which 3 nodes in a 4 node CAN community attempt to get entry to the bus at truely the identical time. In this case node C will win the bus get entry to inside 12 clock times. At a baud price of one MBit/sec this will translate into 12 microseconds. Naturally, the bus arbitration time varies with baud price and the message identifier length, eleven or 29 Bit.
demonstrates the interaction between a CAN node, trying to access the bus, and the actual CAN bus.
- The CAN node (CAN controller) waits for the end of the intermission field (refer to Chapter 4 - Message Frame Architecture).
- As soon as the bus is being detected as idle, the CAN node signals an SOF (Start of Frame) by putting a dominant (low) level onto the bus. Every other node in the network, that did not request bus access, will immediately switch to a receiving mode.
- The CAN controller sends the first/next message ID bit (Message IDs can be 11 or 29 bit long, the most significant bit – MSB will be sent first).
- The CAN controller compares its output signal with the actual bus level (at the end of each bit cycle).
- The node will lose the arbitration, in case it did send a recessive level (high) and detects a dominant (low) bus level. Consequently the node will switch into receiving mode.
- An error condition exists when the node detects a recessive level on the bus after it did output a dominant level. This is a clear violation of the CAN standard and the node will send an error frame to the bus.
- If the node has finished sending all arbitration bits (message ID plus RTR) without loosing the bus arbitration, it will transmit the rest of the message. At this time all other CAN nodes in the network will have switched to receiving mode.
Main Rules of Bus Arbitration
The main rules of bus arbitration are:
- Bit wise arbitration across the Arbitration Field
Zero Bit = Dominant Bus Level, One Bit = Recessive Bus Level, dominant bit overrides recessive bit
The CAN bus level will be dominant in case any number of nodes in the network output a dominant level. The CAN bus level will only be recessive when all nodes in the network output a recessive level.