PROTOCOLS TERM PROJECT

canolaokahumpkaΗλεκτρονική - Συσκευές

2 Νοε 2013 (πριν από 4 χρόνια και 10 μέρες)

113 εμφανίσεις

INTERCONNCETION
PROTOCOLS

TERM PROJECT

CAN ANALYZER

H
üseyin Fatih Lokumcu


2

OUTLINE

Introduction to Controller Area Network

CAN Analyzer

Hardware Components

Software Components

Software and Hardware Components for
the demonstration

Future
Improvements



3

INTRODUCTION to CAN

CAN (Controller Area Network) is a serial
bus system, which was originally
developed for automotive applications in
the early 1980's.

The CAN protocol was standardized in
1993 as ISO 11898
-
1 and comprises the
data link layer
and the physical layer
of the
seven layer ISO/OSI reference
.

4

INTRODUCTION to CAN

CAN provides
:

a multi
-
master hierarchy, which allows building intelligent
and redundant systems. If one network node is defect
the network is still able to operate.

broadcast communication. A sender of information
transmits to all devices on the bus. All receiving devices
read the message and then decide if it is relevant to
them. This guarantees data integrity as all devices in the
system use the same information.

sophisticated error detecting mechanisms and re
-
transmission of faulty messages. This also guarantees
data integrity.


5

INTRODUCTION to CAN

Use CAN if you want to:

Avoid cable pollution

Immune your system to harsh
environments

Gather time critical data with minimum
latency (Real time requirements)



6

INTRODUCTION to CAN

CAN Messages




CAN 2.0A and 2.0B
standarts differ only in
ID size.


7

INTRODUCTION to CAN

CAN Application Fields

Passenger Cars

Trucks and buses

Passenger and cargo trains

Maritime electronics


Aircraft and aerospace electronic

Factory automation


Building automation

Medical equipment and devices

8

CAN Analyzer

CAN analyzers are tools for diagnosing
CAN networks.

Its job is listening reporting all the activity
in a CAN bus like message types,
frequencies, timestamps, etc.


9

CAN Analyzer

Some CAN analyzers avaible on the
market:

ADFWEB CAN analyzer tool:


10

Lipowsky Industrie
-
Elektronik CAN analyzer
tool (CAN Spy)


11

CAN ANALYZER

CAN analyzer developed in this project:


PC

CAN

microcontroller


board

to the bus

CANH

CANL

RS232

12

HARDWARE COMPONENTS

Hardware of the developed CAN Analyzer
consists of a single PCB with a CAN
specific microcontroller. (ATMEL
T89C51CC02)

T89C51CC02 is a 8051 based 8 bit
microcontroller with 512 bytes of ram and
16K flash. It has a 10 bit adc and a CAN
controller with 4 independent message
objects

13

HARDWARE COMPONENTS

The development board is supplied by
ERA elektronik, which is a company
specialized on vehicle electronics.

It has the microcontroller, power regulator
and a max232 transreceiver to connect to
a PC.

14

SOFTWARE COMPONENTS

Software consists of two parts:
Microcontroller and PC software.

Microcontroller software is the core part.It
connects to the bus, listens and reports
the activity with its uart port.

Three interrupt driven receiver message
objects have been implemented so three
consecutive can messages can be
analyzed.


15

Activity Diagram of the
microcontroller software



16

SOFTWARE COMPONENTS

MICROCONTROLLER SOFTWARE

Receive

object1

Receive

object2

Receive

object3

buffer1

buffer2

buffer3

UART

17

SOFTWARE COMPONENTS

Interconnection protocol between the
microcontroller and PC is a single 19 byte
-

packet containing the data of the received
CAN message


sync1

sync2

Data 1
-
7

CAN IDT 1
-
4

CANCONCH

CANSTMPH

CANSTMPL

sync3

sync4

18

SOTFWARE COMPONENTS

Microcontroller software is implemented in
C language using keil compiler for atmel
products. Keil C compiler lets to operate
on microcontroller register like C variables.
Microcontroller software is doxygen
documentable.

19

SOFTWARE COMPONENTS

PC interface software is developed in
Microsoft Visual C++ .NET

Interface software displays the packets
received from the COM port which are
sent by the microcontroller. It also
calculates the frequency of the messages
by using the time id of received can
packets.

20

Software and Hardware
Components for the Demonstration

For demonstration, a system which
transmits three different CAN messages is
developed.

CAN2.0A or CAN2.0B messages can be
transmitted

The user chooses frequency(1
-
100hz) and
ID number of a message



21

Software and Hardware
Components for the Demonstration

PC

CAN Analyzer

Demo CAN

Transmitter

RS232

CAN lines

RS232

22

Connection Protocols

The demonstation system consists of three
devices.(Transmitter,Analyzer,PC)

All of these devices communicate with each
other.

Transmitter and Analyzer communicates via the
CAN bus. CAN chips implement the CAN
protocol.

RS232 connections between devices and the
PC is implemented using a simple protocol

23

Connection Protocols

All of the messages between the PC and
devices are of this common standard:

sync1

sync2

DATA

sync3

sync4

There are five kinds of messages.

1. Transmitter Start: Parameters of the
transmiiter messages.

24

Connection Protocols

2.Transmitter Acknowledge. (Indicating
that the transmitter received the
parameters)

3. Analyzer Start.(Analyzer sends the
baudrate and standard information of the
network to the PC)

4. PC Acknowledge (PC acknowledges
the analyzer.


25

Connection Protocols

5.Analyzer Received CAN packet: (Data and
timing information of the received CAN packet.

As you can see,Transmitter and Analyzer
devices receive only one type of packet from the
PC. PC receives three different kinds of
messages and all of these messages have
different lengths. That’s how, PC differs
message kinds and there is no length field in the
packet format.

26

Connection Protocols

PC

CAN Analyzer

Demo CAN

Transmitter

Transmitter Start

Transmitter ACK

Analyzer Start

PC ACK

CAN Packets

CAN Packets

27

USAGE

Transmitter is connected to PC. ID’s, CAN
standart(2.0A or 2.0B) and frequencies (1
-
100hz) of the messages are sent to the
transmitter. Transmittet begins sending
messages.


Then the analyzer is connected to PC. It first
sends the baudrate and standard of the system
to the PC and then begins sending received
messages.



28

Software and Hardware
Components for the Demonstration

The demo board is the same board as the
analyzer board

Software of the demo board is developed
in C language.

After the user chooses the parameters via
the rs232 port, transmission begins and is
ready to be analyzed.

29

Future Improvements

Since three interrupt driven receive objects are
used, if four consecutive messages arrive the
last one will be missed. Instead, four receive
message objects can be used but it is the max
number avaible.

The analyze capability is limited by the
uart(57600 bps). If suitable system clock is used
this could be improved to a 115200 for a
standard PC serial port. Using high baud rate
serial ports can be considered in order to fully
cover 1 mbit CAN’s.

30

Future Improvements

Most of the CAN analyzers on the market use
RS232 ports to report the network. But it may be
desirable to gather all of the data of network and
if It is a 1Mbit network, rs232 capacity may be
not enough. USB or paralel port can be used.

Some of the devices work independent from the
PC by recording the data to the local flash. This
is a very useful case espacially for industrial
infiltrating.