XCP
EcuBus-Pro includes an ASAM MCD-1 XCP master for connecting to XCP slaves over CAN / CAN-FD, UDP, and TCP. You can configure connections in the GUI, inspect slave capabilities and DAQ event channels, monitor decoded XCP traffic in the Trace window, and automate measurement, calibration, and programming from TypeScript scripts.
XCP Configuration Window
Open the XCP configuration window from the menu bar via Diagnostics → XCP.
- Click Add in the connection tree to create a new XCP connection.
- Give the connection a unique Name (this name can be referenced directly from user scripts via
XcpCreateConnection('name')). - Choose the Transport and fill in the transport parameters, then save.
- Use Connect / Probe to send
CONNECT, read slave properties (MAX_CTO,MAX_DTO, byte order, address granularity, resources), and optionally query DAQ event channels (GET_DAQ_EVENT_INFO).
Supported Transports
| Transport | Key Settings | Notes |
|---|---|---|
| CAN / CAN-FD | CAN device, canIdCmd (Master → Slave), canIdResp (Slave → Master), 11-bit/29-bit extended ID, CAN-FD / BRS, padding byte & DLC | Supports classic CAN (up to 8 bytes) and CAN-FD (up to 64 bytes) with optional frame padding. |
| UDP | Remote IP / hostname, remote port, timeout | Uses standard 4-byte XCP-on-Ethernet framing (LEN + CTR). |
| TCP | Remote IP / hostname, remote port, timeout | Uses standard 4-byte XCP-on-Ethernet framing over a persistent TCP stream. |
Network View
Saved XCP connections appear in the Network view linked to their configured CAN or Ethernet hardware node. While a user script holds an XCP connection open, the Network view displays its live open status.
Trace Window
All XCP packets transmitted and received by EcuBus-Pro are logged to the Trace window with decoded symbols prefixed by the connection name:
- Commands (Master → Slave):
<conn>.CONNECT,<conn>.SHORT_UPLOAD,<conn>.DOWNLOAD,<conn>.GET_VERSION, etc. - Responses & Errors (Slave → Master):
<conn>.RES,<conn>.ERR_ACCESS_LOCKED,<conn>.ERR_OUT_OF_RANGE, etc. - Events & Service Requests:
<conn>.EV_DAQ_OVERLOAD,<conn>.EV_CMD_PENDING,<conn>.SERV_TEXT, etc. - DAQ / STIM DTOs:
<conn>.DAQ<list>.ODT<odt>(decoded according to the slave'sDAQ_KEY_BYTEidentification field and byte order).
Use the Trace filter to isolate XCP traffic (xcpSent, xcpRecv, xcpErr, xcpEvent, xcpDaq).
Script API
User scripts import XCP helpers from 'ECB'. You can open either a saved connection by name or an inline CAN / UDP / TCP address. Any unclosed handles are automatically cleaned up when the project stops.
import {
Util,
XcpCreateConnection,
XcpCloseConnection,
XcpConnect,
XcpDisconnect,
XcpSetMta,
XcpUploadBytes,
XcpShortUpload,
XcpDownload
} from 'ECB'
Util.Init(async () => {
// Open a connection saved in Diagnostics -> XCP (or pass an inline CAN/UDP/TCP object)
const handle = await XcpCreateConnection('ecu')
// Inline UDP example:
// const handle = await XcpCreateConnection({ transport: 'udp', ip: '127.0.0.1', port: 5555 })
try {
const info = await XcpConnect(handle)
console.log(
`Connected: MAX_CTO=${info.maxCto}, MAX_DTO=${info.maxDto}, byteOrder=${info.commModeBasic.byteOrder}`
)
// Read 4 bytes directly with SHORT_UPLOAD
const sample = await XcpShortUpload(handle, 4, 0x1000)
console.log('SHORT_UPLOAD:', sample)
// Read a larger block automatically split across MAX_CTO chunks
await XcpSetMta(handle, 0x1000)
const block = await XcpUploadBytes(handle, 32)
console.log('UPLOAD_BYTES:', block.length)
// Write calibration bytes (accepts number[], Uint8Array, or Buffer)
await XcpSetMta(handle, 0x2000)
await XcpDownload(handle, Buffer.from([0x01, 0x02, 0x03, 0x04]))
await XcpDisconnect(handle)
} finally {
await XcpCloseConnection(handle)
}
})Available Worker Helpers
- Session & Identification:
XcpCreateConnection,XcpCloseConnection,XcpConnect,XcpDisconnect,XcpGetStatus,XcpSynch,XcpGetCommModeInfo,XcpGetVersion,XcpGetId,XcpReadId,XcpSetRequest,XcpGetSeed,XcpUnlock - Memory Transfer & Calibration:
XcpSetMta,XcpUpload,XcpUploadBytes,XcpShortUpload,XcpBuildChecksum,XcpDownload,XcpDownloadNext,XcpShortDownload,XcpModifyBits,XcpSetCalPage,XcpGetCalPage,XcpCopyCalPage,XcpGetPagProcessorInfo - DAQ:
XcpGetDaqProcessorInfo,XcpGetDaqResolutionInfo,XcpGetDaqEventInfo,XcpGetDaqClock,XcpFreeDaq,XcpAllocDaq,XcpAllocOdt,XcpAllocOdtEntry,XcpClearDaqList,XcpSetDaqPtr,XcpWriteDaq,XcpSetDaqListMode,XcpStartStopDaqList,XcpStartStopSynch,XcpReadIndication - Programming (PGM):
XcpProgramStart,XcpProgramClear,XcpProgram,XcpProgramNext,XcpProgramReset,XcpProgramVerify
