Download Advantages of CAN and LIN in Networked Embedded Systems

Document related concepts

Distributed operating system wikipedia , lookup

Airborne Networking wikipedia , lookup

Internet protocol suite wikipedia , lookup

Low-voltage differential signaling wikipedia , lookup

Low Pin Count wikipedia , lookup

VMEbus wikipedia , lookup

IEEE 1355 wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

MIL-STD-1553 wikipedia , lookup

Bus (computing) wikipedia , lookup

UniPro protocol stack wikipedia , lookup

CAN bus wikipedia , lookup

Transcript
ID 210C: Introduction to CAN/LIN Solutions
Renesas Electronics America Inc.
Sridhar Lingam
Product Marketing Manager
12 October 2010
Version 10
Sridhar Lingam
 Product Marketing Manager
 Renesas MCU CAN Solutions
 M16C/R32C, H8S/H8SX Product Families
 TFT-LCD solution for H8S and H8SX
 Education
 MSEE from the Clemson University, Clemson, SC
 Work Experience
 16 years experience with semiconductor Industry with focus on
Industrial applications
 Varied experience as Product Engineer, FAE and Product
Marketing
 Responsible for definition and Marketing of Memory & MCU
product families
 Previously worked at National Semiconductor,
STMicroelectronics & Atmel
2
Renesas Technology and Solution Portfolio
Microcontrollers
& Microprocessors
#1 Market share
worldwide *
ASIC, ASSP
& Memory
Advanced and
proven technologies
Solutions
for
Innovation
Analog and
Power Devices
#1 Market share
in low-voltage
MOSFET**
* MCU: 31% revenue
basis from Gartner
"Semiconductor
Applications Worldwide
Annual Market Share:
Database" 25
March 2010
** Power MOSFET: 17.1%
on unit basis from
Marketing Eye 2009
(17.1% on unit basis).
3
Renesas Technology and Solution Portfolio
Microcontrollers
& Microprocessors
#1 Market share
worldwide *
Solutions
for
Innovation
ASIC, ASSP
& Memory
Advanced and
proven technologies
Analog and
Power Devices
#1 Market share
in low-voltage
MOSFET**
* MCU: 31% revenue
basis from Gartner
"Semiconductor
Applications Worldwide
Annual Market Share:
Database" 25
March 2010
** Power MOSFET: 17.1%
on unit basis from
Marketing Eye 2009
(17.1% on unit basis).
4
Microcontroller and Microprocessor Line-up
Superscalar, MMU, Multimedia
High Performance CPU, Low Power
High Performance CPU, FPU, DSC
 Up to 1200 DMIPS, 45, 65 & 90nm process
 Video and audio processing on Linux
 Server, Industrial & Automotive
 Up to 500 DMIPS, 150 & 90nm process
 600uA/MHz, 1.5 uA standby
 Medical, Automotive & Industrial
 Up to 165 DMIPS, 90nm process
 500uA/MHz, 2.5 uA standby
 Ethernet, CAN, USB, Motor Control, TFT Display
 Legacy Cores
 Next-generation migration to RX
General Purpose
 Up to 10 DMIPS, 130nm process
 350 uA/MHz, 1uA standby
 Capacitive touch
5
Ultra Low Power
Embedded Security
 Up to 25 DMIPS, 150nm process  Up to 25 DMIPS, 180, 90nm process
 190 uA/MHz, 0.3uA standby
 1mA/MHz, 100uA standby
 Application-specific integration  Crypto engine, Hardware security
Microcontroller and Microprocessor Line-up
Superscalar, MMU, Multimedia
High Performance CPU, Low Power
High Performance CPU, FPU, DSC
 Up to 1200 DMIPS, 45, 65 & 90nm process
 Video and audio processing on Linux
 Server, Industrial & Automotive
 Up to 500 DMIPS, 150 & 90nm process
 600uA/MHz, 1.5 uA standby
 Medical, Automotive & Industrial
 Up to 165 DMIPS, 90nm process
 500uA/MHz, 2.5 uA standby
 Ethernet, CAN, USB,
Motor
Control,
TFT Display
CAN
MCU
Solutions
 Legacy Cores
R8C/R32C/SH/RX
 Next-generation migration to RX
General Purpose
 Up to 10 DMIPS, 130nm process
 350 uA/MHz, 1uA standby
 Capacitive touch
6
Ultra Low Power
Embedded Security
 Up to 25 DMIPS, 150nm process  Up to 25 DMIPS, 180, 90nm process
 190 uA/MHz, 0.3uA standby
 1mA/MHz, 100uA standby
 Application-specific integration  Crypto engine, Hardware security
Innovation
7
Our CAN/LIN Solution
Renesas’ easy to design MCU CAN/LIN solutions
provide highly reliable, expandable, and noise immune
interfaces for industrial applications using chip to chip
communications.
8
Agenda
 CAN in Embedded Networks
 What is CAN & it’s benefits?
 Can Basics
 What is LIN and it’s benefits?
 Renesas MCU CAN Solutions
 Q&A
9
Key Takeaways
 Reasons for using CAN and LIN
 Benefits of CAN and LIN
 Basics of CAN and LIN
 General differences between CAN and LIN
10
What is CAN ?
 Controller – Area – Network
 Developed in 1983 by Robert Bosch
 To solve the networking issues in automotive
 Main Benefits
 Economical
 Reliable
 Real Time response
 Scalable
 Standards
 CAN 2.0A (ISO11519)
 Can 2.0B(ISO11898)
11
CAN-Leading Choice for Embedded Networking
 The main Reasons are
 Economical
– Low Wiring Cost
– Low Hardware Cost
 Reliability
– Error Free Communication
– Immune to EMI/EMS
 Availability
– Several 8/16/32 bit MCU available in the market
– Standard development tools
 Scalability
12
Question
 Please give 3 reasons for the growing popularity of
CAN in embedded applications
 Reliability (works well in noisy environment)
Economical ( Have low wiring costs)
Scalability
Availability
13
Features and Benefits of CAN
14
 Multiple Master Hierarchy
 Redundant Intelligent Systems
 1 Mbps of Data transfer rate
 Real Time Response
 0-8 Bytes of User Data
 Simplifies design requirements
 Unique mail box Identifiers
 Flexibility in System Design
 Acceptance Filtering by nodes
 Arbitration & Prioritization
 Provides Error Detection
 Ensures high Reliability
 Fault Confinement measures
 Keeps the traffic undisturbed
 Auto re-transmit if corrupted
 Accurate communication link
CAN and the 7-layer model
ISA/OSI Reference Model
7. Application Layer
6. Presentation Layer
5. Session Layer
4. Transport Layer
Partially
implemented by
higher-level CAN
protocols
(CANOpen)
3. Network Layer
2. Data Link Layer
1. Physical Layer
15
Standard CAN
implementation
Managed in
Hardware.
Dramatic Real-time
advantage to
System Design
Data Flow in CAN
Transmitting Node
Node Configured to
receive identifier
Node not Configured to
receive identifier
MCU Firmware
MCU Firmware
MCU Firmware
Identifier [id_n]
Identifier [id_n]
Data [values_x]
Data [values_x]
Tx Mail Box [id_n]
Rx Mail Box [id_c]
Rx Mail Box [id_d]
Data [values_x]
Rx Mail Box [id_b]
Rx Mail Box [id_b]
Rx Mail Box [id_c]
Rx Mail Box [id_n]
Rx Mail Box [id_c]
Rx Mail Box [id_b]
Data [values_x]
Rx Mail Box [id_a]
CAN Peripheral
CAN Peripheral
CAN Peripheral
CAN Transceiver
CAN Transceiver
CAN Transceiver
Data Frame is broadcast to the bus [ id_n][value_x]
16
Data Frame
Identifier
Rem Req
1
11/29
1
ID extend
S
O
F
Control
Data
(Bytes)
C
R
C
A
C
K
E
O
F
1
4
0-8 bytes
15
1
7+
 Start of Frame – 1-bit
 Arbitration Field – 11-bits/29-bits
 Control Field – 6 bits (2 reserved, 4 representing number of
Data Field bytes)
 Data Field – 0 to 8 BYTES
 CRC – 15-bits
 ACK Field – 1-bit/variable
 End of Frame – 7-bits (recessive)
17
Question
 Why do most CAN applications use CAN 2.0A (11-bit
identifiers) and not CAN 2.0B (29-bit identifiers)?
 Overall data bandwidth decreases
Decrease in reliability
Increase in worse case delay
18
CAN Bus Characteristics

Dominant bits (0’s) override recessive bits (1’s) on the CAN
bus.
Node 1 Backs OffNode 1
100
0
Node 2 Backs OffNode 2
101
Node 3
000
LSB…MSB
19
Maintaining Synchronization
 ‘Bit Stuffing’ is applied to keep the bus synchronized
 Five bits of consecutive dominant or recessive bits inserts a bit
of the opposite polarity
 Resulting signal edge is used to establish timing synchronization
at all nodes
 Stuffed bits are managed by hardware
20
Bus Access and Arbitration
 The CAN protocol handles bus accesses according to the
concept of “Carrier Sense Multiple Access with Collision
Detection”
 For a collision, messages are NOT destroyed!
No bandwidth is wasted on collisions!
 The message with the higher priority wins bus access
– NDA – “Non-destructive Arbitration”
 Each message has an identifier that determines the priority
 Each node defined by unique identifier to avoid collisions
 AMP – “Arbitration by Message Priority”
21
CAN and EMI
Node A
Node B
V
CAN_H
U diff
CAN_L
(dominant level)
CAN_H
+
CAN_L
-
+
-
EMI
CAN-Bus
(Differential Serial Bus)
22
t
Node C
CAN Baud Rate vs. Bus Length
1000
500
Bus lines
assumed to be
an electrical
medium
(e.g. twisted pair)
200
Bit Rate
[kbps]
100
50
20
10
5
0
10
40 100
200
1000
CAN Bus Length [m]
23
10,000
Error Detection in CAN
 Error statistics depend up on the entire environment
 Total number of nodes
 Physical Layout
 EMI Disturbance
 CAN application example running at
 2000 hours/year, 500 Kbps, 25% Bus load
 Results in one undetected error in 1000 years
24
CAN
Controller
Physical Layer
Physical CAN Bus
(Differential, e.g Twisted Pair)
CAN_Txd
CAN_Rxd
CAN_Txd
Differential
CAN_Rxd Transceiver
CAN_Txd
CAN_Rxd
Optical
Transceiver
Optical Fiber
25
Cables and Connectors
 CAN does not specify the physical media
 Common Wire
 Twisted pair
 Shielded twisted pair
 If optional power is needed: additional twisted pair
– A pair of “shielded twisted pair”
 Application specific
 Common Connector




26
9-pin Dsub
5-pin mini style
Terminal blocks
Application specific (e.g. telephone jacks)
What is LIN ?
 Local Interconnect Network
 A slower & low cost alternative to CAN
 Developed by LIN Consortium in 2002
 Developed as a sub-network of CAN to reduce the Bus Load
 Applications
 Automotive, White Goods, Medical – for sensors and actuators
27
Features & Benefits of LIN
 Complementary to CAN
 Extends CAN to sub-nets
 Single Wire Implementation
 Reduce harness costs
 Speed up to 20Kbps
 Improves EMI response
 Single Master/Multiple Slave
 No arbitration necessary
 Based on common UART/SCI
 Reduces risk of availability
 Self Synchronization
 No external crystal
 Guaranteed latency times
 Deterministic & Predictable
28
Typical LIN Network
ECU & Gateway
CAN 5V CAN
phys
SCI
IF
LIN phys IF
Simplex
12V Operation
29
Node A
Node B
Node C
Node D
SCI
XCVR
SCI
XCVR
SCI
XCVR
SCI
XCVR
LIN Message Frame
message header
synch break
 13 bit
Synchronization
Frame
message response
synch field identifier
Identifier Byte
Synchronization
Field
30
0 to 8 data fields
checksum
Message
LIN Physical Interface
Usually
managed by a
transceiver
LIN Control Unit
Bus Voltage
VBAT
8...18V
master: 1k
slave: 30k
UART
Rx
60%
Bus
40%
Tx
GND
Example capacitances
master: 2.2nF
slave: 220pF
31
recessive
logic ‘1’
controlled slope
~2V/µs
dominant
logic ‘0’
Time
Sense voltage
Taking account of Ground-Shift
Data timing
32
LIN Baud Rate Requirements
 (1)The pre-synchronization accuracy in rev. 1.3 is ±15%, but this is
tightened to 14% in LIN 2.0
33
Question
 What are the reasons when LIN is preferred over CAN?
To save the bandwidth of another main bus
Size of Network is 16 nodes or less
When lower speed is acceptable
Economical
Single Master with multiple slaves
34
LIN versus CAN
LIN versus CAN
35
Access Control
Single Master
Multiple Master
Max Bus Speed
20 Kbps
1 Mbps
Typical # nodes
2 to 16
4 to 20
Message Routing
6-bit Identifier
11/29-bit Identifier
Data byte/frame
2,4,8 bytes
0-8 bytes
Error detection
8-bit checksum
16-bit CRC
Physical Layer
Single-wire
Twisted-pair
Renesas CAN/LIN Solutions
36
Renesas MCU CAN Solutions
SH7216
200MHz@3/5V
High End
Up to 1 MB Flash
1-2 CAN
176 pin
Single
CAN
Multi
CAN
RX600
100MHz@3V
New
SH7264/62
144MHz@3V
SH7286
100MHz@3/5V
Mid End
Up to 1 MB Flash
1-2 CAN
100/144/176 pin
R32C/117
With FPU
64MHz@3/5V
R32C/118
With FPU
CAN API
Compatible
64MHz@3/5V
M16C/29
20MHz@3/5V
Low End
Up to 128 KB Flash
1 CAN
48-64 pin
37
www.america.renesas.com/CAN
R8C/2x
20MHz@3/5V
Implementation of CAN in Renesas MCU
RX
TX
CAN 2.0A / CAN 2.0B
Protocol Engine
Up to 1Mbps data rate
16/32
Message Buffers
INTs
Message Buffer
Clock
Data
Control
CPU
Interface
Acceptance
Filter
Control
Registers
Common
Control/Status
Registers
38
Renesas M16C LIN Roadmap
R32C
Dedicated LIN
Hardware
M16C Platform
M32C
M16C
M16C/Tiny
R8C/3x
39
UART LIN
Common LIN API
Support for all
M16C Products
Renesas CAN Development Kit
 CAN Development Kits for R8C & R32C– CAN-D Kit







R32C
CAN-D
kit now
availabl
e
Two R8C/23 or R32C/118 Renesas Starter Boards
Systec CAN protocol Analyzer included in the kit
E8/E30a Debug Interface
Up to 3 CAN interfaces with 32 mailboxes each
Time-triggered CAN support
All board specific APIs and drivers available in included CD
Extensive third-party middleware support available Sample projects and
evaluation software
– CAN API
– LIN API
Common API for all Renesas CAN MCU Solutions
www.america.renesas.com/CAN
RCDK8C (R8C), MSRP: $495
YRCDK32C (R32C), MSRP: $550
40
Innovation
41
Questions?
42
Feedback Form
 Please fill out the feedback form!
 If you do not have one, please raise your hand
43
Thank You!
44
Appendix
45
Serial Communications
 CAN, LIN, RS-485, RS-232, SPI, I2C, etc. are all serial
communications
 Advantages
 No line-to-line timing skew
 Fewer wires lowering cable, connector, and design costs
 Saves on board space and power consumption per bit
 Disadvantages
 Generally point-to-point
 Overhead above actual data payload that uses bandwidth
 Higher signal rates shorten transmission distances
46
Transmission Topologies
 Point-to-Point (Simplex)
 One transmitter and one receiver per line
 Transmission is possible only in one direction, i.e.
unidirectional.
 Multidrop (Distributed Simplex)
 point-to-point configuration with one transmitter and many
receivers
 Only unidirectional transfer is possible.
47
Transmission Topologies
 Multipoint (Multiplex)
 Many transmitters and many receivers per line.
 Transmission is possible in either direction, i.e. bidirectional.
48
Number of CAN Nodes Built
~Over 2 Billion Nodes
Shipped YTD!!!*
CAN Nodes Built
800
700
600
500
Millions 400
Millions of Units
300
200
100
0
1998
2000
2002
2004
2006
2008
2010
Year
Source: CiA (CAN-in-Automation): http://www.can-cia.org*; REA estimates
49
A Typical 2-channel CAN Solution
2-channel CAN MCU
CPU
CAN
CAN
Lighting
System
Motion
Sensor
Monitor
HVAC
CAN
CAN
Transceiver
Transceiver
Temp
Sensor
50
Motor
Control
CAN Bus 1
CAN Bus 2
Low-Speed
High-Speed
RS-485 vs. CAN
 CAN equals RS-485?







Similar costs
Similar distances
Similar electrical immunity
Similar chip availability
Similar connectors
Same 32 nodes (loads) standard
Duplex (4 wire) or Half-Duplex (2 wire) options available
RS-485 is used primarily due to Legacy.
Remember 8051?
51
RS-485 and the 7-layer model
ISA/OSI Reference Model
7. Application Layer
6. Presentation Layer
5. Session Layer
4. Transport Layer
Partially
implemented by
higher-level
RS-485 protocols
(i.e. MODBUS)
3. Network Layer
2. Data Link Layer
Standard RS-485
implementation
1. Physical Layer
Only Low Layer specification
52
Managed by
CPU in Software
CAN Protocol Versions
 Two CAN protocol versions are available:
 V2.0A (Standard) - 11 bit Message ID’s - 2048 ID’s available
 V2.0B (Extended) - 29 bit Message ID’s - more than 536
Million ID’s available
53
Termination Settings
 High-Speed CAN (125Kbps+)
 For High-Speed CAN, both ends of the pair of signal wires (CAN_H and
CAN_L) must be terminated
 ISO 11898 requires a cable with a nominal impedance of 120 ohms
– 120 ohm resistors should be used for termination
 Only the devices on the ends of the cable need termination resistors
54
Termination Settings
 Low-Speed CAN (Up to 125Kbps)
 Each device on the network needs a termination resistor for each data
line: R(RTH) for CAN_H and R(RTL) for CAN_L
 Requires termination on the transceiver rather than on the cable
 The resistance of each resistor is calculated through several formulas
55
An example of LIN Implementation
56
Renesas Electronics America Inc.