Vehicle Network Toolbox
.dbc) file and A2L description file support
Vehicle Network Toolbox lets you interact directly with a CAN bus from MATLAB or Simulink. You can execute toolbox functions from the MATLAB command line and through MATLAB programs. The toolbox also contains Simulink blocks that enable you to connect a Simulink model to a CAN bus.
CAN channel functions in MATLAB and CAN configuration blocks in Simulink enable you to define a connection to Vector CAN interface hardware that establishes a physical connection with a CAN bus. The toolbox provides CAN channel functions to query and configure CAN interface hardware settings, such as bus speed and transceiver settings. You can also verify other CAN channel properties, such as the number of messages available and the number of messages received or transmitted on the channel. By attaching Vector CAN database files to CAN channels, incoming messages are automatically presented using information stored in the database. After defining a CAN channel, you can send and receive CAN messages on the channel.
CAN messages contain properties for storing the CAN message identifier (standard 11-bit or extended 29-bit), the time stamp, and up to 8 bytes of CAN data. Transmit and receive functions and blocks in the toolbox enable the sending and receiving of CAN messages over CAN channels. For large data sets, you can log CAN messages for offline analysis.
Vehicle Network Toolbox provides functions and blocks for encoding and decoding CAN messages. CAN message data may contain data representing multiple signals. Unpack functions and blocks let the user specify start bit, signal length, data type, and byte ordering. Pack functions and blocks provide the same options for building up data for CAN message transmission.
Using the CAN Log block in the toolbox, you can save CAN messages received by your model to a MAT-file. You can then use the CAN Replay block to replay the messages in another Simulink model. The CAN Replay block preserves the time stamps of the logged data so the replayed data will have the same timing characteristics as the recorded data.
Vehicle Network Toolbox provides functions and blocks for communicating with ECUs via XCP—an automotive calibration protocol—over CAN bus. When communicating with ECUs over XCP, MATLAB or Simulink is the master and the ECUs are slave devices. You can communicate with multiple ECUs by opening multiple XCP channels. For each ECU, you can read and write data to specific memory locations within the ECU. When secured access to an ECU exists, you can use seed and key security to open access to the ECU. The toolbox also provides functions and blocks for linking A2L database files and for creating and viewing dynamic DAQ and STIM measurement lists for an XCP channel. These lists are established based on measurement and event information from the linked A2L file.
The toolbox provides a Vehicle Network CAN Bus Monitor app for visualizing active traffic on a particular CAN channel. You can use the app while performing other tasks in MATLAB or Simulink. For CAN database files associated with your CAN channel, the app decodes the messages and displays them in their correct engineering units.
When traffic on the network contains more information than needed for your application, you can limit the number of CAN messages received by a CAN channel to a defined range of CAN message identifiers. Using filter functions and mask settings in the toolbox, you receive only the messages needed for your application.
Vehicle Network Toolbox lets you associate a Vector CAN database file with a CAN channel or message from MATLAB or Simulink, enabling you to encode and decode CAN messages using application-specific message and signal names such as EngineMsg and EngineRPM, as well as scaled engineering units. The ability to work with industry-standard database files simplifies the interaction with the CAN bus because the database not only specifies the message list and component signals, but also provides the bit packing and unpacking rules for the associated signals. Because signal data type, start bit, length, and byte order are all predefined for the messages in the database, you can focus on analyzing your signals rather than on defining them.
Vehicle Network Toolbox lets you use industry-standard A2L (also known as ASAP2) description files to communicate with ECUs over the XCP protocol from MATLAB or Simulink. Using A2L description files enables you to access internal ECU parameters from a MATLAB program or a Simulink model. A2L description files contain information about the associated memory address for a particular parameter, the storage structure, and the data type. The files also contain rules for converting stored values such as system parameters, sensor characteristics, and correction factors into physical units such as RPM and degrees Celsius. Having this data lets you easily perform calibration and measurement tasks without needing to parse data and decode memory addresses.