1 / 28

Advanced Embedded Systems Design

Advanced Embedded Systems Design. Lecture 10 Controller Area Networks BAE 5030 - 003 Fall 2004 Instructor: Marvin Stone Biosystems and Agricultural Engineering Oklahoma State University. Goals for Class Today. Questions over reading / homework ( Chapters 23, 24 )

gusty
Download Presentation

Advanced Embedded Systems Design

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Advanced Embedded Systems Design Lecture 10 Controller Area Networks BAE 5030 - 003 Fall 2004 Instructor: Marvin Stone Biosystems and Agricultural Engineering Oklahoma State University

  2. Goals for Class Today • Questions over reading / homework (Chapters 23, 24) • USB from a developers prospective – (Patrick) • SPI and I2C – (Brody) • Controller Area Networks introduction – (Stone) • Set assignment

  3. Automotive SAE J1850 SAE J1708 / 1587 CAN based SAE J1939 / ISO 11783 Fault tolerant busses ByteFlight FlexRay TTP / TTCAN MOST Avionics MIL-STD-1553 ARINC 429 Marine NMEA 0183 NMEA 2000 (IEC 61162-3 ) Ethernet Ethernet IEEE 803.2 – Further defined ethernet 803.11 – wireless LAN 802.15.4 – Zigbee LIN On-board busses (inter-IC busses) SPI I2C Microwire 1-Wire Industrial MODBUS RS485 Ethernet Fieldbus Bitbus CAN DeviceNet SDS CiA Proprietary RS 485 CAN Communications busses for embedded systems(A very abridged list!)

  4. CAN – Controller Area Network - Introduction • History • Developed by Bosch in mid 1980’s to meet a need for networking ECUs (electronic control units in automobiles) • Initially introduced with an 11-bit message identifier (CAN 1.0 – 1.2), later a 29 bit identifier introduced (CAN 2.0) • Now: • 11 bit only parts: CAN 1.2 (Also CAN2.0A) • 2048 different CAN messages • 11 bit compatible with 29 bit messages: CAN 2.0B 29 bit passive • xmit and receive 11 and 29 bit ID: CAN 2.0B • 536 million CAN messages • CAN has since been heavily adopted • ~350 million protocol controllers sold in 2003 (Bosch / CiA) • Broad industrial support • Automotive • J2284 / IDB-C 500 - kBaud automotive physical and data link • J1939 – Heavy duty vehicle physical/data link/network/app layer • Proprietary • Industrial • DeviceNet – Industrial physical/data link/network layers • SDS - Industrial physical/data link/network layers • Proprietary • See: http://www.can-cia.de/can/protocol/history/history.html

  5. CAN Overview • CAN = Controller Area Network • Serial data communications protocol for real-time application using a multiple access bus • Messages have assignable priority • most critical can dominate during heavy load • Messages are short (controlled length) • opportunities to insert a new message come often • Asynchronous serial communications • Serial bus vs. point-to-point • Reduction in wiring complexity • Better information sharing • Low probability of an undetected error • 4.7 x 10-11 x message error rate • For a message error rate of 25/sec: 1 undetected error per 10,000 hours operation

  6. Capacity Comparison

  7. Capacity and Performance • Use of bus bandwidth @250 kBaud by messages • 100 messages per second (10 ms repetition) =5% • Torque/Speed control on engine • Hitch control • 10 messages per second (100 ms repetition) =0.5% • Throttle position • GPS Lat/Lon data • Implement application rate control (process data) • 1 message per second (1s repetition) =0.05% • Display updates • System status

  8. Message latency • 134 bit message @250 kBaud (bit stuffing ignored) • @ 4 ms per bit = 536 ms = 0.5 ms per message max • Highest priority message • must wait no more than ~0.5 ms • Low priority messages • must wait till higher priority messages clear • latency may be long at high bus loads

  9. Conventional Wiring (No Bus) Serial Communication Links

  10. A Simple CAN Application (Serial Bus)

  11. CAN - Introduction • Network structure • Intended as a bus, but other physical implementations are possible • Limitations – No “Tee’s”

  12. An overview of CAN based networking • CAN - Elements • CSMA/CA • Bitwize priority access strategy • Uses distributed synchronization of bit timing • Non-destructive collisions • Message components • Identifier / Data • Bus Access - Arbitration / Prioritization • Error Detection / Error Confinement • Filtering • Other features • In Frame Acknowledgement • RTR

  13. Message structure • Message frame contains: • 11/29 bit Identifier • Data length • 0-8 bytes data • CRC • In-frame acknowledgement

  14. CAN Frame Format - CAN 2.0B

  15. Typical ECU Components

  16. ECU Connection to the bus ECU 1 ECU 2 CAN_H CAN_L TBC_PWR Terminator Terminator CAN_H CAN_L TBC_RTN

  17. Message Message Physical network structure Message Message

  18. Message Components 11 bits or 29 bits Message (up to 150 bits) 0 to 8 bytes (0 to 64 bits) Identifier Data Start Serial bit stream

  19. CAN Arbitration ISO 11878 Lower numbered identifiers assume higher priority

  20. Bit time control – Length of a single bit • Bit must arrive a destination before phase_seg1 begins. Sampling at receiver will occur within the phase segment. • Prop_seg. should accommodate total out and back propagation time plus delay in tranceivers

  21. CAN synchronization / bit timing • Definitions: • Synchronization segment (Sync_Seg) - that part of the bit time where bit edges are expected to occur • Propagation segment (Prop_Seg) - intended to compensate for the physical delay times • Phase segment (Phase_seg1, Phase_seg2) – Provide control of the sample point position • Synchronization Jump Width (SJW) defines how far a resynchronization may move the Sample Point inside the limits defined by the Phase Buffer Segments to compensate for edge phase errors. • Synchronization • Hard synchronization will be done to align bits at the beginning of a message. • Phase_seg1 is lengthened or phase_seg2 is shortened to minimize phase error by up to the synchronization jump width (SJW). Larger phase errors cannot be compensated for. • See:http://www.can.bosch.com/docu/CiA99Paper.pdf

  22. Physical Layer • Many physical layer definitions • Most ISO 11898 based • Maximum number of ECU's • Typical 30 (per segment) • Typical Media • Twisted shielded pair • 120 W nominal impedance • Two data lines (CAN_H, CAN_L) • One shield • Twisted Quad un-shielded • 75 W nominal impedance • Two data lines (CAN_H, CAN_L) • Two termination supply lines • Signal • Compatable with ISO 11898 drivers (eg. Phillips 80C250)

  23. ISO 11898 Bus levels – Microchip AN 228

  24. Mapping of CAN to the OSI – Microchip AN 228 • Characteristics of CAN - CAN provides Data Link functions

  25. To form a complete communications system ISO 7498

  26. Message Filtering - Example Accept if: (ID AND MASK) XOR MATCH = 0 10111100100 IDENTIFIER 1 = Care, 0= Don’t Care 11100000000 MASK 10100000000 = ID AND MASK Pattern must match 10100000000 MATCH 00000000000 = (ID AND MASK) XOR MATCH

  27. Error Detection • 5 Error Types Detected • Bit Error (Sent bit doesn’t match monitored bit) • Stuff Error (more than 6 successive in one state) • CRC error • Form Error • Acknowledge Error • Probability of an undetected error • 4.7 x 10-11 x message error rate • for a message error rate of 25/sec, 1 undetected error per 10,000 hours operation

  28. Assignment • Install the Pont time triggered scheduler in hardware and toggle the RED/GREEN LED at 1 per sec. • Read Pont, Chapter 25, 28 • Tutorial – 30 min • Review SAE J1708, SAE J1850, SAE J1939 • or • Review DeviceNET and SDS

More Related