SlideShare a Scribd company logo
CAN Network Development
Program @IoTShow.in
by
Prof. Nalini C. Iyer
Prof. Venkatesh Mane.
Prof. Vishal Pattenshetty
 Introduction to CAN.
 What is CAN and Why CAN ?
 CAN protocol overview
 CAN physical layer
 CAN data link layer
 Cortex-M3 programming
 Project on CAN communication
 Hands-on Exercises on Real World System
 Analysis of CAN data using BUSMASTER and CAN data
base creation
What is communication ?
Communication is nothing but exchange of
information or data.
Why there is need for communication in a
vehicle?
To reduce the cost.
To reduce size.
To reduce the complexity.
To improve the performance.
What are the different types of communications?
Serial Communication
Parallel Communication
Advantages and Disadvantages of Both
Comparison of different protocols
• In "multi-drop" communication, one device
communicates with multiple receivers.
Example: RS-422.
• Where in "multi-point" communication,
multiple devices communicates with
multiple receivers. Example: RS-485
What is CAN ?
Controller Area Network
It is a serial bus system used to communicate between several embedded 8-bit and
16-bit
It was originally designed for use in the automotive industry but is used today in
many other systems (e.g. home appliances and industrial machines).
It is asynchronous serial transmission protocol.
 Highest Baud Rate is 1Mbit.
 CAN uses a message oriented transmission protocol.
 There are no defined addresses, just defined messages.
 Non-destructive arbitration system by CSMA with collision detection.
 Multi-master / Broadcasting concept
 Sophisticated error detection & handling system
 Wired And logic
 CSMA/CD
 Non destructive
 NRZ format
 Bit stuffing
 Fault confinement
 2 wire
 Prioritization of messages
 Differential voltage
 Transceivers
 Recessive and dominant bits
 Event triggered protocols
 CAN version 2.0A and 2.0B
 ISO-OSI compliant
 Plug in-Plug out protocol
 Serial asynchronous
 Maximum of 8 bytes in a frame
 automatic retransmission
Why CAN ?
 Mature Standard
 CAN protocol more than 16 years
 Numerous CAN products and tools on the market
 Simple Transmission Medium
 Twisted pair of wires is the standard, but also just one
wire will work
 Other links works, too: Opto - or radio links
 Excellent Error Handling
 CRC error detection mechanism
 Fault Confinement
 Built-in feature to prevent faulty node to block system
 Most used protocol in industrial and automotive world
CAN Controller
CAN Transceiver
CAN Protocol
There 4 types of frames
Data Frame
Remote frame
Overload frame
Error Frame
CAN Protocol
DATA Frame
• SOF – Start of Frame
• Identifier – Tells the content of message and priority
• RTR – Remote Transmission Request
• IDE – Identifier extension (distinguishes between CAN standard,11 bit
identifier, and CAN extended, 29 bit identifier.)
• DLC – Data Length Code
• Data – holds up to 8 bytes of data
• CRC – “Cyclic Redundant Check” sum
• ACK – Acknowledge
• EOF – End of Frame
• IFS – Intermission Frame Space. Minimum number of bits separating
consecutive messages.
Standard frame and extended frame
• Messages are
distinguished by message
identifiers.
• The identifier is unique to
the network and defines
the content & priority of
the message.
CAN Protocol
CAN Protocol
• When several messages access
the bus at the same time, the
one with the higher priority
“wins”.
• The identifier with the lowest
binary number has the highest
priority.
• The priority are specified
during system design and
cannot be changed
dynamically.
CAN Protocol
• Access conflicts on the bus
are resolved by a “wired
and” mechanism, where the
dominate state overwrites
the recessive state.
• All “losers” automatically
become receivers and they
won’t try to send another
message until the bus
becomes available again.
CAN Protocol
• If one or more errors are detected, the transmission is
aborted. This prevents all other stations or nodes from
accepting the message.
• Re-transmission is automatic. If errors continue, then the
station or node may switch itself off to prevent the bus
from being tied up.
• Error detection is done on two levels:
– Message level
– Bit level
CAN Protocol
• Message Level
– CRC = Cyclic Redundant Check sum
– Frame Check = compares message to fixed format and frame
size
– ACK errors = if transmitter does not receive an ACK signal
from the receivers
• Bit level
– Monitoring = The transmitter monitors the bus signal as it
sends the message and compares the bit sent to the bit
received.
– Bit Stuffing = After five consecutive equal bits, the
transmitter inserts a stuff bit with a compliment value into
the bit stream. The receivers remove this stuff bit.
CAN Protocol
 Error Frame: sent after a violation frame format
 Overload Frame: prevents data overflow from a slower CAN
Overload Frames are not really used
TEC and REC counters allows to prevent from faulty nodes
 CAN Node Error States:
 Error Active: Normal state, node can send all frames (error frames
included)
 Error passive: Node can send all frames excluding error frames
 Bus off: Node is isolated from bus
 Internal Counters: TEC & REC
 TEC: Transmit Error Counter
 REC: Receive Error Counter
CAN Protocol
Node 1 Node 2 Node 3 Bus
D D D D
D D r D
D r D D
D r r D
r D D D
r D r D
r r D D
r r r r
‘1’ Recessive (r)
‘0’ Dominant (D)
Two logic states on the CAN bus
Bus in dominant state
Wired-AND Function
Bus in recessive state
or idle
µController CAN
Controller
CAN
Transceiver
CANBus
CAN_H
CAN_LRXD
TXD
CAN_L
CAN_H
CAN Physical Layers
CAN - High - Speed ( ISO 11898 ) :
node 1 node 30
120
Ohm
120
Ohm
CAN_H
CAN_L
V o lta g e
tim e
2 ,5 V
3 ,5 V
1 ,5 V
C A N _ H
C A N _ L
re c e s s iv e d o m in a n t re c e s s ic v e
C A N h ig h -s p e e d , n o m in a l b u s le v e ls
Controller for CAN
Features of Cortex-M3 board
It is based on the NXP LPC1768, with a 32-bit ARM Cortex-M3 core running at 96MHz. It includes
512KB FLASH, 32KB RAM
Cortex-M3 exercises
• Blink LED
• Build two bit counter
• Control LED based on switch
• Control the speed of the Motor based on
speed.
CAN transceivers
CAN project
• Build CAN networks to transmit counter
from one node to other.
• Interior lighting control over CAN bus
• Sending multiple bytes over CAN network
What is Ticker?
• Use the Ticker interface to set up a
recurring interrupt; it calls a function
repeatedly and at a specified rate.
CANMessage structure
CAN Signal Analysis
CANalyzer and BUSMASTER
CANalyzer/CANoe
• CAN BUS analysis at signal
• CAN bus analysis at message level
• Send/Receive CAN data
• Simulate CAN node
• Simulate CAN network
• Test Automation using CAPL scripting
Can network development using arm cortex m3
Setting the baud-rate
• Can1.freequency(250000);
Sending multiple bytes

More Related Content

PPT
CAN- controlled area network
PPTX
Can bus
PPTX
Controller Area Network(CAN)
PPTX
CAN Bus
PPTX
Controller area network (can bus)
CAN- controlled area network
Can bus
Controller Area Network(CAN)
CAN Bus
Controller area network (can bus)

What's hot (20)

PDF
Can overview
PDF
A SEMINAR REPORT ON CAN BUS PROTOCOL
PPTX
Can bus m.n.r
PDF
Automotive bus technologies
PPT
Controller area network (CAN bus) ppt
ODP
Control Area Network
PPTX
PPT
MCP2515: Stand-Alone CAN Controller
PDF
Can Bus communication Protocol
PPT
Halderman ch049 lecture
PPTX
Can protocol implementation for data communication (2)
PDF
PPT
Overview Study on LIN System: MC33911
PPT
LIN protocol description
PPT
J1939 presentation by Simma Software
PPT
Interior Routing Protocols Chapter 15
PPT
Exterior Routing Protocols And Multi casting Chapter 16
PPT
Rip protocol
PPT
Isa Dma & Bus Masters
Can overview
A SEMINAR REPORT ON CAN BUS PROTOCOL
Can bus m.n.r
Automotive bus technologies
Controller area network (CAN bus) ppt
Control Area Network
MCP2515: Stand-Alone CAN Controller
Can Bus communication Protocol
Halderman ch049 lecture
Can protocol implementation for data communication (2)
Overview Study on LIN System: MC33911
LIN protocol description
J1939 presentation by Simma Software
Interior Routing Protocols Chapter 15
Exterior Routing Protocols And Multi casting Chapter 16
Rip protocol
Isa Dma & Bus Masters
Ad

Similar to Can network development using arm cortex m3 (20)

PDF
Automotive Networks : A Review
PDF
Vehicle Automation Using Controller Area Network
PPTX
CAN BUS.pptx
PPT
DOCX
11.chapters
PPT
Role of CAN BUS in automotives
PPT
What is Can bus in automotive Ecu car.ppt
PDF
Can Protocol For Automobiles
PPTX
Controller Area Network (Basic Level Presentation)
PPTX
Controller area network
PDF
can bus theory solution
PPTX
Controller Area Network (CAN) Different Types
PDF
Epma 013
PPT
Understanding+CAN.ppt,....................
PPTX
Introduction_to_CAN_Protocol: Basics.pptx
PPTX
UNIT 2b.pptx
PDF
Controller Area Network (CAN Bus)I need to know why this network i.pdf
PDF
IJSTEV2I12120
PPTX
PDF
Can basics
Automotive Networks : A Review
Vehicle Automation Using Controller Area Network
CAN BUS.pptx
11.chapters
Role of CAN BUS in automotives
What is Can bus in automotive Ecu car.ppt
Can Protocol For Automobiles
Controller Area Network (Basic Level Presentation)
Controller area network
can bus theory solution
Controller Area Network (CAN) Different Types
Epma 013
Understanding+CAN.ppt,....................
Introduction_to_CAN_Protocol: Basics.pptx
UNIT 2b.pptx
Controller Area Network (CAN Bus)I need to know why this network i.pdf
IJSTEV2I12120
Can basics
Ad

Recently uploaded (20)

DOCX
A PROPOSAL ON IoT climate sensor 2.docx
PDF
Smarter Security: How Door Access Control Works with Alarms & CCTV
PPTX
Lecture-3-Computer-programming for BS InfoTech
PDF
-DIGITAL-INDIA.pdf one of the most prominent
PDF
Cableado de Controladores Logicos Programables
PPTX
"Fundamentals of Digital Image Processing: A Visual Approach"
PPT
Hypersensitivity Namisha1111111111-WPS.ppt
PPTX
Embeded System for Artificial intelligence 2.pptx
PPTX
Fundamentals of Computer.pptx Computer BSC
PPTX
Wireless and Mobile Backhaul Market.pptx
PDF
How NGOs Save Costs with Affordable IT Rentals
PPT
chapter_1_a.ppthduushshwhwbshshshsbbsbsbsbsh
PPTX
quadraticequations-111211090004-phpapp02.pptx
PPTX
5. MEASURE OF INTERIOR AND EXTERIOR- MATATAG CURRICULUM.pptx
PPTX
了解新西兰毕业证(Wintec毕业证书)怀卡托理工学院毕业证存档可查的
PPTX
Prograce_Present.....ggation_Simple.pptx
PPTX
Operating System Processes_Scheduler OSS
PPTX
PROGRAMMING-QUARTER-2-PYTHON.pptxnsnsndn
PPT
FABRICATION OF MOS FET BJT DEVICES IN NANOMETER
PPTX
INFERTILITY (FEMALE FACTORS).pptxgvcghhfcg
A PROPOSAL ON IoT climate sensor 2.docx
Smarter Security: How Door Access Control Works with Alarms & CCTV
Lecture-3-Computer-programming for BS InfoTech
-DIGITAL-INDIA.pdf one of the most prominent
Cableado de Controladores Logicos Programables
"Fundamentals of Digital Image Processing: A Visual Approach"
Hypersensitivity Namisha1111111111-WPS.ppt
Embeded System for Artificial intelligence 2.pptx
Fundamentals of Computer.pptx Computer BSC
Wireless and Mobile Backhaul Market.pptx
How NGOs Save Costs with Affordable IT Rentals
chapter_1_a.ppthduushshwhwbshshshsbbsbsbsbsh
quadraticequations-111211090004-phpapp02.pptx
5. MEASURE OF INTERIOR AND EXTERIOR- MATATAG CURRICULUM.pptx
了解新西兰毕业证(Wintec毕业证书)怀卡托理工学院毕业证存档可查的
Prograce_Present.....ggation_Simple.pptx
Operating System Processes_Scheduler OSS
PROGRAMMING-QUARTER-2-PYTHON.pptxnsnsndn
FABRICATION OF MOS FET BJT DEVICES IN NANOMETER
INFERTILITY (FEMALE FACTORS).pptxgvcghhfcg

Can network development using arm cortex m3

  • 1. CAN Network Development Program @IoTShow.in by Prof. Nalini C. Iyer Prof. Venkatesh Mane. Prof. Vishal Pattenshetty
  • 2.  Introduction to CAN.  What is CAN and Why CAN ?  CAN protocol overview  CAN physical layer  CAN data link layer  Cortex-M3 programming  Project on CAN communication  Hands-on Exercises on Real World System  Analysis of CAN data using BUSMASTER and CAN data base creation
  • 3. What is communication ? Communication is nothing but exchange of information or data. Why there is need for communication in a vehicle? To reduce the cost. To reduce size. To reduce the complexity. To improve the performance.
  • 4. What are the different types of communications? Serial Communication Parallel Communication Advantages and Disadvantages of Both
  • 6. • In "multi-drop" communication, one device communicates with multiple receivers. Example: RS-422. • Where in "multi-point" communication, multiple devices communicates with multiple receivers. Example: RS-485
  • 7. What is CAN ? Controller Area Network It is a serial bus system used to communicate between several embedded 8-bit and 16-bit It was originally designed for use in the automotive industry but is used today in many other systems (e.g. home appliances and industrial machines). It is asynchronous serial transmission protocol.  Highest Baud Rate is 1Mbit.  CAN uses a message oriented transmission protocol.  There are no defined addresses, just defined messages.  Non-destructive arbitration system by CSMA with collision detection.  Multi-master / Broadcasting concept  Sophisticated error detection & handling system
  • 8.  Wired And logic  CSMA/CD  Non destructive  NRZ format  Bit stuffing  Fault confinement  2 wire  Prioritization of messages
  • 9.  Differential voltage  Transceivers  Recessive and dominant bits  Event triggered protocols  CAN version 2.0A and 2.0B  ISO-OSI compliant  Plug in-Plug out protocol  Serial asynchronous  Maximum of 8 bytes in a frame  automatic retransmission
  • 10. Why CAN ?  Mature Standard  CAN protocol more than 16 years  Numerous CAN products and tools on the market  Simple Transmission Medium  Twisted pair of wires is the standard, but also just one wire will work  Other links works, too: Opto - or radio links  Excellent Error Handling  CRC error detection mechanism  Fault Confinement  Built-in feature to prevent faulty node to block system  Most used protocol in industrial and automotive world
  • 12. CAN Protocol There 4 types of frames Data Frame Remote frame Overload frame Error Frame
  • 13. CAN Protocol DATA Frame • SOF – Start of Frame • Identifier – Tells the content of message and priority • RTR – Remote Transmission Request • IDE – Identifier extension (distinguishes between CAN standard,11 bit identifier, and CAN extended, 29 bit identifier.) • DLC – Data Length Code • Data – holds up to 8 bytes of data • CRC – “Cyclic Redundant Check” sum • ACK – Acknowledge • EOF – End of Frame • IFS – Intermission Frame Space. Minimum number of bits separating consecutive messages.
  • 14. Standard frame and extended frame
  • 15. • Messages are distinguished by message identifiers. • The identifier is unique to the network and defines the content & priority of the message. CAN Protocol
  • 16. CAN Protocol • When several messages access the bus at the same time, the one with the higher priority “wins”. • The identifier with the lowest binary number has the highest priority. • The priority are specified during system design and cannot be changed dynamically.
  • 17. CAN Protocol • Access conflicts on the bus are resolved by a “wired and” mechanism, where the dominate state overwrites the recessive state. • All “losers” automatically become receivers and they won’t try to send another message until the bus becomes available again.
  • 18. CAN Protocol • If one or more errors are detected, the transmission is aborted. This prevents all other stations or nodes from accepting the message. • Re-transmission is automatic. If errors continue, then the station or node may switch itself off to prevent the bus from being tied up. • Error detection is done on two levels: – Message level – Bit level
  • 19. CAN Protocol • Message Level – CRC = Cyclic Redundant Check sum – Frame Check = compares message to fixed format and frame size – ACK errors = if transmitter does not receive an ACK signal from the receivers • Bit level – Monitoring = The transmitter monitors the bus signal as it sends the message and compares the bit sent to the bit received. – Bit Stuffing = After five consecutive equal bits, the transmitter inserts a stuff bit with a compliment value into the bit stream. The receivers remove this stuff bit.
  • 20. CAN Protocol  Error Frame: sent after a violation frame format  Overload Frame: prevents data overflow from a slower CAN Overload Frames are not really used
  • 21. TEC and REC counters allows to prevent from faulty nodes  CAN Node Error States:  Error Active: Normal state, node can send all frames (error frames included)  Error passive: Node can send all frames excluding error frames  Bus off: Node is isolated from bus  Internal Counters: TEC & REC  TEC: Transmit Error Counter  REC: Receive Error Counter
  • 22. CAN Protocol Node 1 Node 2 Node 3 Bus D D D D D D r D D r D D D r r D r D D D r D r D r r D D r r r r ‘1’ Recessive (r) ‘0’ Dominant (D) Two logic states on the CAN bus Bus in dominant state Wired-AND Function Bus in recessive state or idle
  • 24. CAN Physical Layers CAN - High - Speed ( ISO 11898 ) : node 1 node 30 120 Ohm 120 Ohm CAN_H CAN_L V o lta g e tim e 2 ,5 V 3 ,5 V 1 ,5 V C A N _ H C A N _ L re c e s s iv e d o m in a n t re c e s s ic v e C A N h ig h -s p e e d , n o m in a l b u s le v e ls
  • 26. Features of Cortex-M3 board It is based on the NXP LPC1768, with a 32-bit ARM Cortex-M3 core running at 96MHz. It includes 512KB FLASH, 32KB RAM
  • 27. Cortex-M3 exercises • Blink LED • Build two bit counter • Control LED based on switch • Control the speed of the Motor based on speed.
  • 29. CAN project • Build CAN networks to transmit counter from one node to other. • Interior lighting control over CAN bus • Sending multiple bytes over CAN network
  • 30. What is Ticker? • Use the Ticker interface to set up a recurring interrupt; it calls a function repeatedly and at a specified rate.
  • 34. CANalyzer/CANoe • CAN BUS analysis at signal • CAN bus analysis at message level • Send/Receive CAN data • Simulate CAN node • Simulate CAN network • Test Automation using CAPL scripting
  • 36. Setting the baud-rate • Can1.freequency(250000);