Documentation Center

  • Trial Software
  • Product Updates

XCP Hardware Connection

You can connect your XCP master to a slave module using the CAN protocol. This allows you to use events and access measurements on the slave module.

Create XCP Channel Using ˋCAN Device

This example shows how to create an XCP CAN channel connection and access channel properties. The example also shows how to unlock the slave using seed key security.

Access an A2L file that describe the slave module.

 a2lfile = xcpA2L('C:\work\XCPSIM.a2l')
a2lfile = 

  A2L with properties:

                 FileName: 'XCPSIM.a2l'
                 FilePath: 'C:\work\XCPSIM.a2l'
                SlaveName: 'CPP'
        ProtocolLayerInfo: [1x1 struct]
                  DAQInfo: [1x1 struct]
    TransportLayerCANInfo: [1x1 struct]
                   Events: {1x6 cell}
             Measurements: {1x38 cell}

Create an XCP channel using Vector virtual CAN channel 1.

xcpch = xcpChannel(a2lfile, 'CAN', 'Vector', 'Virtual 1', 1)
xcpch = 

  Channel with properties:

               SlaveName: 'CPP'
             A2LFileName: 'XCPSIM.a2l'
          TransportLayer: 'CAN'
    TransportLayerDevice: [1x1 struct]
              SeedKeyDLL: []

Configure the Channel to Unlock the Slave

This example shows how to configure the channel to unlock the slave using a dll that contains a seed and key security algorithm when your module is locked for Stimulation operations,.

Create your XCP channel and set the channel's SeedKeyDLL property.

 xcpch.SeedKeyDLL = ('C:\Work\SeedNKeyXcp.dll')
xcpch = 

  Channel with properties:

               SlaveName: 'CPP'
             A2LFileName: 'XCPSIM.a2l'
          TransportLayer: 'CAN'
    TransportLayerDevice: [1x1 struct]
              SeedKeyDLL: 'C:\Work\SeedNKeyXcp.dll'

    Note:   Make sure the seed and key security access dll that you use matches the version of your platform. You cannot use a 32-bit dll 64-bit MATLAB or a 64-bit system.

Was this topic helpful?