Skip to content
MathWorks - Mobile View
  • Sign In to Your MathWorks AccountSign In to Your MathWorks Account
  • Access your MathWorks Account
    • My Account
    • My Community Profile
    • Link License
    • Sign Out
  • Products
  • Solutions
  • Academia
  • Support
  • Community
  • Events
  • Get MATLAB
MathWorks
  • Products
  • Solutions
  • Academia
  • Support
  • Community
  • Events
  • Get MATLAB
  • Sign In to Your MathWorks AccountSign In to Your MathWorks Account
  • Access your MathWorks Account
    • My Account
    • My Community Profile
    • Link License
    • Sign Out

Videos and Webinars

  • MathWorks
  • Videos
  • Videos Home
  • Search
  • Videos Home
  • Search
  • Contact sales
  • Trial software
4:24 Video length is 4:24.
  • Description
  • Full Transcript
  • Related Resources

What Is CAN Bus?

Learn how a Controller Area Network Bus (CAN Bus) operates as well as its applications in different industries. This video covers how a CAN Bus connects nodes and ECUs in a single system and the specific protocols that define different CAN operations. It also highlights how traditional CAN differs from CAN Flexible Data Rate (CAN FD). You can use MATLAB®, Simulink®, and Vehicle Network Toolbox™ to directly interface with your CAN Bus and develop applications that:

  • Support hardware manufacturers such as Kvaser, NI®, PEAK-System, and Vector
  • Collect raw CAN data, process the data using DBC files, and visualize the results in a single environment
  • Utilize the CAN Tool to work directly with your CAN Bus in an application without having to write MATLAB code
  • Implement higher-level protocols such as XCP and J1939 to define CAN operations for specific applications
  • Convert into C or C++ code and deploy to embedded targets

Controller Area Network, also known as CAN bus, is a standard messaging protocol that allows microcontrollers and devices to communicate with each other. CAN bus was originally designed to address wiring complexity challenges in the automobile industry, but its use has spread to other areas such as industrial automation, aerospace, and more. Nowadays, you can find CAN bus used in a variety of applications such as passenger vehicles, heavy trucks, medical equipment, and elevators.

MATLAB, Simulink, and Vehicle Network Toolbox provide functions, blocks, and apps to interface with and retrieve data from CAN busses.

CAN Bus is the system that connects nodes and electronic control units, or ECUs, in a vehicle network system. The CAN bus provides a low-level interface that allows ECUs to communicate directly with each other through a simple serial bus.

CAN FD, or Controller Area Network Flexible Data-Rate, is a protocol that builds upon CAN. The main difference between CAN and CAN FD is that the Flexible Data Rate in CAN FD allows for higher data throughput on the bus. For comparison, the maximum CAN frame is 8 bytes, while the maximum CAN FD frame is 64 bytes.

CAN and CAN FD are advantageous because of their low cost, decentralized network system, efficiency, and node flexibility.

Higher level protocols such as J1939 or XCP define communication systems on top of the CAN bus that define operations for specific applications, such as heavy vehicles for J1939 and vehicle calibration for XCP. Raw data from a CAN bus can extracted and decoded into protocol specific information using a CAN Database File, or DBC.

MATLAB and Simulink support CAN bus interfaces from manufacturers such as Kvaser, National Instruments, PEAK-System, and Vector. Vehicle Network toolbox supports CAN bus interfaces that connect directly to your PC via USB, PCI, PCI-Express, PXI, and PCMCIA.

Vehicle Network Toolbox provides Simulink blocks for generating C or C++ code from your CAN bus workflow. Certain blocks such as CAN and CAN FD Pack and Unpack support code generation for embedded targets. You can also generate code for custom targets through the documented Pack/Unpack interfaces.

Vehicle Network Toolbox, alongside MATLAB and Simulink, provides a single environment to communicate and analyze CAN and CAN FD data in cross-functional engineering workflows. You can collect raw CAN and CAN FD data directly from a CAN bus or transmit ECU data directly from MATLAB using a virtual CAN or CAN FD channel. Once you receive the CAN data, you can unpack and decode the raw data into CAN messages. You can store the CAN message logs or process them using MATLAB or Simulink algorithms and visualize the results.

The Vehicle CAN Bus monitor provides a direct interface to visualize CAN and CAN FD channel traffic without having to write MATLAB code. Using the interactive CAN tool, you can view raw data on a CAN or CAN FD channel and configure the CAN bus to filter messages of interest. You can also import DBC files into the CAN tool in order to decode and see message signal information directly. Once you have isolated all messages of interest, you can save and export the CAN bus data to log files in MATLAB.

For more information about using the CAN bus from MATLAB or Simulink, explore the Vehicle Network Toolbox product page. You can also explore the MATLAB documentation for examples on how to get started using the CAN bus.

Related Products

  • Vehicle Network Toolbox

Bridging Wireless Communications Design and Testing with MATLAB

Read white paper
Related Information
Related Information
Vehicle Network Toolbox

Feedback

Featured Product

Vehicle Network Toolbox

  • Request Trial
  • Get Pricing

Up Next:

59:46
Interfacing with In-Vehicle Networks Using CAN Protocol

Related Videos:

26:08
Effects of CAN Bus Communications for Distributed Control...
29:45
CAN Communication with Your ECUs and the Vehicle Network...

View more related videos

MathWorks - Domain Selector

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

  • Switzerland (English)
  • Switzerland (Deutsch)
  • Switzerland (Français)
  • 中国 (简体中文)
  • 中国 (English)

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
    • 简体中文Chinese
    • English
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

  • Contact sales
  • Trial software

MathWorks

Accelerating the pace of engineering and science

MathWorks is the leading developer of mathematical computing software for engineers and scientists.

Discover…

Explore Products

  • MATLAB
  • Simulink
  • Student Software
  • Hardware Support
  • File Exchange

Try or Buy

  • Downloads
  • Trial Software
  • Contact Sales
  • Pricing and Licensing
  • How to Buy

Learn to Use

  • Documentation
  • Tutorials
  • Examples
  • Videos and Webinars
  • Training

Get Support

  • Installation Help
  • MATLAB Answers
  • Consulting
  • License Center
  • Contact Support

About MathWorks

  • Careers
  • Newsroom
  • Social Mission
  • Customer Stories
  • About MathWorks
  • Select a Web Site United States
  • Trust Center
  • Trademarks
  • Privacy Policy
  • Preventing Piracy
  • Application Status

© 1994-2022 The MathWorks, Inc.

  • Facebook
  • Twitter
  • Instagram
  • YouTube
  • LinkedIn
  • RSS

Join the conversation