Main Content

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. You can also install device drivers for CAN interfaces from respective Third-party vendor websites.

Note

Refer to the corresponding third-party tools vendor to know more about the supported platforms.

To configure the Simulink® model for signal monitoring and parameter tuning perform these steps:

  1. In the Simulink model, enable the signals for logging. For more information, see Configure Signal Logging.

  2. Identify the parameters for tuning. For more information, see Create Tunable Calibration Parameter in the Generated Code (Simulink Coder).

  3. Open Configuration Parameters dialog box, go to the Hardware Implementation pane and select the connected Texas Instruments C2000 board from the Hardware board list.

  4. Go to Target hardware resources > eCAN tab to configure different parameters related to the CAN module on the target.

    Note

    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.

    eCAN config

  5. Go to Target hardware resources > External mode tab, and choose XCP on CAN as the Communication interface.

    XCP CAN

  6. Select the required option for Host interface.

    • To perform signal monitoring and parameter tuning using Simulink, select Simulink as the Host interface.

      XCP host interface

      Note

      Vehicle Network Toolbox™ is required to perform external mode simulation using XCP on CAN and Simulink as 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.

        CAN channel

    • To perform signal monitoring and parameter tuning using third-party calibration software such as CANape , select Third party calibration tools as the Host interface.

      Third party calibration

  7. Configure the eCAN module on the target.

    1. Enter the values for CAN ID command and CAN ID response.

    2. Select Extended CAN ID option, if you want to use extended ID.

    3. Select Verbose option to view the External Mode execution progress and updates in the Diagnostic Viewer or in the MATLAB Command Window.

    4. Select Set logging buffer size automatically option to set the optimal buffer size for logging data.

    5. Select the CAN module to use with external mode.

    6. Enter the values for Rx mailbox number and Tx mailbox number.

  8. 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.

Monitor and 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:

  1. 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 peripheral information for using in third-party calibration tools. The file name of the A2L file is in this format: <modelname>.a2l.

    For more information on A2L file generation, see Export ASAP2 File for Data Measurement and Calibration (Simulink Coder).

    Build for monitoring

  2. Click Deploy in the Simulink Toolstrip to deploy the executable onto the target.

  3. Import the A2L file into third-party calibration tools, connect to the XCP peripheral, 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:

  1. Associate the parameters that you want to tune with Simulink.Parameter objects 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.Parameter object for tuning, see the following code:

    stepSize = Simulink.Parameter;
    stepSize.DataType = 'uint8';
    stepSize.CoderInfo.StorageClass = 'ExportedGlobal';
    stepSize.Value = 1;
  2. Associate the signals that you want to log with Simulink.Signal objects. Set the data type of the Simulink.Signal. The following code example shows how to declare such a Simulink.Signal object for logging.

    counter = Simulink.Signal;
    counter.DataType = 'uint8';
  3. 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 counter in the Signal Properties dialog box. The stepSize and counter are the data objects defined in the code.

The supported data types are:

  • uint8, int8

  • uint16, int16

  • uint32, int32

  • single

Note

Logging and tuning support of 64-bit double variables is supported only on TI F2838x (C28x) board.

Troubleshooting

Memory overflow issue1 during compilation

Description

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

Action

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

Description

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 

Action

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 at -O3 optimization level, resulting in a smaller code size which might fit the target memory.

Faster runs

See Also

Related Topics