Signal Monitoring and Parameter Tuning Over XCP on CAN
You can use XCP-based External mode simulation over CAN to connect to the Texas Instruments™ C2000™ board and perform signal monitoring and parameter tuning. For information on setting up Vector devices, see Set Up CAN Communication with Target Hardware. Multiple Third-party CAN vendors are supported. For the list of supported vendors and the instructions to install drivers required, see Install Hardware Support Package for Device Driver. You can also install device drivers for CAN interfaces from respective Third-party vendor websites.
To configure the Simulink model for signal monitoring and parameter tuning perform these steps:
In the Simulink model, enable the signals for logging. For more information, see Configure a Signal for Logging.
Identify the parameters for tuning. For more information, see Create Tunable Calibration Parameter in the Generated Code (Simulink Coder).
Open Configuration Parameters dialog box, go to the Hardware Implementation pane and select the connected Texas Instruments C2000 board from the Hardware board list.
Go to Target hardware resources > eCAN tab to configure different parameters related to the CAN module on the target.
If the target supports multiple eCAN modules, select the eCAN module to be used with external mode and then configure different parameters for the selected CAN module.
Go to Target hardware resources > External mode tab, and choose
XCP on CANas the Communication interface.
Select the required option for Host interface.
To perform signal monitoring and parameter tuning using Simulink, select
Simulinkas the Host interface.
Vehicle Network Toolbox™ is required to perform external mode simulation using XCP on CAN and
Simulinkas Host interface.
Enter the values for CAN vendor, CAN device,and CAN channel number.
Use the Vehicle Network Toolbox function
canChannelList()to get values for CAN vendor, CAN device, CAN channel . This function returns a list of all the CAN interfaces whose drivers have been installed and connected to the computer. In the MATLAB command window, type
canChannelList()and press enter. A sample screen is shown here.
To perform signal monitoring and parameter tuning using third-party calibration software such as CANape , select
Third party calibration toolsas the Host interface.
Configure the eCAN module on the target.
Enter the values for CAN ID command and CAN ID response.
Select Extended CAN ID option, if you want to use extended ID.
Select Verbose option to view the External Mode execution progress and updates in the Diagnostic Viewer or in the MATLAB Command Window.
Select Set logging buffer size automatically option to set the optimal buffer size for logging data.
CAN moduleto use with external mode.
Enter the values for Rx mailbox number and Tx mailbox number.
Click Apply and OK.
After you configure the Simulink model, initiate the Parameter Tuning and Signal Logging action using the steps listed in Model with Simulink as Host Interface. If you are using a third-party calibration software such as CANape to perform signal monitoring and parameter tuning, then perform the steps listed in Model with Third party calibration tools as Host Interface.
Deploy Model on Target Hardware
Model with Simulink as Host Interface
After you configure the Simulink model, initiate the Parameter Tuning and Signal Logging action. In the Hardware tab of Simulink toolstrip, click Monitor & Tune.
For more information, see the example Signal Monitoring and Parameter Tuning Over XCP-based CAN Interface.
Model with Third party calibration tools as Host Interface
To configure the Simulink model for signal monitoring and parameter tuning using third-party calibration tools perform these steps:
In the Hardware tab of Simulink toolstrip, click Build for Monitoring. This action builds and deploys the model on the target Texas Instruments C2000 board, and also generates an A2L file in the current MATLAB folder path. The A2L file contains XCP slave information for using in third-party calibration tools. The file name of the A2L file is in this format: <modelname>
For more information on A2L file generation, see Export ASAP2 File for Data Measurement and Calibration.
Click Deploy in the Simulink Toolstrip to deploy the executable onto the target.
Import the A2L file into third-party calibration tools, connect to the XCP slave, and start monitoring of signals and calibration of parameters using the interface in third-party calibration tool. For more information, see the example Calibrate ECU Parameters from Third-party Calibration Tools Using XCP-based CAN Interface.
You can use XCP-based External mode simulation over CAN to connect to the Texas Instruments C2000 board from a third-party calibration software such as CANape and perform signal monitoring and parameter calibration. For information to configure the external mode with any available eCAN module, see Set Up CAN Communication with Target Hardware.
Supported Objects and Data Types
The supported objects and data types for Signal Monitoring and Parameter Tuning Over XCP on CAN using Simulink and third-Party Calibration Tools are:
Define data objects for the signals and parameters. For ease of use, create a MATLAB® file to define the data objects so that you only have to set up the objects only once.
To set up tunable parameters and signal logging:
Associate the parameters that you want to tune with
Simulink.Parameterobjects with ‘ExportedGlobal’ storage class. It is important to set the data type and value of the parameter object. For an example of how to create such a
Simulink.Parameterobject for tuning, see the following code:
stepSize = Simulink.Parameter; stepSize.DataType = 'uint8'; stepSize.CoderInfo.StorageClass = 'ExportedGlobal'; stepSize.Value = 1;
Associate the signals that you want to log with
Simulink.Signalobjects. Set the data type of the
Simulink.Signal. The following code example shows how to declare such a
Simulink.Signalobject for logging.
counter = Simulink.Signal; counter.DataType = 'uint8';
Associate the data objects that you defined in the MATLAB file with parameters or signals in the model. For the previous code examples, you can set the Constant value in a Source block to
stepSize, and set a Signal name to
counterin the Signal Properties dialog box. The
counterare the data objects defined in the code.
The supported data types are:
Logging and tuning support of 64-bit double variables is supported only on TI F2838x (C28x) board.
Memory overflow issue1 during compilation
The following error might occur due to insufficient memory:
program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. run placement with alignment/blocking fails for section ".ebss" size 0x98b1page 1. Available memory ranges: DRAM size: 0x6000 unused: 0x6000 max hole: 0x6000
This error occurs if the model contains a lot of signals and more memory is required than available on the target to log all the signals. To resolve the issue, reduce the number of signals being logged so that the memory available on the target is sufficient.
Memory overflow issue2 during compilation
The following error might occur due to insufficient memory:
program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. placement with alignment/blocking fails for section ".text" size 0x360apage 0. Available memory ranges: RAMLS_PROG size: 0x3000 unused: 0x2bd7 max hole: 0x2bd6
This error shown at linking stage indicates that the memory is insufficient to fit the
code section (
.text) in the target memory available. External Mode
simulation requires additional code to enable the communication between Simulink and the
target, which might lead to this code section overflow. To mitigate this issue, select
Faster Runs as the Build Configuration
in the Configuration Parameters screen. This option compiles the code
-O3 optimization level, resulting in a smaller code size which might
fit the target memory.