Kein Folientitel

Download Report

Transcript Kein Folientitel

04EI
C164CI - CAN-Interface
C166-Core
64 K
ROM
Data
(C164 CI-8RM)
CPU
Instr./Data
or
OTP
32
Data
16
Dual Port
16
RAM
2 KByte
(C164CI-8EM)
Watchdog
0.5; 1; 1.5; 2;
2.5; 3; 4; 5
PEC
16
Port 0
P4.6/ CAN
TxD
RTC
13 ext. IR
16
Interrupt Bus
Peripheral Data
16
External Bus
8/16 bit
MUX only
&
XBUS
Control
Port 4
10-Bit USART Sync. GPT1 CAPCOM 2 CAPCOM6 Unit for
PWM Generation
Channel
ADC
T2
(SPI)
8-Channels
8-Channel
ASC
SSC
T3
BRG
BRG
T4
Port 3
Port 5
Timer 13
Full-CAN
Interface
V2.0B
active
Interrupt Controller
Timer 8
P4.5/ CAN
RxD
XBUS (16-bit NON MUX Data / Addresses)
External Instr./Data
Timer 7
XTAL
PLL-Oscillator
prog. Multiplier:
1 Comp.
Channel
Port 8
3/6 CAPCOM
Channels
Port 1
164 CL
6
8
12.08.2013
D
9

Embedded Systems
4
16
Page1
04EI
Controller Area Network - CAN
•
CAN is a protocol for serial communication that supplies distributed
realtime tasks with very high safety-requirements
•
•
CAN is standardized
ISO-DIS 11898
– ISO-DIS 11519-2
23.9.2009
D

(high speed applications)
(low speed applications)
Embedded Systems
Seite 2
04EI
CAN - features
• Low costs
– Serial BUS for 2-wire-lines
– High number of CAN-nodes in the automotive sector and in industrial
electronics
• Reliability/Data Integrity
– Sophisticated mechanisms for error detection and handling result in
high reliability of the transmission
Example:
• 500 kbit/s, 25% bus-load, 2000 operating hours a year
Result: Only one undetected error in 1000 years!
– Defective messages are detected and repeated
– Every bus-node will be informed in case of an error
– Low susceptibility against electromagnetic interference
• Flexibility
– Nodes can be very easily added or removed (plug & play).
– The number of nodes isn’t limited by the protocol
12.08.2013
D

Embedded Systems
Page 3
04EI
CAN - Features
• High performance realtime-behaviour
– Short messages: 0 to 8 bytes data per message.
– Short time of latency between the request of a message and the start of the
transmission
– Prioritization of messages (Arbitration on Message Priority - AMP)
– Multi Master protocol with CSMA/CD
• High performance transmission rate
– maximum transfer rate is 1 MBit/s at 40m bus-length and still about 40 kBit/s
at bus-length of 1000m
• Multi-Master-Operations
– Every node can be the master
– The bus-communication is not prevented by defective nodes
– Defective nodes switch off from the bus by themselves
• Flexible addressing mechanisms
– Messages can be sent to only one or to several nodes
– All modes receive simultaneously public data simultaneously
12.08.2013
D

Embedded Systems
Page 4
04EI
CAN: Typical application
12.08.2012
D

Embedded Systems
Page 5
04EI
Protocol layers of the CAN
Process-Application
Layer
7
1
Application Layer
Data
Link
Layer
Physical
Layer
12.08.2013
Logical Link Control
Error detection, error handling;
Control of data-flow;
Acceptance filtering.
Medium Access Control
Bit-Stuffing, Framing,
Arbitration
Physical Signalling
(Bit –coding, -timing, -synchron.)
Physical Medium Attachment
(Transmitter/Receiver-Spec.)
Medium Dependent Interface
(Cable, Plug...)
D

Management
2
CAL,
CANopen (CiA)
DeviceNet
SDS (Honeywell)
etc ...
Embedded Systems
CAN
(ISO
11898)
Bosch
Page 6
04EI
Higher Protocol Layers
• CAN Application Layer (CAL)
– Layer-7 Standard defined by “CAN in Automation” (CiA)
– Network-Management for initialisation, monitoring and configuration
of nodes in standardised form
– Takes into account all aspects for the realisation of open
communication via CAN (provides the cooperation of producer
specific systems)
– Available implementations of CAL simplify the user getting
sophisticated “Controller Area Networks”
• CANopen
– Applications are based on CAL.
– CANopen dertermines the mode of communication, an applicationprofile defines the meaning of certain messages) for the considered
application
– aim: Changeabilty of the subsystems of dedicated applications
• Further higher protocol layers (standards):
– Automotive-sector: VOLCANO, OSEK
– Industrial Automation: DeviceNet (ODVA), SDS (Honeywell)
12.08.2013
D

Embedded Systems
Page 7
04EI
CAN Protocol Layers
Process-Application
Layer
7
1
Application Layer
Data
Link
Layer
Physical
Layer
12.08.2012
Medium Access Control
Bit-Stuffing, Framing,
Arbitration
Logical Link Control
Error detection, error handling;
Control of data-flow;
Acceptance filtering.
Physical Signalling
(Bit –coding, -timing, -synchron.)
Physical Medium Attachment
(Transmitter/Receiver-Spec.)
Medium Dependent Interface
(Cable, Plug...)
D

Management
2
CAL,
CANopen (CiA)
DeviceNet
SDS (Honeywell)
etc ...
Embedded Systems
CAN
(ISO
11898)
Bosch
Page 8
04EI
Basic Characteristics of CAN
• Asynchronous serial bus with linear bus-structure and identical
nodes (Multi-Master-BUS)
• Nodes won’t be addressed - the addresses are parts of the
message and are related to those, just as the priority is a
characteristic of the message
• Two bus-states: dominant and recessive
– the bus-activation is realized according to the "Wired-AND”mechanism:
dominant bits (logical 0) overwrite recessive bits (logical 1)
• Bus-access via CSMA/CD with NDA (Carrier Sense Multiple
Access/ Collision Detection with Non-Destructive Arbitration):
– Before transmission it is tested whether the bus is free
– Each sender tests whether the bus level is consistent to its
transmission level
– In case of discrepancy transmission is stopped and switched to
receiving mode
12.08.2013
D

Embedded Systems
Page 9
04EI
Basic Characteristics of CAN
recessive
NODE A
dominant
recessive
NODE B
dominant
bus idle
recessive
CAN BUS
dominant
Node B transmits recessive level
but reads back dominant level
12.08.2013
D

Node B loses arbitration
and switches to receive mode
Embedded Systems
Page 10
04EI
Typical Structure of CAN-Nodes
Node A
Node B
z.B.
ABS
z.B.
EMS
Host-Controller
z.B.
80C166
z.B.
C164CR
oder
C515C
CAN-Controller
z.B.
SAE81C90
Application
CAN
(further nodes)
CAN-Transceiver
CAN_H
CAN-BUS
UDiff
CAN_L
12.08.2013
D

Embedded Systems
Page 11
04EI
CAN data frames
• There are two situations in communication:
– One node is transmitting (’talker’),
all other nodes are receiving (’listener’)
– Nodes A requires (from an other node) anything and gets the answer
• In ’Talk’-mode CAN-nodes use data frames
– data frames consist of:
• an identifier
• the data, which should be transmitted
• and a CRC-checksum
Identifier
Data Field (0..8 Bytes)
CRC-Field
– The Identifier specifies the content of the message (‘car velocity’ , ‘oil
temperature’, etc.) and the priority of the message
– The data field contains the appropriate value (’36 m/s’, ’110°C’, etc.).
– The Cyclic Redundancy Check provides detection of transmission
errors
– All nodes receive the data frames, unaffected nodes ignore it
Base Can Frame
12.08.2013
D

Embedded Systems
Page 12
04EI
CAN Remote Frames
• In order to get information “Remote Frames” are used
– A Remote Frame consists of the identifier and the CRC-checksum,
no data are contained
Identifier
CRC-Field
– The identifier refers to the information to be queried (’car velocity ',
’oil temperature', etc.) and the priority of the message
– Every node having available the required information (e.g. the
sensor for the oil temperature) reacts with transmission of the
appropriate ‘Data Frame’ (same identifier, the data field contains
the required information).
How hot is the oil ?
Node B
Remote Frame; Identifier ’Oil_temp'
Node A
(oil temp.Sensor)
115 °C !
~~~~~
~~~~~
115°C
Data Frame; Identifier ’Oil_temp';
Contains required information
12.08.2013
D

Embedded Systems
Page 13
04EI
Standard CAN / Extended CAN
• CAN Version 2.0A - Standard CAN:
– The Standard-Frame contains an 11 Bit identifier
– With that 211 (=2048) different “messages” can be addressed
• CAN Version 2.0B (active) - Extended CAN:
– The “Extended Frame” has got an identifier with a length of 29 Bit
– Via that more than 536 Million (229) different “messages” can be
addressed
• CAN Version 2.0B (passive) :
– Some Standard-CAN-Nodes are not able to receive “Extended Frames”,
but they are tolerating them and ignore their “messages”. They don’t
receive any data, as they don’t produce any errors.
– These CAN-Nodes use CAN Version 2.0A, but they are also denoted as
nodes Version 2.0B passive
– They are used in networks, in which “Standard Frames” as well as
“Extended Frames” are worked with
12.08.2013
D

Embedded Systems
Page 14
04EI
CAN-Contoller
• Infineon C164CI: V2.0B active
• CAN-Controllers perform the management of the messages and
its acceptance filtering autonomously:
Full-CAN-Controller:
– There are a lot of Message-Objects with its appropriate identifier.
– Only if a message with one of the specified identifiers is received, it will
be saved and the execution of the program will be interrupted
– In that way the load of the CPU can be kept low
Message Object 1
Acceptance
Filtering
CAN Bus
Message Object 2
.
.
Message
Management
Message Object n
Full-CAN Controller
12.08.2013
D

Embedded Systems

low
high
CPU load
Host CPU
page 15
04EI
Characteristics of the C164CI CAN-Module
• The characteristics are comparable with
the common CAN-Controller AN82527
• All requirements of “CAN spec. V2.0B
active” are met
(Standard- und Extended-CAN)
• Maximum CAN-transfer rate of 1 MBit/s
• Full CAN Device:
– 15 Message-Objects with appropriate
identifiers and appropriate state- und
control-Bits
– Each Message-Object can be defined as
transmit - or receive-object.
12.08.2013
D

Embedded Systems
page 16
04EI
Characteristics of the C164CI CAN-Module
• Programmable mask-register for acceptance-Filtering
– Global mask for incoming messages (Full-CAN-Objects)
– Additional mask for message-object 15
(Basic -CAN-) Characteristic
• Basis-CAN- Characteristic (of Message-Object 15)
– Two receiver buffers
– Separate global mask-register for acceptance-filtering
• Connection to CPU (C166-Core)
– The module is connected via the chip-internal XBUS
(16-Bit BUS-Width)
– Interrupts directly to the CPU with all facilities of the interrupt
handling
• To connect with the CAN-BUS only physical level conversion
via a Standard-CAN-Transceiver is needed
12.08.2013
D

Embedded Systems
page 17
04EI
Connection of the C164CI to the CAN-BUS
C164CI
Pa.b
Connection
to the
application
CAN-Bus
Transceiver
CAN_L
P4.5
CAN_RxD
CAN_H
Receive
CAN_H
P4.6
CAN_TxD
Transmit
CAN_L
Pc.d
(Standby)
z.B. P8.0
R(opt)
•
The CAN-Module uses 2 pins of Port 4 as interface to a BUSTransceiver (P4.5 - CAN_RxD, P4.6 - CAN_TxD).
12.08.2013
D

Embedded Systems
page 18
04EI
ACCEPTANCE FILTERING
Global Mask
(Part of
General Registers)
1
1
1
1
1
1
1
0
1
1
0
CAN CONTROLLER
Arbitration Register
(LAR, Teil des
Message Object)
1
0
0
1
0
0
1
0
1
1
1
Resultant
valid Identifier
"d" = don't care
1
0
0
1
0
0
1
d
1
1
d
a)
1
0
0
1
0
0
1
0
1
1
1
b)
1
0
0
1
0
0
1
0
1
1
0
c)
1
0
0
1
0
0
1
1
1
1
0
d)
1
0
0
1
0
0
1
1
1
1
1
Because of the "don't care"Bits also messages with
identifiers b)..d) are
acceppted
12..08.2013
D
CAN MESSAGES
Remark:
If ‘data frames‘ from more than one Message Object are accepted, so
the data frame is stored in the object with the lowest number.
If ‘remote frames‘ from more than one Message Object are accepted,
so the data of the Object with the lowest number are transmitted

Embedded Systems
page 19
04EI
Bit-Timing
Duration of a Bit
SyncSegm.
TSeg1
TSeg2
SyncSegm.
1 Zeiteinheit
SampleTime
•
Transmission Time
The Bit-Timing is derived from the system clock fPERIPHERAL and is
programmable up to the data rate of 1 MBaud (@ f CPU 16 MHz)
SFRcan
12.08.2013
D

Embedded Systems
page 20
04EI
Register of the CAN-Controller
EF00H
EF10H
EF20H
EF30H
EF40H
EF50H
Control/Status Register
Message Object 1
Interrupt Register
Message Object 2
Bit Timing Register
Message Object 3
Global Mask Short
Message Object 4
Global Mask
Long
Message Object 6
EF70H
Mask of last Message
EF02H
EF04H
EF06H
EF08H
EF0CH
EF0EH
Message Object 7
EF80H
EF00H
EF0AH
Message Object 5
EF60H
Message Object 8
EF90H
Message Object 9
EFA0H
Message Object 10
EFB0H
Message Object 11
EFC0H
Message Object 12
EFD0H
Message Object 13
EFE0H
Message Object 14
EFF0H
12.08.2013
General Registers
SFRcan
Message Object 15
D

Embedded Systems
page 21
04EI
Message Object
+0
Message Control
Object start address
+2
Arbitration
+4
Data 0
Message Config.
Data 2
Data 1
Data 4
Data 3
Data 6
Data 5
reservated
Data 7
+6
+8
+A
+C
+E
SFRcan
CAN-SW
12.08.2012
D

Embedded Systems
page 22