Main Content

Calibrate Generated Code and Monitor Signals

When you create an external mode target application that uses an ASAM MCD-1 XCP communication channel, you can also generate an ASAP2 file that provides a description of the Simulink® Coder™ Universal Measurement and Calibration Protocol (XCP) server configuration. The description enables third-party calibration tools, such as ETAS® INCA and Vector CANape®, to connect to the external mode target application. You can use the third-party tools to calibrate generated code and monitor signals in environments supported by the third-party tools, for example, a vehicle, a test bench, or a virtual environment on a PC.

Configure your model to generate an ASAP2 file that provides a description of the XCP server configuration:

  1. On the Apps tab, click Run on Custom Hardware, which displays the Hardware tab.

  2. In the Hardware section, in the System Target File Description field, select Embedded Coder (ert.tlc).

  3. In the Prepare section, click Hardware Settings, which opens the Configuration Parameters dialog box.

  4. Clear Generate code only.

  5. Specify Toolchain settings for your development computer.

  6. Select External mode.

  7. Set Transport layer to XCP on TCP/IP or XCP on Serial.

  8. For Mex-file arguments, specify the required arguments. For example:

    • For XCP on TCP/IP, specify the IP address of the target processor and the port number of the TCP/IP server.

    • For XCP on Serial, specify the serial port ID and the baud value.

  9. Click OK.

To generate the target application and the ASAP2 file:

  1. On the Hardware tab, in the Run on Hardware section, click Monitor & Tune.

  2. Under Step By Step Commands, click Build for Monitoring.

  3. Use C Code > Share > Generate Calibration Files tool to generate the ASAP2 file. Or generate the file by using this command:

    coder.asap2.export('modelName','MapFile','symbolFileName');

  4. In the code generation folder, the build process generates the XCP external mode target application modelName.exe and the Generate Calibration Files tool generates ASAP2 file modelName.a2l. The ASAP2 file contains an IF_DATA XCP block that describes the Simulink Coder XCP server configuration.

    …
    /begin IF_DATA XCP      
      /begin PROTOCOL_LAYER
      …  
      /end PROTOCOL_LAYER
      …
      /begin XCP_ON_TCP_IP
      …
      /end XCP_ON_TCP_IP
    /end IF_DATA
    …

Import the ASAP2 file into your third-party tool and manually run the external mode application on your target hardware. Through XCP, connect the third-party tool to the target application. Then, using that tool, perform data acquisition and calibration of the generated code.

See Also

Related Topics