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:
On the Apps tab, click Run on Custom Hardware, which displays the Hardware tab.
In the Hardware section, in the System Target File Description field, select
Embedded Coder (ert.tlc).
In the Prepare section, click Hardware Settings, which opens the Configuration Parameters dialog box.
Clear Generate code only.
Specify Toolchain settings for your development computer.
Select External mode.
Set Transport layer to
XCP on TCP/IPor
XCP on Serial.
For Mex-file arguments, specify the required arguments. For example:
XCP on TCP/IP, specify the IP address of the target processor and the port number of the TCP/IP server.
XCP on Serial, specify the serial port ID and the baud value.
To generate the target application and the ASAP2 file:
On the Hardware tab, in the Run on Hardware section, click Monitor & Tune.
Under Step By Step Commands, click Build for Monitoring.
Use C Code > Share > Generate Calibration Files tool to generate the ASAP2 file. Or generate the file by using this command:
In the code generation folder, the build process generates the XCP external mode target application
and the Generate Calibration Files tool generates ASAP2 file
. The ASAP2 file contains an
IF_DATA XCPblock 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.