automotive bus technologies
TRANSCRIPT
Prepared by: Radwa Tarek.
Automotive Bus Technologies
Agenda:
Introduction to automotive embedded systems.
Automotive Network.
Network fundamentals.
Review for Serial communication.
Automotive bus protocols:
Local interconnect technology.
Controlled area network.
Introduction to automotive embedded systems.
• Automotive is embedding systems consist of separated ECUs and
each ECU has its own functionality.
What is an ECU?In the Automobile industry an electronic control unit (ECU) is an embeddedelectronic device, basically a digital computer, that reads signals comingfrom sensors placed at various parts and in different components ofthe car and depending on this information controls various important unitse.g. engine and other automated operations within the car among many.
Electronic Control Unit(ECU)consists of:
Microcontroller(s).
Sensors.
Power switches.
Drivers.
Voltage regulator(s).
Automotive ECUs:
Automotive ECUs:
Dynamic stability control
https://www.youtube.com/watch?v=VvNP2d6MDQM
Air Bags and Seat Belts
https://www.youtube.com/watch?v=R4ekbB5EzZM&spfreload=10
Roll Stability Control
https://www.youtube.com/watch?v=6WjfRxtIMzo
Automotive ECUs:The automotive ECU market can be segmented on the basis of as application
into safety and security systems, chassis electronics, powertrain
electronics, communication & navigation systems and entertainment
systems.
Automotive network
Whenever increase applications/technologies in cars will increase in
ECUs.
Each car now contains at least 30 computer system (ECU).
Each ECU in car need to interface with more than one ECU to perform its
own functionality.
Network Fundamentals
The main network properties are:
Transmission medium
Transmission speed
Network topology
Data packets
Network Fundamentals: Transmission medium
1. Twisted pair cables
2. Fiber optics cables
3. Wireless networks
Network Fundamentals: Transmission speed
Transmission speed can be measured by Bit rate
Bit rate is number of bit that can be transmit in a fixed amount of time usually
Kbit/sec
depend on time constrains and can be measured by bit rate.
Engine control tasks: Critical
Break system tasks: Critical
Dashboard tasks: High
Doors control tasks: Normal
Air condition tasks: Low
Network Fundamentals: Network topology
A network topology is the arrangement of a network, including its nodes and
connecting lines.
there are several common physical topologies:
1. bus network topology
2. Star network topology
3. Ring network topology
Network Fundamentals: Data packets
packet is a unit of data is called a segment or a block or a cell or a frame
depending on the type of network.
Network protocol
Network Protocol
Network protocol determine network fundamentals.
In network protocol define:
topology, Speed, transmission medium and data packet/frame.
In embedded Systems there are three basics serial communications
protocols:
UART, SPI and I2C.
Network Protocol
Topology in serial communication protocols define Terminologies
Simplex Communication
Half Duplex Communication
Full Duplex Communication
Network Protocol
Speed in serial communication protocols define Modes
data can be transferred in two modes:
Synchronous mode: data sampling with clock pulses.
Asynchronous mode: transmitter and receiver used the same data
rate.
Network Protocol
Data packet format depend on network protocol for example :
Data size
Address
Start and End communication methods
Error detection method
Automotive bus protocols
• Network protocol classification:
Depend on message ID.
Depend on distention ID.
• Network protocols depend on message ID:
Controlled area network “CAN”.
Local interconnect network “LIN”.
• Network protocols depend on distention ID: I2C.
Local interconnect network
Local interconnect network
LIN protocol is single master multi slaves.
LIN bus single wire connection->> half duplex> terminology.
LIN bus speed 20 kbps and max length 40m>>speed.
LIN is serial communication protocol used in low speed
applications.
in automotive applications, LIN bus is connected
between(smart sensors, actuators and ECUs such as door
control ECU and air condition ECU).
Local interconnect network
LIN protocol depend on message ID:
from message ID each slave connected to lin bus
determine whether it needs to publish or subscribe.
publish-subscribe: in a publish-subscribe system, senders
label each message with the name of a topic ("publish"), rather
than addressing it to specific recipients. The messaging system
then sends the message to all eligible systems that have asked
to receive messages on that topic ("subscribe").
Local interconnect network
Concept of operation:
LIN is single master –multi slaves:
master node consists of slave task and master task.
slave node consists of slave task.
Local interconnect network
Master task:
Control over the whole Bus.
Controls which message at what time is to be transferred over the bus.
Error handling.
monitors Data Bytes and Check Byte, and evaluates them on consistence.
Receives Wakeup Break from slave nodes when the bus is inactive.
Defines the transmission speed.
Switching slave nodes to sleep/wake up mode.
Local interconnect network
Slave task:
One of 2-16 Members on the Bus.
Receives or transmits Data when appropriate ID is sent .
According to ID, slave determines:
receive data (subscribe), transmit data ( publish) ,do nothing.
When transmitting : sends 1, 2, 4, or 8 Data Bytes + Check-Byte
LIN message frame
The LIN is a SCI/UART-based serial, the LIN protocol is byte
oriented.
data is sent one byte at a time.
One byte field contains a start bit (dominant), 8 data bits and a
stop bit (recessive).
The data bits are sent LSB first.
LIN message frame
LIN frame consist of:
Header which is provided by the master task
Response which is provided by the slave task
LIN message frame
Header consists of: break field, synch field and identifier field.
Response consists of: from 0 to 8 data fields and checksum.
LIN frame structure:
Break field:
The break symbol is used to signal the beginning of a new frame.
A break is always generated by the master task and it shall be at
least 13 bits of dominant value, including the start bit, followed by
a break delimiter
Synch break ends with a “break delimiter” which should be at least
one recessive bit.
LIN frame structure:
Synch field: is the second field transmitted by the master task in
the header.
LIN is self synchronization; has the synchronization mechanism
that allows the clock recovery by slave nodes.
Sync is defined as the character x55.
The sync field allows slave devices that perform automatic baud
rate detection to measure the period of the baud rate and adjust
their internal baud rates to synchronize with the bus.
LIN frame structure:
Protected Identifier
The ID field is the final field transmitted by the master task in the
header.
This field provides identification for each message on the
network and ultimately determines which nodes in the network
receive or respond to each transmission.
All slave tasks continually listen for ID fields, verify their parities,
and determine if they are publishers or subscribers for this
particular identifier.
LIN frame structure:
Protected Identifier
1.Identifier:
Six bits are reserved for the identifier (ID).
Values in the range 0 to 63 can be used.
The identifiers are split in four categories:
Values 0 to 59 (0x3b) are used for signal• carrying frames.
60 (0x3c) and 61 (0x3d) are used to carry diagnostic data.
62 (0x3e) is reserved for user• defined extensions.
63 (0x3f) is reserved for future protocol enhancements.
LIN frame structure:
• Protected Identifier: the Identifier Field does not indicate
the destination of the message but describes the contents of the message
frame.
LIN frame structure:
Protected Identifier:
ID5:4
used to determine data length in bytes which transfer in response.
LIN frame structure:
Protected Identifier
2. Parity:
The parity is calculated on the identifier bits.
LIN frame structure:
Data:
A frame carries between one and eight bytes of data
A data byte is transmitted in a byte field
The data bytes field is transmitted by the slave task in the
response.
LIN frame structure:
Check sum:
The checksum field is transmitted by the slave task in the
response.
The LIN bus defines the use of one of two checksum algorithms to
calculate the value in the eight-bit checksum field:
Classic checksum is calculated by summing the data bytes alone (V 1.3)
enhanced checksum is calculated by summing the data bytes and the
protected ID. (V2.0)
LIN Error Handling:
Each LIN Slave monitors its operating state and creates a status
report.
The status report is sent periodically to the LIN Master (LIN 2.0).
Monitoring by error detection mechanisms
Parity check
Checksum
LIN messages detected as corrupt are rejected
Error handling is not part of the LIN specification and must be
defined separately
LIN Frame types:
There are three different ways of transmitting frames on the bus:
unconditional, event triggered, and sporadic frames.
Unconditional Frame:
This is the “normal” type of LIN communication.
The master sends a frame header in a scheduled frame slot and
the designated slave node fills the frame with data.
LIN Frame types:
Event-triggered frame: collect statues of slaves
The purpose of this method is to receive as much information from
slave nodes without overloading the bus with frames.
An event triggered frame can be filled with data from more
than one slave node.
A slave only updates the data in an event triggered frame when
the value has changed.
If more than one slave wants to update data in the frame a
collision occurs. The master should then send unconditional
frames to each of the slaves starting with the one with the highest
priority.
LIN Frame types:
Sporadic Frame:
This method provides some dynamic behavior to the otherwise
static LIN protocol.
The header of a sporadic frame is only sent from the master when
it knows that a signal has been updated in a slave node.
Usually the master fills the data bytes of the frame itself and the
slave nodes will be the receivers of the information.
LIN Frame types:
User-defined frames:
have an ID of 62.
carry any type of information.
Diagnostic frame:
Eight data bytes in length
Carry diagnostic or configuration data.
Their IDs are : 60 for a master request frame.
61 for a slave response frame.
LIN Bus Timing
Theader = (NSync_Field + NSync_Byte + NPID_Byte) • TBit = 34 • Tbit
Tresponse = 10 • (NData + 1) • Tbit
Tframe = Theader + Tresponse
LIN Bus Timing
A time reserve of up to 40% is given for transmission of a LIN
message TFrame_Max = THeader_Max + TResponse_Max = 1.4 • TFrame
Controlled Area Network
Controlled Area Network: Features
CAN protocol is Multi-Master Multi-Slave communication.
CAN bus is two wires connections but still half
duplex>>terminology.
CAN bus speed 1 Mbps and 40m max length>>speed.
The Controller Area Network (CAN) is a serial communications
protocol widely used in automotive electronics for critical tasks
such as engine control tasks and break systems tasks.
Controlled Area Network: CAN bus Connection
Controlled area network: CAN properties
Prioritization of message:
No node addressing, Message identifier specifies contents & priority.
Depending on the importance of messages the priorities will be given to the different messages.
the highest priority message with the lowest ID in your network
Controlled area network: CAN properties
Multicast reception with time synchronization:
CAN is based on the “broadcast communication mechanism”
,simultaneously multiple nodes can receive the frame.
Controlled area network: CAN properties
Multi master: When the bus is free any unit may start to transmit
a message.
If two nodes need to transmit in the same time, the unit with the
message of higher priority to be transmitted gains bus access.
Message Routing: An identifier names the content of a message.
The identifier does not indicate the destination of the message,
but describes the meaning of the data, so that all nodes in the
network are able to decide by message filtering whether the data
is to be acted upon by them or not [publish /subscribe].
Controlled Area Network: CAN properties
Bus values: The bus can have one of two complementary logical
values: ‘dominant’ (‘0’) or ‘recessive’ (‘1’). During simultaneous
transmission of ’dominant’ and ’recessive’ bits, the resulting bus
value will be ’dominant’.
Automatic retransmission of corrupted messages as soon as
the bus is idle again.
Controlled area network: CAN properties
Synchronization:
Hard Synchronization:
CAN synchronize the message transfer for each node with the
leading edge of SOF bit.
Re-synchronize
With each recessive to dominant edge.
Controlled area network: Different Types of CAN
There are two types of CAN implementations depending in the
size of the identifier field.
1) STANDARD: 11-bit wide identifier field.
2) EXTENDED: 29-bit wide identifier field.
Controlled area network: CAN message
1. Data frame:
Description: - Carries data from a transmitter to the receivers.
Fields: - Start of Frame, Arbitration Field, Control Field, Data
Field, CRC Field, ACK Field, End of Frame.
Controlled area network: CAN message
1. Data frame:
SOF: Start of frame bit. It is the indication of start of frame
when a dominant bit is detected after the bus idle condition.
Controlled area network: CAN message
1. Data frame:
The arbitration field is depending on the type of frame
Controlled area network: CAN message
The arbitration field contains:
Identifier field: contains information’s about message.
In case of standard frame the length of this field is 11 bits.
In case of extended 18 more bits are added to it. So in case of
extended frame total size of identifier field it is 29 bits.
RTR: It is the remote transmission request BIT
RTR = Dominant in the data frames
RTR = Recessive in the remote frames
Controlled area network: CAN message
The arbitration field contains:
SRR: Substitute remote request (SRR)
one bit wide. Used in case of extended frame. SRR bit will be
recessive and in case standard frame this bit replaces the RTR bit. .
IDE: Identifier extension bit (IDE)
IDE = Dominant in the standard frame
IDE = Recessive in the extended frame
Controlled area network: CAN message
The control field:
six bit wide. Two bits r0 and r1 are reserved. In standard frame r1 is
replaced by IDE bit. And remaining 4 bits called as data length
control (DLC) describes total length of data field.
Controlled area network: CAN message
Data field: contains the actual information within the limit of
{0…8} bytes.
CRC field: (cyclic redundancy code )
16 bit wide. Divided into two parts:
CRC sequence: 15 bit length. Calculated over SOF to data field.
CRC delimiter: 1 bit recessive bit.
Controlled area network: CAN message
ACK field: 2 bit wide and contain two fields ACK flag and
ACK delimiter.
ACK flag: being successful reception of frame the receiver
will indicate the transmitter by putting a dominant bit in this place,
otherwise recessive.
ACK delimiter: A recessive bit.
END OF FRAME: 7 bit wide. Consists of 7 recessive bits.
Controlled area network: CAN message
2- Remote Frame
Description: -
Transmitted by a bus unit to request the transmission of the data
frame with the same identifier.
Fields: - Start of Frame, Arbitration Field, Control Field,
CRC Field, ACK Field, End of Frame
Controlled area network: CAN message
3- Error Frame:
Description: - Any unit on detecting a error transmits an
error frame.
Fields: - Error flag and Error delimiter.
Controlled area network: CAN message
3- Error Frame:
There are two types of error frames are there in CAN:
Active Error Flag: six dominant bits, Transmitted by a node detecting an error on the network that is in error state "error active“.
Passive Error Flag: six recessive bits, Transmitted by a node detecting an active error frame on the network that is in error state "error passive".
And in both the cases all the bits of error delimiter will be all recessive. Depending on the node internal error count register condition the respective type of error frame will be transmitted.
Controlled area network: CAN message
4- Overload Frame:
Description: Generated due to internal conditions of a receiver,
which requires a delay of the next DATA or REMOTE frame.
Fields: - Overload flag and Overload delimiter.
Controlled area network: CAN Error Detection:
There are 5 error detection mechanisms:
Bit error: During transmission the node transmits the bit at
transmit time region and receives the bit at receive time and
two bits are compared if they are not equal then that is
considered as bit error.
Controlled area network: CAN Error Detection
CRC error:
While receiving data or remote frame the CRC value will be
calculated and is compared with the received CRC values.
In case of proper frame transmission both will be equal. Else
that will be considered as CRC error and error frame will be
transmitted.
Controlled area network: CAN Error Detection
Acknowledgement error:
During the transmission of data or remote frame, in the ACK flag
field the transmitter will put recessive bit and expect dominant bit
from receive pin.
If dominant bit is observed then that is considered as proper
transmission. In other case it is acknowledgement error. The error
frame is transmitted if acknowledgment error is observed.
Controlled area network: CAN Error Detection
Form error: Form error will be related to the error in forming the
frame. For e.g. delimiter (CRC, ACK) missing or improper end of
frame, these conditions are taken as form error and immediately
error frame is transmitted.
Controlled area network: CAN Error Detection
Stuff error:
In a frame if continuous 5 recessive or dominant bits are
transmitted, the sixth bit should be of opposite to that.
While receiving if continuous 5 recessive or dominant bits are
received then the next incoming bit is of same value that of
previous then it will be considered as stuff error.
Controlled area network: Bus Arbitration
Controlled area network
CAN Application:
Motor vehicles
Utility vehicles
Industrial automation.
Other applications for CAN are: trains, medical equipment,
building automation, household appliances, and office
automation.
CAN and LIN in AUTOSAR
• References:
http://www.ni.com/white-paper/9733/en/
https://www.kvaser.com/about-can/can-
standards/linbus/
http://electrosofts.com/can/