an introduction to can can basics 2 renesas interactive

22
1 Renesas Technology America Inc. An Introduction to CAN An Introduction to CAN CAN Basics 2 CAN Basics 2 Renesas Interactive Renesas Interactive

Upload: kyrie

Post on 12-Jan-2016

38 views

Category:

Documents


0 download

DESCRIPTION

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 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: An Introduction to CAN CAN Basics 2 Renesas Interactive

1

Renesas Technology America Inc.

An Introduction to CANAn Introduction to CAN

CAN Basics 2CAN Basics 2Renesas InteractiveRenesas Interactive

Page 2: An Introduction to CAN CAN Basics 2 Renesas Interactive

2

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)

Page 3: An Introduction to CAN CAN Basics 2 Renesas Interactive

3

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.

Page 4: An Introduction to CAN CAN Basics 2 Renesas Interactive

4

Data Frame is broadcast to the bus [id_n][value_x]

Transmitting Node

MCU Firmware

identifier [id_n]

Data [values_x]

CAN Peripheral

CAN Transceiver

Node configured to receive identifier

MCU Firmware

CAN Transceiver

CAN Peripheral

Rx Mail Box [id_n]

Rx Mail Box [id_b]

Tx Mail Box [id_c]

Data [values_x]

Data [values_x]

Tx Mail Box [id_n]

Rx Mail Box [id_c]

Rx Mail Box [id_b]

Data [values_x]

Node not configured to receive identifier

MCU Firmware

CAN Transceiver

CAN Peripheral

Rx Mail Box [id_d]

Tx Mail Box [id_b]

Rx Mail Box [id_c]

Rx Mail Box [id_a]

Data Flow

Page 5: An Introduction to CAN CAN Basics 2 Renesas Interactive

5

Data Frame

• Start of Frame

• Arbitration Field

• Control Field

• Data Field

• CRC

• ACK Field

• End of Frame

re

se

rve

d 0

re

se

rve

d 0

AC

K D

elim

ite

r

AC

K D

elim

ite

r

Sta

rt

of

Fra

me

Re

mo

te R

eq

ue

st

ID E

xte

nd

Da

ta L

en

gth

C

od

e (

4 b

its)

Data Field0 to 8 bytes

CR

C D

elim

ite

rA

CK

slo

t

End of Frame

Sta

rt

of

Fra

me

Su

bstitu

te R

RID

Exte

nd

Da

ta L

en

gth

C

od

e (

4 b

its)

Data Field0 to 8 bytes

CR

C D

elim

ite

rA

CK

slo

t

End of Frame

Re

mo

te R

eq

ue

st

Standard ID

Extended ID

CRC

CRC

Identifier

Identifier(second part)

re

se

rve

d 1

Identifier(first part)

Page 6: An Introduction to CAN CAN Basics 2 Renesas Interactive

6

Start of Frame

• A single dominant bit while the bus is idle• All nodes synchronize timing to leading edge

All nodes synchronize to

edge

Page 7: An Introduction to CAN CAN Basics 2 Renesas Interactive

7

Arbitration Field

Standard; 11-bit identifier

Extended; 29-bits

Page 8: An Introduction to CAN CAN Basics 2 Renesas Interactive

8

Arbitration

Carrier Sense Multiple Access/Collision Resolution= CSMA/CR

By using Dominant and Recessive Bits

Handling collisions

Page 9: An Introduction to CAN CAN Basics 2 Renesas Interactive

9

Control Field

Control Field contains the DLC• 2 bits reserved• 4 bits Data Length Code; number of Data Field bytes

Number of Data Bytes

Data Length Code

DLC3 DLC2 DLC1 DLC0

0 0 0 0 0

1 0 0 0 1

2 0 0 1 0

3 0 0 1 1

4 0 1 0 0

5 0 1 0 1

6 0 1 1 0

7 0 1 1 1

8 1 0 0 0

Page 10: An Introduction to CAN CAN Basics 2 Renesas Interactive

10

Data Field

• Data content = payload

of the frame• 0-8 bytes• MSB transmitted first

Page 11: An Introduction to CAN CAN Basics 2 Renesas Interactive

11

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

Page 12: An Introduction to CAN CAN Basics 2 Renesas Interactive

12

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

Page 13: An Introduction to CAN CAN Basics 2 Renesas Interactive

13

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..

Page 14: An Introduction to CAN CAN Basics 2 Renesas Interactive

14

Error detection

Locally detected errorsWhen 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

Page 15: An Introduction to CAN CAN Basics 2 Renesas Interactive

15

What is needed?

• Firmware• CAN controller • CAN transceivers• A physical media

Page 16: An Introduction to CAN CAN Basics 2 Renesas Interactive

16

Example of Renesas 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

Page 17: An Introduction to CAN CAN Basics 2 Renesas Interactive

17

Which is normally by far the most common frame type?

1. Data Frame

2. Error Frame

3. Overload Frame

4. Remote Frame

A: 1

B: 2

C: 3

D: 4

Question 1

Page 18: An Introduction to CAN CAN Basics 2 Renesas Interactive

18

Which of these statements is false?

1. The data field in a data frame can consist of max 255 bytes

2. The data field has only 8 bytes

3. You must specify for each data frame how many data bytes follow

4. Remote frames are not necessary to use CAN

A: 1

B: 2

C: 3

D: 4

Question 2

Page 19: An Introduction to CAN CAN Basics 2 Renesas Interactive

19

Which of these is false?

1. The CRC field is sent by all receivers and verified by the transmitter.

2. Each receiver generates a CRC on the observed data frame and compares it with the transmitted CRC check value.

3. 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 3

Page 20: An Introduction to CAN CAN Basics 2 Renesas Interactive

20

When is an error frame sent?

1. Bit stuffing violation; > 5 bits with same polarity

2. CRC error; checksum violation

3. Form error; bit pulse malshaped

4. 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

Question 4

Page 21: An Introduction to CAN CAN Basics 2 Renesas Interactive

21

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.

Page 22: An Introduction to CAN CAN Basics 2 Renesas Interactive

22

Come back for more!

End CAN Basics 2End CAN Basics 2