Presentation on theme: "Course Introduction Purpose"— Presentation transcript:
1Course Introduction Purpose This training course provides an introduction to the basics of the Controller Area Network (CAN) technology, which is used to build networked, multi-processor embedded systems.ObjectivesUnderstand what CAN technology is, why it’s important and where it can be a good design solution.Learn the fundamental operating concepts and capabilities of CAN implementations.Content19 pages3 questionsLearning Time25 minutesWelcome to the introductory course on controller area network (CAN) technology. This course covers basic technical details that will help you get started in the design reliable, cost-effective systems that link together a network of microcontrollers (MCUs). To get the most out of this material, you should be familiar with data communication networks in general, and you should understand the fundamentals of designing and developing embedded control systems.In this course we will present an overview of CAN technology — what it is, why it’s important, and where it is used and can be applied to good advantage. Then we will highlight various key CAN design aspects, including the physical interface, data frames, timing issues, physical layer, OSI model, protocols and data flow.Other online CAN courses at RenesasInteractive describe and explain specific design aspects of applying CAN technology in more detail and highlight CAN functions built into Renesas microcontrollers, such as those in the M16C series.[Note to audio talent: Pronounce all acronyms as individual letters unless guidance is provided otherwise, for example, pronounce “CPU” as “C-P-U”. Pronounce all numbers using Standard English pronunciations unless guidance is provided otherwise; for example, pronounce 162 as “one-hundred sixty-two” and as “one-hundred seventy-two point three four”.][Pronounce CAN as can][Pronounce M16C as M-sixteen-C][Pronounce CISC as sisk]
2What is CAN? Controller Area Network: Two-wire, bidirectional serial-bus communication methodOriginally developed in 1989 by Bosch for automotive useMain design objective: Economical solution for implementing high-integrity networking in real-time control applicationsNow standardized internationally:- CAN 2.0A: ISO11519 — low speed - CAN 2.0B: ISO11898 — high speedUsage: >>100,000,000 nodes/year- Over 80% automotive- Many current and potential non-automotive application opportunitiesThe Controller Area Network, or CAN, is a two-wire (twisted-pair), bidirectional serial-bus communication method that allows electronic subsystems to be linked together and interact in a network. It was originally developed in 1989 by Bosch for use in automotive applications.CAN is noted for its high integrity for real-time applications. It performs well in noisy environments, for example, because CAN hardware incorporates features designed to ensure reliable communication.CAN specifications are international standards. Two versions now in use. CAN 2.0A, the low-speed version, sometimes known as Basic or Standard CAN, is defined by the ISO11519 standard. CAN 2.0B, the high-speed version, also known as Full CAN or extended-frame CAN, is defined by the ISO11898 standard.CAN is finding use in a growing number of non-automotive applications Industrial control. Still, better than 80% of the more than 100 million nodes now implemented per year are in vehicles.
3Non-automotive CAN applications • Electronically-controlled production and packaging equipment- Machine tools; machines for molding, weaving, knitting, and sewing; systems for folding and wrapping; etc.• Industrial freezers• Printing machines• Locomotives and railway systems• Farm and construction machinery• Semiconductor manufacturing equipment• Building automation: HVAC systems, elevators, etc.• Hospital patient-monitoring systems• Many othersHere we list some of the some of the non-automotive applications that now use CAN technology or are excellent candidates for using it. They span a wide range and include production and packaging equipment, industrial freezers, high-speed printing machines, locomotives and other elements of railway systems, machinery used in farming and building construction, semiconductor manufacturing equipment, building automation systems, and patient monitoring systems in hospitals and clinics. Many others exist, as well.More application information is available atMore application information:
4Key Reasons for Using CAN Reliability - Error-free communicationEconomy - Low wiring cost - Low hardware costScalability - Easy expandability - Low node-connection costsAvailability - More chips with CAN hardware - More off-the-shelf toolsPopularity - Knowledge base expandingHaving briefly discussed what can is and where it can be used, let’s now look at five main reasons why CAN is an excellent choice for implementing networked communication in embedded systems.First, CAN technology has been carefully designed to provide very reliable, error-free network communication. This is a major issue for some types of safety critical equipment and real-time systems.Second, since the bus is a simple “twisted pair” wire, network wiring cost is low. Moreover, the peripheral circuit that implements connectivity in the microcontroller doesn’t occupy too much chip area, which helps to keep MCU cost low.Third, the CAN network is readily expandable. It’s simple to add nodes: just tap into the two wires at any point on the bus. Of course, only two pins are needed on the MCU and in the bus connectors. And with just two connection points per node, a CAN network has a reliability advantage over other networking schemes that use more wires and connections.Fourth, more and more MCUs with on-chip CAN functions are becoming available. The same holds true for tools for debugging CAN networks.Fifth and last, CAN is a mature technology, having been used for over 15 years. During that time, a substantial body of knowledge has been accumulated about its application, and the database continues to grow.
5Main Features of CAN - Part 1 Has a multiple-master hierarchy - for building intelligent and redundant systemsProvides transfer rates up to 1 Megabit/sec - for adequate real-time response in many embedded control applicationsAllows 0-8 bytes of user data per message - to accommodate diverse design requirementsPuts multiple transmit or receive message boxes at each node and assigns each an identifier - for flexibility in system designWith those five reasons in mind, let’s now summarize the main features of CAN that underlie its growing application popularity.CAN has a multi-master hierarchy. This arrangement gives good design flexibility and allows building intelligent and redundant systems.It operates at transfer rates up to 1 Megabit/sec (1 Mbps or 1 Mbaud) in CAN 2.0B. This speed provides sufficient data-communication bandwidth for many real-time control systems.The CAN protocol allows each CAN data frame to carry from zero to as many as eight bytes of user data per message, thus accommodating a wide span of signaling requirements. If necessary, more data can be transmitted per message using a higher-layer segmentation protocol.Each node on a CAN network can have have several buffers or message mailboxes. On initialization, each mailbox is assigned an identifier that is either unique or is shared with certain other nodes. Also, each node is individually configured as a transmitter or receiver. This approach offers considerable flexibility in system design.
6Main Features of CAN - Part 2 Eliminates addresses of transmitting and receiving nodes in data messages - to save bus bandwidth and simplify softwareCauses receiving nodes to filter messages based on their asigned identifiers (IDs) - to simplify node hardware and software - to permit message prioritization - to allow the hardware to arbitrate the CAN busAutomatically re-transmits messages if corruption occurs - for accurate communication, even in noisy environmentsProvides error detection, signaling and fault-confinement measures - to ensure highly reliable network operationData messages (data frames) transmitted from any node on a CAN bus do not contain the addresses of either the transmitting node or of any intended receiving node. This eliminates data bits that would otherwise use up some of the available bus bandwidth. It also simplifies the communication software.In lieu of transmit and receive node addresses, messages are labeled by an identifier (ID) assigned one or more nodes on the network. All nodes receive the message and perform a filtering operation. That is, each node executes an acceptance test on the identifier to determine if the message — and thus its content — is relevant to that particular node. Only the node(s) for which the message is relevant will process it. All others ignore the message. The identifier has two more functions, as well. It contains data that specifies the priority of the message and it allows the hardware to arbitrate for the bus. That is, it’s used to determine which node gets to transmit if several nodes attempt to do so simultaneously.Every node on the bus validates every message. Corrupted messages aren’t validated, of course, and that situation triggers automatic re-transmissions.Error detection and error signaling features and fault-confinement measures are defined in the CAN standard. They make the CAN bus very reliable — even in noisy environments — by ensuring that the information communicated between nodes is correct and consistent. If a node is faulty, it goes into a (safe, limited, restricted, ??) operating mode that prevents it from disturbing the traffic on the bus
7Design Factors to Consider Distance/Environment Mbit/sec: up to 40m Kbits/sec: up to 500m - Suitable for difficult environments — industrial, automotive, and moreReliability requirements - Integrated error detection and confinement - Automatic retransmission of corrupted message - Probability of undetected bad message is <4.7 x 10-11Number of nodes - Depends on physical layer; >100 is feasibleNumber of masters - Every node can initiate communication and negotiate for the busNet data transfer rate - Up to 577 Kbits/sec net at 1 Mbit/sec total data transfer rateMessage priority - Message with lowest numerical value identifier wins if two nodes try to transmit at the same timeNode ANode BNode CCAN BusNode DNode ENode xA good question now is, “What parameters and design requirements define a suitable application for CAN?” The factors listed here are among those to consider.This serial data communication technology provides communication at up to 1 Mbit/sec at distances up to 40 meters for CAN 2.0B. (For CAN 2.0A, the capability is up to 125 Kbits/sec at distances up to 500 meters.) Both CAN versions are good choices for systems that must perform dependably in noisy, difficult environments.The CAN reliability features previously described reduce the probability of an undetected bad message to a very low level: less than 4.7 x This is virtually a 0% failure rate.A CAN implementation can have over 100 nodes, or individual MCUs, depending on the physical layer of the network.Because the CAN bus is not controlled by a single master node, all nodes may send a data message. This makes possible intelligent, redundant systems. Also, a defective network node doesn’t disable the network.The 1Mbit/sec maximum transfer rate that the CAN 2.0B bus delivers includes the overhead imposed by the network protocol. At that speed, the net transfer rate for message data is 577 Kbits/sec.The priority of a CAN message is determined by the numerical value of its identifier. The message with the lowest numerical value ID in the its header has the highest priority. It wins if another node with lesser priority tries to transmit at the same time. (What happens if both messages have the same priority??)
8Data FlowWhen a transmitter at a CAN node sends a data frame, it broadcasts that message to all nodes on the bus. However, only those nodes configured to receive the identifier in that message will accept and save the data. All other nodes don’t do anything with the data; they ignore it.CAN 2.0A has an 11-bit message identifier and was originally specified to operated at a maximum frequency of 250Kbits/sec. CAN 2.0B has 11-bit or 29-bit message identifiers and can be used speeds at up to 1Mbit/sec.This diagram illustrates the basic data flow process. The block on the left represents a transmitting node; the one in the middle and the one on the right represent receiving nodes.The middle node has a receiver mailbox set to an identifier that either matches the transmitted identifier exactly or is within a software-defined identifier range of it, so it accepts the data frame. The node on the right has a receiver mailbox set to a different identifier than the transmitted one, so it doesn’t accept the message.Nevertheless, both receiver nodes (and all other receiver nodes in this CAN implementation) subsequently verify and acknowledge the data frame content to prove successful message transmission.
9Question A D B A C C D B Done Reset Show Solution Match each CAN item to the most appropriate explanation by dragging the letters on the left to the correct locations on the right. Click Done when you are finished.Must be sent by all receiver nodes, or message is re-transmittedADCANA 2-wire serial bus communication method for multiprocessor systemsBMultiple-master hierarchyAUsed for addressing, prioritization, and bus arbitrationCMessage identifierCEnables the design of intelligent and redundant systemsD[This is a matching question. The correct answers are in green.]Here’s a question for you on some of the aspects of CAN technology we have discussed so far.[Correct answer (No audio required.)][Correct. CAN is a 2-wire serial bus that provides highly reliable communication between nodes of multiprocessor embedded control systems. Its multiple-master hierarchy enables intelligent and redundant designs. The message identifier specifies the intended receivers for the message, stipulates the priority of the message, and is used for bus arbitration. Unless all receiver nodes on the network acknowledge a message, that message will automatically be re-transmitted.Click the forward arrow to continue on to the next page.][Incorrect answer (No audio required.)][Incorrect. CAN is a 2-wire serial bus that provides highly reliable communication between nodes of multiprocessor embedded control systems. Its multiple-master hierarchy enables intelligent and redundant designs. The message identifier specifies the intended receivers for the message, stipulates the priority of the message, and is used for bus arbitration. Unless all receiver nodes on the network acknowledge a message, that message will automatically be re-transmitted.AcknowledgementBDoneResetShow Solution
10Physical Interface Dominant low (voltage) line Recessive high line Bus must be terminatedMost common physical-layer choice: ISOHaving covered the basic concept of the CAN data flow, let’s examine how a node physically interfaces to the bus.The node produces a ‘dominant’ value by simultaneously driving the “C_HI” line high and the “C_LO line” low. That is, it actively creates a positive differential voltage between these signals.A ‘recessive state’ is created on the CAN bus whenever all nodes on the network leave the “C_HI” and “C_LO” lines in a high-impedance state. That causes the termination resistors to passively create a zero differential voltage between these signals.The CAN bus must be terminated to provide the recessive state — and to eliminate wave reflections at ends of the bus wires. Typical DC bus terminations are in the 60-Ohm range, and the twisted-pair cables have a 120-Ohm characteristic impedance. Many physical-layer choices are possible, but ISO is probably the most common.If the application requires that network nodes be electrically isolated from the CAN bus, this is typically achieved by inserting optical isolators between the bus transceiver and the MCU. Those isolators will introduce an additional delay that will almost always limits the maximum bus speed of a CAN 2.0B network to 500 Kbits/sec.
11Physical-Layer Implementation CAN transceiver: the Renesas HA13721 ASSP ICFor in-vehicle applicationsISO compliantHigh-speed CAN (up to 1 Mbps)Active Standby modesOver-temperature detectionOver-current detection (Vcc-short/GND-short detection)Optimized EMI performanceTxd, MODE input pins; 3.3V compatibleThe CAN physical-layer implementation is not defined by the Bosch CAN specification. However, it is defined in the ISO standard. Here is an example of a physical-layer transceiver that connects to the bus: the Renesas HA13721 application-specific standard product (ASSP) IC, a CAN transceiver tailored for in-vehicle use.The HA13721 transceiver is a standards-compliant high-speed design with Active and Standby operating modes. It features over-temperature and over-current detection to help protect the system, provides good EMI performance, and has 3.3V-compatible Txd and mode input pins.CANH = C_HICANL = C_LO
12CAN Bus Data FrameSome callouts are too small to read; please make them larger—Thanks! wpMCU Output to TransceiverTransceiverOutput to BusThis captured data frame shows actual bus operation. The top scope trace (green) is the signal that drives the transceiver. The other two traces are the C_HI (red) and C_LO (blue) signal lines relative to each other.Again, a dominant value (CAN_TX = logic low) is created by driving C_HI high and C_LO low to create a positive differential voltage between them. A recessive state (CAN_TX = logic high) is created by having all nodes put the C_HI and C_LO lines in the high-impedance state, so the differential voltage is zero because no current flows in the bus termination resistors, .Receivers at bus nodes detect a dominant state when a differential voltage greater than 900mV exists between C_HI and C_LO. They detect a recessive state when the differential voltage is less than 500mV.Please notice three things with regard to this scope photo. First, the MCU transmit pin runs at standard logic levels. Second, there is a 2.5V offset on the transceiver output to the bus. This is compliant with the ISO standard, which allows a common-mode range of -7V to +12V. And third, CAN uses a non-return-to-zero (NRZ) serial data transmission method — a fact that we will revisit shortly.CAN uses non-return-to-zero (NRZ) serial data
13CAN Bit Timing One bit-time segment has four phases or values: NOMINAL BIT TIMESYNC_SEGPROP_SEGPHASE_SEG1PHASE_SEG2Sample PointOne bit-time segment has four phases or values:SYNC_SEG: Nodes are synchronized within this phasePROP_SEG: Propagation delay compensation value [ = 2 x (signal propagation time input comparator delay output driver delay)]PHASE_SEG1 and PHASE_SEG2: Establish correct sampling pointTurning now from voltage to timing issues, it goes without saying that proper timing is essential to establishing and maintaining good communication on any data network. To ensure that each bit on the CAN bus is sampled at a proper point within the nominal bit time, four phases or values (parameters) are defined:SYNC_SEG: This portion of the bit time is used to synchronize the various nodes on the bus. A signal-transition edge is expected to lie within this phase of the bit-time segment.PROP_SEG: This part of the bit time is used to compensate for the physical delay times within the network.PHASE_SEG1 and PHASE_SEG2: These phase-buffer parts of the bit time are used to compensate for edge-phase errors. They can be lengthened or shortened by resynchronization to establish the correct sampling point.The values for the four bit-time parameters typically are defined in the top-level specification for a network. They are set by taking into account factors such as wiring length, bandwidth requirement, operating environment, etc. It’s important to remember that the timing parameter values must be the same for all nodes.Note: Terminology used in slide and notes must be the same — wp
14Maintaining Synchronization ‘Bit Stuffing’ is applied as needed to keep the bus synchronized- Too many consecutive dominant or recessive bits cause the transmitting node to insert a bit of the opposite polarity- Resulting signal edge is used to establish timing synchronization at all nodes on the bus- The bit is inserted whenever a sequence of five bits with the same polarity occursOf course, it’s essential that timing synchronization always be maintained at all network nodes. Many network communication methods mandate that a signal line return to the zero state after each bit is transmitted. The resulting transitions are used to keep the serial data synchronized.But as mentioned before, CAN uses a NRZ serial data transmission method, so a string of repeating 1s or 0s contains no state transitions. Such strings, if they were long enough, might cause a loss of synchronization due to variations in the frequencies of the clocks at different nodes.For this reason, CAN uses ‘bit stuffing’ to maintain synchronization. Bit stuffing means that when too many dominant or recessive bits are sent consecutively to keep the bus synchronized, the transmitting node inserts an opposite-polarity bit. Specifically, CAN requires that bit stuffing be applied after there is a sequence of five bits with the same polarity.
15QuestionWhich of these statements correctly describe voltage and timing aspects of CAN bus operation? Select all that apply and then click Done.A dominant value (positive differential voltage >900 mV) is created by driving the C_HI line high and the C_LO line low.Mandatory CAN bus termination resistors create a recessive value when all bus nodes go to a high-impedance state.Because CAN uses NRZ serial data, synchronization between nodes is maintained automatically.The PROP_SEG portion of the bit time is used to compensate for physical delays within the network.This is a multiple choice question. The correct answers are in green, but all text is displayed in black.Here’s another question for you. This one covers CAN bus voltages and timing.[Correct feedback – no audio required][Correct. A dominant value — that is, a positive differential voltage greater than 900 mV — is created by driving the C_HI line high and the C_LO line low. CAN bus termination resistors must be used; they create a recessive value when all nodes on the bus go to a high-impedance state. CAN uses NRZ serial data, so bit stuffing is used to maintain whenever five consecutive bits of the same polarity occur. The PROP_SEG portion of the bit time is used to compensate for physical delays within the network.Click the forward arrow to continue on to the next page.][Incorrect feedback – no audio required][Incorrect. A dominant value — that is, a positive differential voltage greater than 900 mV — is created by driving the C_HI line high and the C_LO line low. CAN bus termination resistors must be used; they create a recessive value when all nodes on the bus go to a high-impedance state. CAN uses NRZ serial data, so bit stuffing is used to maintain whenever five consecutive bits of the same polarity occur. The PROP_SEG portion of the bit time is used to compensate for physical delays within the network.Done
16CAN in the OSI ModelUp until now, we have talked about the physical layer of the network without explaining what it is. Let’s briefly address that deficiency now.The physical layer is part of the Open Systems Interconnect (OSI), a standard definition or “reference model” for how messages should be transmitted in a network.There are seven layers in the OSI communication model. The bottom three — Physical, Data Link and Network — are the Media layers. The top four — Transport, Session, Presentation and Application — are the Host layers.CAN by itself is only concerned with the lowest layers of the model. That is, ISO11898 defines the Data Link and Physical layers, which are shown here in red. Additionally, the CAN 2.0B specification covers a portion of the Transport layer: the re-transmission/retry control function.
17Higher-layer CAN Protocols Circuits or subsystems at CAN nodes generally have software that uses protocols belonging to the higher levels of the OSI model. In the automotive market, vehicle manufacturers use proprietary CAN protocols. In the industrial market, the most commonly used standard protocols are CAN Open and DeviceNet.CAN Open was developed as a standardized embedded network with highly flexible configuration capabilities. Now it is used in many fields, such as medical equipment, off-road vehicles, public transportation, building automation, etc. The CAN Open specifications cover the application layer and communication profile. They also provide a framework for programmable devices; recommendations for cables, connectors and SI units; and prefix representation.DeviceNet is an open low-level network that provides connections between simple industrial devices such as sensors and actuators, and higher-level devices such as embedded controllers and computers. The DeviceNet network is flexible and works with products from multiple vendors. It uses the proven Common Industrial Protocol (CIP) to provide control, configure, and data-collection capabilities for industrial devices.Other standard CAN protocols include NEMA2000 for marine applications, CANaerospace for aircraft systems, SAE J1939 for heavy trucks and ISO11783 for agricultural vehicles. Incidentally, most of the protocols discussed here don’t implement several of the intermediate levels of the 7-layer OSI model because it isn’t necessary to do so.
18QuestionIs the following statement true or false? Click Done when you are finished.“CAN is concerned only with the lowest layers of the OSI model.”TrueFalse[This is a true/false question. The correct answer is True. Show text as black. Please add a “Done” button on the bottom left corner of the screen.)]Consider this question regarding the OSI model.[Correct answer (No audio required.)][Correct. CAN implements only the lowest layers of the OSI model, the Data Link and Physical layers, and — for the CAN 2.0B specification — the re-transmission/ retry control function of the Transport layer.Click the forward arrow to continue on to the next page.][Incorrect answer (No audio required.)][Incorrect. CAN implements only the lowest layers of the OSI model, the Data Link and Physical layers, and — for the CAN 2.0B specification — the re-transmission/ retry control function of the Transport layer.Done
19Course Summary CAN description, applications, features/benefits Design factors/parametersData frame and data flowTiming issuesPhysical interface, OSI model, and higher-level protocolsThis concludes our introductory course on CAN technology. In it you learned basic facts about what CAN is, why it’s important, and where it’s most often used. You also discovered key CAN features, benefits and design factors, then gained insight into data flow, the physical layer and bus voltages and timing issues. Finally, you learned how CAN fits into the OSI model.Other CAN courses explain data frames in greater detail, describe Renesas devices with CAN capabilities, and provide specific design information for implementing CAN-based multiprocessor systems with microcontrollers in the M16C series.Thank you for your interest in CAN technology and for using the tutorial area of the RenesasInteractive website. We now invite you to take additional courses that are available and to use the many other free resources offered here.