can bus designing can bus circuitry

Posted by

Introduction to CAN Bus Circuitry

The Controller Area Network (CAN) bus is a robust vehicle bus standard designed to allow microcontrollers and devices to communicate with each other in applications without a host computer. It is a message-based protocol, designed originally for multiplex electrical wiring within automobiles to save on copper, but can also be used in many other contexts.

CAN bus is one of five protocols used in the OBD-II vehicle diagnostics standard. The CAN bus is a broadcast type of bus. This means that all nodes can “hear” all transmissions. There is no way to send a message to just a specific node; when a node transmits data, all nodes on the bus will receive it.

Key Features of CAN Bus

  1. Multi-master hierarchy: Any node can initiate the transmission of data.
  2. Message-based communication: Data is transmitted in packets of up to 8 bytes.
  3. Broadcast communication: All nodes on the bus receive every message.
  4. Priority-based bus access: Higher priority messages are transmitted first.
  5. Error detection and handling: CAN protocol includes error detection and handling mechanisms.

CAN Bus Architecture

The CAN bus consists of two wires, CAN high (CANH) and CAN low (CANL), that carry data. These two wires are driven by CAN transceivers which convert the digital signals generated by a CAN controller to signals suitable for transmission over the bus cabling (differential output). In a quiescent state, both CANH and CANL should have a nominal common mode voltage of 2.5V. A 120Ω termination resistor is used at each end of the CAN bus to prevent reflections.

CAN Node Architecture

Each CAN node consists of three main components:

  1. Microcontroller: This is the brain of the node. It decides what the received messages mean and what messages it wants to transmit.
  2. CAN Controller: The CAN controller is responsible for receiving and transmitting data on the CAN bus. It takes care of bit timing and synchronization, message framing, arbitration, acknowledgement, error detection and signaling, and fault confinement.
  3. CAN Transceiver: The CAN transceiver is responsible for converting the digital signals generated by the CAN controller to analog signals suitable for transmission over the bus cabling.

CAN Bus Protocol

The CAN protocol is a carrier-sense, multiple-access protocol with collision detection and arbitration on message priority (CSMA/CD+AMP). CSMA means that each node on the CAN bus must wait for a prescribed period of inactivity before attempting to send a message. CD+AMP means that collisions are resolved through a bitwise arbitration, based on a preprogrammed priority of each message in the identifier field of a message. The higher priority identifier always wins bus access.

CAN Message Frame

The CAN protocol defines four different message types: data frame, remote frame, error frame, and overload frame. The data and remote frames are used for transferring data, while the error and overload frames are used for error handling and flow control.

A standard CAN message consists of the following fields:

Field Description
Start of Frame (SOF) Indicates the start of a message frame.
Arbitration Field Contains the message identifier and the Remote Transmission Request (RTR) bit.
Control Field Contains the Data Length Code (DLC) and other control bits.
Data Field Contains the actual data to be transmitted (0-8 bytes).
CRC Field Contains the Cyclic Redundancy Check (CRC) code for error detection.
ACK Field Contains the Acknowledgement (ACK) bit and the ACK delimiter.
End of Frame (EOF) Indicates the end of a message frame.
Interframe Space (IFS) Provides a minimum delay between messages.

CAN Bus Arbitration

When multiple nodes try to send messages at the same time, the message with the highest priority wins the arbitration and gets transmitted first. The arbitration is performed during the transmission of the arbitration field, which includes the message identifier. The lower the message identifier, the higher its priority.

During arbitration, each node sends the bits of its message identifier and compares them with the bits on the bus. If a node sends a recessive bit (logical 1) but reads a dominant bit (logical 0), it loses arbitration and must wait until the bus is free before trying to send its message again.

CAN Bus Physical Layer

The CAN bus physical layer defines the electrical characteristics of the bus, including the signaling levels, bit timing, and synchronization.

CAN Bus Signaling

CAN uses a differential signaling scheme, where the state of the bus is determined by the voltage difference between the CANH and CANL lines. A logical 0 (dominant state) is represented by a voltage difference of at least 1.5V, while a logical 1 (recessive state) is represented by a voltage difference of less than 0.5V.

Bit Timing and Synchronization

The CAN protocol uses a synchronous bit timing scheme, where each bit time is divided into four segments:

  1. Synchronization Segment (Sync_Seg): Used for synchronization between nodes.
  2. Propagation Segment (Prop_Seg): Compensates for the physical delay times within the network.
  3. Phase Buffer Segment 1 (Phase_Seg1): Compensates for edge phase errors and can be lengthened during resynchronization.
  4. Phase Buffer Segment 2 (Phase_Seg2): Compensates for edge phase errors and can be shortened during resynchronization.

The bit time is determined by the CAN controller’s time quantum (TQ), which is derived from the oscillator frequency and the baud rate prescaler.

CAN Bus Termination

To prevent signal reflections and ensure proper bus operation, the CAN bus must be properly terminated. A 120Ω resistor is typically used at each end of the bus. The termination resistors match the characteristic impedance of the bus, minimizing reflections and ensuring a clean signal.

Designing CAN Bus Circuitry

When designing CAN bus circuitry, several key factors must be considered to ensure reliable communication and proper system operation.

Selecting CAN Controllers and Transceivers

The choice of CAN controller and transceiver depends on the specific requirements of the application, such as the required data rate, the number of nodes, and the operating environment.

Some popular CAN controllers include:

  • Microchip MCP2515
  • Texas Instruments SN65HVD230
  • NXP TJA1050

Popular CAN transceivers include:

  • Texas Instruments SN65HVD230
  • Microchip MCP2551
  • NXP TJA1050

CAN Bus Wiring

The CAN bus wiring should be designed to minimize signal distortion and electromagnetic interference (EMI). Key considerations include:

  • Using twisted-pair cable to reduce EMI susceptibility
  • Keeping the bus length as short as possible to minimize signal attenuation and delay
  • Ensuring proper termination to prevent signal reflections
  • Routing the CAN bus away from sources of EMI, such as power lines and electric motors

power supply design

The CAN bus nodes require a stable and noise-free power supply to ensure proper operation. Key considerations for power supply design include:

  • Providing adequate voltage regulation and filtering
  • Ensuring sufficient current capacity for all nodes
  • Isolating the CAN bus power supply from other power supplies to minimize noise coupling

PCB Layout Considerations

Proper PCB layout is crucial for ensuring signal integrity and minimizing EMI. Key considerations include:

  • Keeping CAN bus traces as short as possible
  • Routing CAN bus traces away from high-frequency signals and power traces
  • Using ground planes to provide a low-impedance return path and minimize EMI
  • Ensuring proper grounding and shielding of CAN bus components

FAQs

  1. Q: What is the maximum data rate supported by the CAN bus?
    A: The maximum data rate supported by the CAN bus depends on the bus length and the specific CAN controller and transceiver used. Typical data rates range from 125 kbps to 1 Mbps.

  2. Q: How many nodes can be connected to a CAN bus?
    A: The maximum number of nodes that can be connected to a CAN bus depends on factors such as the bus length, the data rate, and the CAN transceiver’s drive capability. In general, up to 64 nodes can be connected to a single CAN bus segment.

  3. Q: What is the maximum length of a CAN bus?
    A: The maximum length of a CAN bus depends on the data rate and the specific CAN transceiver used. At a data rate of 1 Mbps, the maximum bus length is typically around 40 meters. At lower data rates, the maximum bus length can be extended up to several hundred meters.

  4. Q: Can CAN bus be used in harsh environments?
    A: Yes, CAN bus is designed to be robust and reliable, making it suitable for use in harsh environments such as automotive and industrial applications. CAN transceivers with enhanced EMI immunity and extended temperature ranges are available for demanding applications.

  5. Q: What is the difference between standard CAN and extended CAN?
    A: Standard CAN (CAN 2.0A) uses an 11-bit identifier, allowing for up to 2,048 different message identifiers. Extended CAN (CAN 2.0B) uses a 29-bit identifier, allowing for over 536 million different message identifiers. Extended CAN is backward compatible with standard CAN, but standard CAN nodes will ignore extended CAN messages.

Conclusion

Designing reliable and efficient CAN bus circuitry requires a thorough understanding of the CAN protocol, physical layer considerations, and best practices for component selection, wiring, power supply design, and PCB layout. By carefully considering these factors and following established guidelines, designers can create robust CAN bus networks suitable for a wide range of automotive, industrial, and embedded applications.

As CAN bus technology continues to evolve, new challenges and opportunities arise, such as the integration of CAN with other communication protocols, the development of higher-speed CAN variants, and the increasing importance of cybersecurity in CAN bus networks. By staying informed about the latest trends and best practices in CAN bus design, engineers can create systems that meet the demanding requirements of modern applications while ensuring reliable, efficient, and secure communication.

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories

Tag Cloud

There’s no content to show here yet.