Main Content

Communication in MATLAB

Use an A2L file to allow communication between XCP client and server modules via XCP

An A2L file is a special description file that defines the implementation of an ECU. The information in an A2L file allows an XCP client to communicate with a server module via an XCP connection. The formatted text file contains event and measurement definitions, and other configuration information, used for acquiring and stimulating data and to perform other functions.

To communicate with an XCP server over CAN, an A2L file (ECU description file) must contain at least the following property information:

  • ProtocolLayerInfo

  • TransportLayerCANInfo

  • Measurements

  • DAQInfo and Events

    • MATLAB®: DAQInfo and Events content is required if using dynamic DAQ list functionality.

    • Simulink®: Because the XCP CAN Data Acquisition block uses dynamic DAQ list functionality, DAQInfo and Events content is required.

You can connect your XCP client to a server module using the CAN protocol. This allows you to use events and access measurements on the server module. Follow the XCP Database and Communication Workflow to learn how to connect to a device using XCP.

You can perform a direct read from or write to the memory on the server module. Alternatively, create a dynamic data stimulation list and assign measurements to the list, then read acquired DAQ data and write stimulation data.

Functions

expand all

xcpA2LAccess A2L file
getCharacteristicInfoGet information about specific characteristic from A2L file
getMeasurementInfoGet information about specific measurement from A2L file
getEventInfoGet event information about specific event from A2L file
xcpChannelCreate XCP channel
connectConnect XCP channel to server module
disconnectDisconnect from server module
isConnectedConnection status
readCharacteristicRead and scale specified characteristic value from direct memory
writeCharacteristicScale and write specified characteristic value to direct memory
readMeasurementRead and scale specified measurement value from direct memory
writeMeasurementScale and write specified measurement value to direct memory
readAxisRead and scale specified axis value from direct memory
writeAxisScale and write specified axis value to direct memory
readSingleValueRead single sample of specified measurement from memory
writeSingleValueWrite single sample to specified measurement
createMeasurementListCreate measurement list for XCP channel
viewMeasurementListsView configured measurement lists on XCP channel
freeMeasurementListsRemove all measurement lists from XCP channel
startMeasurementStart configured DAQ and STIM lists
isMeasurementRunningIndicate if measurement is active
readDAQRead scaled samples of specified measurement from DAQ list
readDAQListRead samples and times of specified measurement in DAQ list (Since R2024a)
readDAQListDataRead samples of specified measurement from DAQ list
writeSTIMWrite scaled value of specified measurement to STIM list
writeSTIMListDataWrite to specified measurement
stopMeasurementStop configured DAQ and STIM lists

Properties

expand all

xcp.A2L PropertiesProperties of the xcp.A2L file object
xcp.Channel PropertiesProperties of the xcp.Channel object

Topics

Hardware Connection

Read and Write Data to Memory

Acquire and Stimulate Measurements