Presentation is loading. Please wait.

Presentation is loading. Please wait.

© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose This training course provides an overview of Message Frames.

Similar presentations


Presentation on theme: "© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose This training course provides an overview of Message Frames."— Presentation transcript:

1 © 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose This training course provides an overview of Message Frames and hardware issues of the Controller Area Network (CAN) technology used to build networked, multiprocessor embedded systems.  Objectives Discover the types of Message Frames in CAN bus traffic and the purpose of each. Learn the details of a CAN Data Frame. Understand hardware issues of implementing CAN networks.  Content 23 pages 3 questions  Learning Time 30 minutes

2 © 2009, Renesas Technology America, Inc., All Rights Reserved 2 Controller Area Network What is CAN?  Two-wire, bidirectional serial-bus communication method  Economical solution for high-integrity networking in real-time embedded- control applications  Standardized internationally - CAN 2.0A: ISO11519 (low speed) - CAN 2.0B: ISO11898 (high speed)  Widely used: >>100,000,000 nodes/year  Key features - High reliability (essentially error free, even in noisy environments) - Low wiring cost and node-connection cost - Readily scalable - Off-the-shelf tools - Supported by many chips - Knowledge base growing

3 © 2009, Renesas Technology America, Inc., All Rights Reserved 33 Types of Message Frames  Data Frame - Carries the actual data (payload)  Error Frame - Six consecutive dominant bits, sent anytime an error is detected by the hardware at any node  Overload Frame - Requests a delay on the bus  Interframe Space - Provides minimum spacing between data and remote frames; allows error frames to have levels of priority  Remote Frame - Requests transmission of a Data Frame; carries no payload

4 © 2009, Renesas Technology America, Inc., All Rights Reserved 4 Data Frames: Two Types Data Field Control Field End of Frame ACK Field CRC Field Extended Frame (CAN 2.0B) Start of Frame Arbitration Field Standard Frame (CAN 1.0 and 2.0A)

5

6 © 2009, Renesas Technology America, Inc., All Rights Reserved 6 Start of Frame Indicated by single dominant bit occurring when bus is idle Start of Frame All nodes synchronize timing to leading edge

7 © 2009, Renesas Technology America, Inc., All Rights Reserved 7 Arbitration Field: IDs  Standard ID: CAN 2.0A and CAN 2.0B - Gives CAN 2.0B backward compatibility with CAN 2.0A - 11 bits allow up to 2032 unique IDs  Extended ID: CAN 2.0B only (optional) - 29 bits allow over 500 million unique IDs - Extended ID with same 11-bit higher-order field has lower priority than Standard ID  RTR bit following the ID is dominant for a Data Frame, recessive for a Remote Frame Standard ID (11 bits) Standard ID (High-order field, 11 bits) [Additional ID space] (Low-order field, 18 bits) Extended ID (29 bits, CAN 2.0B) Arbitration Field RTR ID0 ID10 12 bits 32 bits SRR ID18ID28 IDE ID17 ID0RTR

8 © 2009, Renesas Technology America, Inc., All Rights Reserved 8 Keeping Traffic Flowing  CAN Arbitration Protocol: CSMA/CD-CR - Carrier Sense — Nodes wait for period without bus activity before sending message - Multiple Access — Every node has an equal opportunity to transmit message - Collision Detection — Collision occurs if two nodes attempt to transmit at same time - Collision Resolution — Non-destructive bitwise arbitration keeps messages intact; sends highest-priority message without delay; and subsequently allows retransmissions of lower-priority messages

9 © 2009, Renesas Technology America, Inc., All Rights Reserved 9 Keeping Traffic Flowing Uses Dominant and Recessive bits - IDs with dominant bits get priority - Nodes attempting to send lower-priority messages try to transmit in each successive cycle, succeeding when they finally attain priority

10 © 2009, Renesas Technology America, Inc., All Rights Reserved 10 Control Field 00018 11107 01106 10105 00104 11003 01002 10001 00000 DLC 0 DLC 1 DLC 2 DLC 3 Data Length Code Number of Data Bytes Control Field IDE RB0 DCL3 DCL0 Data Length Code (4 bits) Data Length Code (DLC) tells how much information the Data Field contains  2 bits of Control field are reserved  4 bits give DLC (# of bytes in Data Field)

11 © 2009, Renesas Technology America, Inc., All Rights Reserved 11 Data Field  Content: Payload of Data Frame  Length: 0 to 8 bytes  MSB is transmitted first Data Field Payload of Data Frame (0, 1, 2, 3, 4, 5, 6, 7 or 8 bytes)

12 © 2009, Renesas Technology America, Inc., All Rights Reserved 12 CRC Field  15-bit Cyclic Redundancy Check (CRC) value followed by a recessive delimiter  CRC polynomial: x 15 +x 14 +x 10 +x 8 +x 7 +x 4 +x 3 +1  Generated by transmitter node’s hardware; verified in each receiver node’s hardware  If receiver-generated CRC matches transmitted CRC, receiver puts a dominant bit in ACK slot  If no match, receiver sends ‘NO’ vote AFTER upcoming ACK delimiter CRC Field Del CRC Code 15 bits

13 © 2009, Renesas Technology America, Inc., All Rights Reserved 13 ACK Field  ACK Slot + ACK Delimiter  All receivers that receive valid messages report successful reception by placing a dominant bit in the ACK slot*  Receivers that do not get a valid message (indicated by CRC mismatch) vote ‘NO’ by placing an error flag after the delimiter ACK Field ACK Del * Because every node acknowledges messages, the round-trip propagation delay is the primary distance limitation of CAN.

14 © 2009, Renesas Technology America, Inc., All Rights Reserved 14 End of Frame  Delimits the end of a Data Frame  Consists of seven recessive bits for Data Frame (also for a Remote Frame)  Provides a short break in communication flow before the next frame, allowing time for Error Frames, etc. End of Frame 7 bits

15

16 © 2009, Renesas Technology America, Inc., All Rights Reserved 16 Types of Errors Five types of errors, detected locally: 1. Bit error Received bit at sender not equal to transmitted bit 2. Bit-stuffing violation More than five consecutive bits with same polarity 3. CRC error Checksum violation 4. Form error Bit pulse distorted; invalid bit at predetermined points in message frame 5. ACK error No dominant bit in ACK slot, so sender must retransmit Message Frame

17 © 2009, Renesas Technology America, Inc., All Rights Reserved 17 Node Hardware Operating States Depending on error detection, hardware is in:  Error Active State — Normal operating state; messages can be transmitter and received.  Error Passive State — Despite frequent transmit and receive problems, messages still can be transmitter and received.  Bus Off State — Serious problems transmitting messages; no messages can be transmitted or received until hardware is reset. This prevents a faulty node from causing a bus failure. Summary of CAN Error Process 1. Error detected by node 2. Error frame immediately transmitted 3. Message cancelled at all nodes 4. Status of hardware at nodes updated 5. Message re-transmitted

18 © 2009, Renesas Technology America, Inc., All Rights Reserved 18 Implementing CAN Systems Needed:  Firmware  CAN controller  CAN transceivers  A physical media 10kbps6km 125kbps500 250kbps200 500kbps100 1Mbps40 Maximum bit rate* Bus length (meters) * CAN 2.0B

19 © 2009, Renesas Technology America, Inc., All Rights Reserved 19 CAN Hardware Designs  Two main CAN controller implementation strategies: CAN controller  BasicCAN  FullCAN  Key differences between strategies:  How decision is made on whether or not a message is of interest to a receiving node  How remote frames are answered  How messages are buffered  Implementation determines amount of processing load put on host microcontroller

20 © 2009, Renesas Technology America, Inc., All Rights Reserved 20 Features of BasicCAN Networks Keep oldest message; newer messages will be lost Overrun Philosophy Remote frames are answered by the application Remote Frame Handling Every CAN message can be received Normally two receive buffers in FIFO structure Global message filtering: Filter cannot be set up to pass only the interesting messages; final filtering must be done by the application Receive Application fills complete Tx register, including ID, RTR, data length, and data; every ID can be transmitted Transmit

21 © 2009, Renesas Technology America, Inc., All Rights Reserved 21 Features of FullCAN Networks Keep newest message; older messages with the same ID will be lost Overrun Philosophy Remote frames are answered automatically by the controller Remote Frame Handling Only messages with the IDs defined in receive mailboxes can be received No double-buffering for mailboxes Full acceptance filtering; only exact message IDs are let through Receive Transmit mailboxes initialized once Only data bytes written before transmission Transmit

22

23 © 2009, Renesas Technology America, Inc., All Rights Reserved 23 Types of CAN Message Frames Data Frame Details Bus Errors Implementation Strategies: BasicCAN vs. FullCAN Course Summary


Download ppt "© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose This training course provides an overview of Message Frames."

Similar presentations


Ads by Google