260 likes | 393 Views
An Introduction to CAN CAN Basics 2 Renesas Interactive. Key reasons to use CAN. Scalability Low wiring cost Low node connection costs More and more chips More off the shelf tools Knowledge base growing Reliability (error free). CAN Message Frames. Data Frame - Carries the actual data
E N D
An Introduction to CAN CAN Basics 2 Renesas Interactive
Key reasons to use CAN • Scalability • Low wiring cost • Low node connection costs • More and more chips • More off the shelf tools • Knowledge base growing • Reliability (error free)
CAN Message Frames • Data Frame - Carries the actual data • Error Frame - When error is detected by any node’shardware • Overload Frame - Request a delay on the bus • Interframe Space - Provides minimum spacing between data and remote frames Allows error frames priority • Remote Frame - Request transmission of Data Frame.
Data Frame • Start of Frame • Arbitration Field • Control Field • Data Field • CRC • ACK Field • End of Frame
Start of Frame • A single dominant bit while the bus is idle • All nodes synchronize timing to leading edge All nodes synchronize to edge
Arbitration Field Standard; 11-bit identifier Extended; 29-bits
Arbitration Carrier Sense Multiple Access/Collision Resolution = CSMA/CR By using Dominant and Recessive Bits Handling collisions
Control Field Control Field contains the DLC • 2 bits reserved • 4 bits Data Length Code; number of Data Field bytes
Data Field • Data content = payload of the frame • 0-8 bytes • MSB transmitted first
CRC Field • 15 bit CRC value followed by a recessive delimiter • Generated by transmitter node’s HW and verified in receiver’s HW • CRC polynomial: x15+x14+x10+x8+x7+x4+x3+1
ACK Field ACK FIELD = ACK SLOT + ACK DELIMITER All receivers that received valid message reports with a ’dominant’ bit during the ACK slot Any receiver that disagrees votes no after the delimiter with an error flag
End of Frame DATA FRAME and REMOTE FRAME delimited by ‘End of Frame’ consisting of seven recessive’ bits. Gives a break before the next frame..
Error detection Locally detected errors When is an error frame sent? • Bit error -receive bit at sender not equal to transmit bit. • Bit stuffing violation -max 5 bits with same polarity • CRC error -checksum violation • Form error -bit pulse malshaped • Ack error -no dominant level in ACK slot so sender must retransmit
What is needed? • Firmware • CAN controller • CAN transceivers • A physical media
Example ofRenesas CAN MCUs • SH705x series • Automotive Powertrain • SH7047 series • General purpose SH2…soon updated derivative available. • M32R/ECU series • Automotive Powertrain • M32C series • General purpose (1-3 channels of CAN) • M16C/6N series • M16C/62 family with CAN. General purpose. • M16C/29 series • General Purpose M16C/Tiny with CAN. • M16C/10 series • Better off with M16C/Tiny or R8C/Tiny • R8C/Tiny series • General Purpose
Question 1 Which is normally by far the most common frame type? • Data Frame • Error Frame • Overload Frame • Remote Frame A: 1 B: 2 C: 3 D: 4
Question 2 Which of these statements is false? • The data field in a data frame can consist of max 255 bytes • The data field has only 8 bytes • You must specify for each data frame how many data bytes follow • Remote frames are not necessary to use CAN A: 1 B: 2 C: 3 D: 4
Question 3 Which of these is false? • The CRC field is sent by all receivers and verified by the transmitter. • Each receiver generates a CRC on the observed data frame and compares it with the transmitted CRC check value. • Every receiver which has received a valid message correctly, reports this to the transmitting node with a ’dominant’ bit during the ACK slot. Any node that disagrees, votes no after the delimiter by sending an error flag. A: 1 B: 2 C: 3
Question 4 When is an error frame sent? • Bit stuffing violation; > 5 bits with same polarity • CRC error; checksum violation • Form error; bit pulse malshaped • Ack error; no dominant level in ACK slot so sender must retransmit A: 1-3 B: 2-4 C: 2 and 4 D: All above
Glossary • Advanced CAN: CAN peripheral with varying numbers of buffers configurable for transmit/receive. Receive buffers have hardware filtering on at least mask/match identifier content. • Basic CAN: CAN peripheral with no hardware filtering. Typically two receive buffers act as FIFO accepting all bus traffic. Usually one transmit buffer. • Bit Time: Nominal time of one bit on the CAN bus. Made up of multiple segments that allows each node to synchronize to the received bus traffic. All nodes on a bus must be configured to the same (nominal) bit time. • CAN:Controller Area Network • CAN 2.0B: Version 2.0 was the last version of CAN defined by Bosch. Part B added extended identifiers and the idea of hardware filtering. • CIA: CAN in Automation. Group controlling the CANOpen protocol. • CANOpen: Multi-area communication protocol using CAN. • CRC: Cyclic Redundancy Check • DeviceNet: Industrial communication protocol using CAN. • Dominant/Recessive: Dominant bits on physical layer can override recessive bits. • Filters: Hardware in the CAN peripheral that can mask/match bits within the identifier field used to determine whether or not route bus data to a mailbox. • GM LAN 3.0: GM protocol, encompasses all GM serial protocols. • Identifier: Frame field that indicates the message content. This field also is used to arbitrate the message priority on the bus; lower identifier is higher priority. • Standard Format; frames use 11 bit identifier. • Extended Format “- 29 bits • ISO 11898: ISO standardized version of CAN. • Mailbox: CAN hardware buffer that can be used to transmit or receive data. Most full CAN implementations have at least 16 mailboxes. • ODVA: Open DeviceNet Vendor Association. Group controlling DeviceNet protocol. • Time Quanta: Smallest time unit used by CAN. Multiple time quanta make up the segments of a bit time. • TT CAN: Time Triggered CAN. More deterministic CAN by assigning time slots when nodes may transmit. • FlexRay: Next generation automotive network. Time slots on the bus provide more deterministic behavior. • Vector-CanTech: Supplier of the majority of CAN software drivers and tools to North American and European automobile ECUs.
Come back for more! End CAN Basics 2