30
INTERCONNCETION INTERCONNCETION PROTOCOLS PROTOCOLS TERM PROJECT TERM PROJECT CAN ANALYZER CAN ANALYZER H H üseyin Fatih Lokumcu üseyin Fatih Lokumcu

INTERCONNCETION PROTOCOLS TERM PROJECT

  • Upload
    axl

  • View
    36

  • Download
    4

Embed Size (px)

DESCRIPTION

INTERCONNCETION PROTOCOLS TERM PROJECT. CAN ANALYZER H üseyin Fatih Lokumcu. OUTLINE. Introduction to Controller Area Network CAN Analyzer Hardware Components Software Components Software and Hardware Components for the demonstration Future Improvements. INTRODUCTION to CAN. - PowerPoint PPT Presentation

Citation preview

Page 1: INTERCONNCETION PROTOCOLS TERM PROJECT

INTERCONNCETION INTERCONNCETION PROTOCOLSPROTOCOLS

TERM PROJECTTERM PROJECT

CAN ANALYZERCAN ANALYZERHHüseyin Fatih Lokumcuüseyin Fatih Lokumcu

Page 2: INTERCONNCETION PROTOCOLS TERM PROJECT

22

OUTLINEOUTLINE

Introduction to Controller Area NetworkIntroduction to Controller Area NetworkCAN AnalyzerCAN AnalyzerHardware ComponentsHardware ComponentsSoftware ComponentsSoftware ComponentsSoftware and Hardware Components for Software and Hardware Components for the demonstrationthe demonstrationFuture Future ImprovementsImprovements

Page 3: INTERCONNCETION PROTOCOLS TERM PROJECT

33

INTRODUCTION to CANINTRODUCTION to CAN

CAN (Controller Area Network) is a serial CAN (Controller Area Network) is a serial bus system, which was originally bus system, which was originally developed for automotive applications in developed for automotive applications in the early 1980's.the early 1980's.The CAN protocol was standardized in The CAN protocol was standardized in 1993 as ISO 11898-1 and comprises the 1993 as ISO 11898-1 and comprises the data link layer data link layer and the physical layer and the physical layer of the of the seven layer ISO/OSI referenceseven layer ISO/OSI reference..

Page 4: INTERCONNCETION PROTOCOLS TERM PROJECT

44

INTRODUCTION to CANINTRODUCTION to CANCAN providesCAN provides::

a multi-master hierarchy, which allows building intelligent a multi-master hierarchy, which allows building intelligent and redundant systems. If one network node is defect and redundant systems. If one network node is defect the network is still able to operate. the network is still able to operate. broadcast communication. A sender of information broadcast communication. A sender of information transmits to all devices on the bus. All receiving devices transmits to all devices on the bus. All receiving devices read the message and then decide if it is relevant to read the message and then decide if it is relevant to them. This guarantees data integrity as all devices in the them. This guarantees data integrity as all devices in the system use the same information. system use the same information. sophisticated error detecting mechanisms and re-sophisticated error detecting mechanisms and re-transmission of faulty messages. This also guarantees transmission of faulty messages. This also guarantees data integrity. data integrity.

Page 5: INTERCONNCETION PROTOCOLS TERM PROJECT

55

INTRODUCTION to CANINTRODUCTION to CAN

Use CAN if you want to:Use CAN if you want to:Avoid cable pollutionAvoid cable pollutionImmune your system to harsh Immune your system to harsh environmentsenvironmentsGather time critical data with minimum Gather time critical data with minimum latency (Real time requirements)latency (Real time requirements)

Page 6: INTERCONNCETION PROTOCOLS TERM PROJECT

66

INTRODUCTION to CANINTRODUCTION to CAN

CAN MessagesCAN Messages

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

Page 7: INTERCONNCETION PROTOCOLS TERM PROJECT

77

INTRODUCTION to CANINTRODUCTION to CAN

CAN Application FieldsCAN Application FieldsPassenger CarsPassenger CarsTrucks and busesTrucks and busesPassenger and cargo trainsPassenger and cargo trainsMaritime electronicsMaritime electronics Aircraft and aerospace electronicAircraft and aerospace electronicFactory automationFactory automation Building automationBuilding automationMedical equipment and devicesMedical equipment and devices

Page 8: INTERCONNCETION PROTOCOLS TERM PROJECT

88

CAN AnalyzerCAN Analyzer

CAN analyzers are tools for diagnosing CAN analyzers are tools for diagnosing CAN networks. CAN networks. Its job is listening reporting all the activity Its job is listening reporting all the activity in a CAN bus like message types, in a CAN bus like message types, frequencies, timestamps, etc.frequencies, timestamps, etc.

Page 9: INTERCONNCETION PROTOCOLS TERM PROJECT

99

CAN AnalyzerCAN Analyzer

Some CAN analyzers avaible on the Some CAN analyzers avaible on the market:market:

ADFWEB CAN analyzer tool:ADFWEB CAN analyzer tool:

Page 10: INTERCONNCETION PROTOCOLS TERM PROJECT

1010

Lipowsky Industrie-Elektronik CAN analyzer Lipowsky Industrie-Elektronik CAN analyzer tool (CAN Spy)tool (CAN Spy)

Page 11: INTERCONNCETION PROTOCOLS TERM PROJECT

1111

CAN ANALYZERCAN ANALYZER

CAN analyzer developed in this project:CAN analyzer developed in this project:

PCCAN

microcontroller board

to the busCANH

CANL

RS232

Page 12: INTERCONNCETION PROTOCOLS TERM PROJECT

1212

HARDWARE COMPONENTSHARDWARE COMPONENTS

Hardware of the developed CAN Analyzer Hardware of the developed CAN Analyzer consists of a single PCB with a CAN consists of a single PCB with a CAN specific microcontroller. (ATMEL specific microcontroller. (ATMEL T89C51CC02)T89C51CC02)T89C51CC02 is a 8051 based 8 bit T89C51CC02 is a 8051 based 8 bit microcontroller with 512 bytes of ram and microcontroller with 512 bytes of ram and 16K flash. It has a 10 bit adc and a CAN 16K flash. It has a 10 bit adc and a CAN controller with 4 independent message controller with 4 independent message objectsobjects

Page 13: INTERCONNCETION PROTOCOLS TERM PROJECT

1313

HARDWARE COMPONENTSHARDWARE COMPONENTS

The development board is supplied by The development board is supplied by ERA elektronik, which is a company ERA elektronik, which is a company specialized on vehicle electronics.specialized on vehicle electronics.It has the microcontroller, power regulator It has the microcontroller, power regulator and a max232 transreceiver to connect to and a max232 transreceiver to connect to a PC.a PC.

Page 14: INTERCONNCETION PROTOCOLS TERM PROJECT

1414

SOFTWARE COMPONENTSSOFTWARE COMPONENTS

Software consists of two parts: Software consists of two parts: Microcontroller and PC software.Microcontroller and PC software.Microcontroller software is the core part.It Microcontroller software is the core part.It connects to the bus, listens and reports connects to the bus, listens and reports the activity with its uart port.the activity with its uart port.Three interrupt driven receiver message Three interrupt driven receiver message objects have been implemented so three objects have been implemented so three consecutive can messages can be consecutive can messages can be analyzed. analyzed.

Page 15: INTERCONNCETION PROTOCOLS TERM PROJECT

1515

Activity Diagram of the Activity Diagram of the microcontroller softwaremicrocontroller software

Page 16: INTERCONNCETION PROTOCOLS TERM PROJECT

1616

SOFTWARE COMPONENTSSOFTWARE COMPONENTS

MICROCONTROLLER SOFTWAREMICROCONTROLLER SOFTWARE

Receiveobject1

Receiveobject2

Receiveobject3

buffer1

buffer2

buffer3

UART

Page 17: INTERCONNCETION PROTOCOLS TERM PROJECT

1717

SOFTWARE COMPONENTSSOFTWARE COMPONENTS

Interconnection protocol between the Interconnection protocol between the microcontroller and PC is a single 19 byte- microcontroller and PC is a single 19 byte- packet containing the data of the received packet containing the data of the received CAN messageCAN message

sync1 sync2 Data 1-7 CAN IDT 1-4 CANCONCH CANSTMPH CANSTMPL sync3 sync4

Page 18: INTERCONNCETION PROTOCOLS TERM PROJECT

1818

SOTFWARE COMPONENTSSOTFWARE COMPONENTS

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

Page 19: INTERCONNCETION PROTOCOLS TERM PROJECT

1919

SOFTWARE COMPONENTSSOFTWARE COMPONENTS

PC interface software is developed in PC interface software is developed in Microsoft Visual C++ .NET Microsoft Visual C++ .NET Interface software displays the packets Interface software displays the packets received from the COM port which are received from the COM port which are sent by the microcontroller. It also sent by the microcontroller. It also calculates the frequency of the messages calculates the frequency of the messages by using the time id of received can by using the time id of received can packets.packets.

Page 20: INTERCONNCETION PROTOCOLS TERM PROJECT

2020

Software and Hardware Software and Hardware Components for the DemonstrationComponents for the Demonstration

For demonstration, a system which For demonstration, a system which transmits three different CAN messages is transmits three different CAN messages is developed.developed.CAN2.0A or CAN2.0B messages can be CAN2.0A or CAN2.0B messages can be transmittedtransmittedThe user chooses frequency(1-100hz) and The user chooses frequency(1-100hz) and ID number of a messageID number of a message

Page 21: INTERCONNCETION PROTOCOLS TERM PROJECT

2121

Software and Hardware Software and Hardware Components for the DemonstrationComponents for the Demonstration

PC CAN Analyzer

Demo CAN Transmitter

RS232CAN lines

RS232

Page 22: INTERCONNCETION PROTOCOLS TERM PROJECT

2222

Connection ProtocolsConnection Protocols

The demonstation system consists of three The demonstation system consists of three devices.(Transmitter,Analyzer,PC)devices.(Transmitter,Analyzer,PC)All of these devices communicate with each All of these devices communicate with each other.other.Transmitter and Analyzer communicates via the Transmitter and Analyzer communicates via the CAN bus. CAN chips implement the CAN CAN bus. CAN chips implement the CAN protocol.protocol.RS232 connections between devices and the RS232 connections between devices and the PC is implemented using a simple protocolPC is implemented using a simple protocol

Page 23: INTERCONNCETION PROTOCOLS TERM PROJECT

2323

Connection ProtocolsConnection Protocols

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

sync1 sync2 DATA sync3 sync4

There are five kinds of messages.There are five kinds of messages.1. Transmitter Start: Parameters of the 1. Transmitter Start: Parameters of the transmiiter messages.transmiiter messages.

Page 24: INTERCONNCETION PROTOCOLS TERM PROJECT

2424

Connection ProtocolsConnection Protocols

2.Transmitter Acknowledge. (Indicating 2.Transmitter Acknowledge. (Indicating that the transmitter received the that the transmitter received the parameters)parameters)3. Analyzer Start.(Analyzer sends the 3. Analyzer Start.(Analyzer sends the baudrate and standard information of the baudrate and standard information of the network to the PC)network to the PC)4. PC Acknowledge (PC acknowledges 4. PC Acknowledge (PC acknowledges the analyzer.the analyzer.

Page 25: INTERCONNCETION PROTOCOLS TERM PROJECT

2525

Connection ProtocolsConnection Protocols

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

Page 26: INTERCONNCETION PROTOCOLS TERM PROJECT

2626

Connection ProtocolsConnection Protocols

PC CAN Analyzer

Demo CAN TransmitterTransmitter Start

Transmitter ACK

Analyzer Start

PC ACK

CAN Packets

CAN Packets

Page 27: INTERCONNCETION PROTOCOLS TERM PROJECT

2727

USAGEUSAGE

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

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

Page 28: INTERCONNCETION PROTOCOLS TERM PROJECT

2828

Software and Hardware Software and Hardware Components for the DemonstrationComponents for the Demonstration

The demo board is the same board as the The demo board is the same board as the analyzer board analyzer board Software of the demo board is developed Software of the demo board is developed in C language.in C language.After the user chooses the parameters via After the user chooses the parameters via the rs232 port, transmission begins and is the rs232 port, transmission begins and is ready to be analyzed.ready to be analyzed.

Page 29: INTERCONNCETION PROTOCOLS TERM PROJECT

2929

Future ImprovementsFuture Improvements

Since three interrupt driven receive objects are Since three interrupt driven receive objects are used, if four consecutive messages arrive the used, if four consecutive messages arrive the last one will be missed. Instead, four receive last one will be missed. Instead, four receive message objects can be used but it is the max message objects can be used but it is the max number avaible.number avaible.The analyze capability is limited by the The analyze capability is limited by the uart(57600 bps). If suitable system clock is used uart(57600 bps). If suitable system clock is used this could be improved to a 115200 for a this could be improved to a 115200 for a standard PC serial port. Using high baud rate standard PC serial port. Using high baud rate serial ports can be considered in order to fully serial ports can be considered in order to fully cover 1 mbit CAN’s. cover 1 mbit CAN’s.

Page 30: INTERCONNCETION PROTOCOLS TERM PROJECT

3030

Future ImprovementsFuture Improvements

Most of the CAN analyzers on the market use Most of the CAN analyzers on the market use RS232 ports to report the network. But it may be RS232 ports to report the network. But it may be desirable to gather all of the data of network and desirable to gather all of the data of network and if It is a 1Mbit network, rs232 capacity may be if It is a 1Mbit network, rs232 capacity may be not enough. USB or paralel port can be used.not enough. USB or paralel port can be used.Some of the devices work independent from the Some of the devices work independent from the PC by recording the data to the local flash. This PC by recording the data to the local flash. This is a very useful case espacially for industrial is a very useful case espacially for industrial infiltrating.infiltrating.