Main Content

XCP Hardware Connection

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

Work flow diagram for connecting an XCP client and server

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 server using seed key security.

Access an A2L file that describes the server module.

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

  A2L with properties:

   File Details
                 FileName: 'XCPServerSineWaveGenerator.a2l'
                 FilePath: 'C:\work\XCPServerSineWaveGenerator.a2l'
               ServerName: 'ModuleName'
                 Warnings: [0×0 string]

   Parameter Details
                   Events: {'100 ms'}
                EventInfo: [1×1 xcp.a2l.Event]
             Measurements: {1×6 cell}
          MeasurementInfo: [6×1 containers.Map]
          Characteristics: {'Gain'  'ydata'}
       CharacteristicInfo: [2×1 containers.Map]
                 AxisInfo: [1×1 containers.Map]
            RecordLayouts: [4×1 containers.Map]
             CompuMethods: [3×1 containers.Map]
                CompuTabs: [0×1 containers.Map]
               CompuVTabs: [0×1 containers.Map]

   XCP Protocol Details
        ProtocolLayerInfo: [1×1 xcp.a2l.ProtocolLayer]
                  DAQInfo: [1×1 xcp.a2l.DAQ]
    TransportLayerCANInfo: [0×0 xcp.a2l.XCPonCAN]
    TransportLayerUDPInfo: [0×0 xcp.a2l.XCPonIP]
    TransportLayerTCPInfo: [1×1 xcp.a2l.XCPonIP]

Create an XCP channel using bat365 virtual CAN channel 1.

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

  Channel with properties:

              ServerName: 'ModuleName'
             A2LFileName: 'XCPServerSineWaveGenerator.a2l'
          TransportLayer: 'CAN'
    TransportLayerDevice: [1×1 struct]
              SeedKeyDLL: []

Configure the Channel to Unlock the Server

This example shows how to configure the channel to unlock the server 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 SeedKeyDLL property.

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

  Channel with properties:

              ServerName: 'ModuleName'
             A2LFileName: 'XCPServerSineWaveGenerator.a2l'
          TransportLayer: 'CAN'
    TransportLayerDevice: [1×1 struct]
              SeedKeyDLL: 'C:\work\SeedNKeyXcp.dll'