XCP/SPI is used on multi-core SoCs where a dedicated measurement processor accesses the main application core's memory via a high-speed SPI bus — no external CAN connection required for measurement. The calibration tool communicates with the measurement processor, which bridges to the application core's RAM.
/* XCP SPI slave: lightweight framing, no IP stack */
/* Used on secondary core of Renesas RH850 or NXP MPC57xx */
void XcpSpi_RxCallback(uint8* rxBuf, uint16 len)
{
/* Parse XCP frame from SPI data */
XcpPacket_t* pkt = (XcpPacket_t*)rxBuf;
switch (pkt->cmd) {
case XCP_CMD_CONNECT:
XcpSpi_SendConnectResponse();
break;
case XCP_CMD_DOWNLOAD:
/* Proxy DOWNLOAD to application core RAM via IRAM bridge */
AppCore_WriteMemory(pkt->mta, pkt->data, pkt->length);
XcpSpi_SendPositiveResponse();
break;
case XCP_CMD_DAQ_UPLOAD:
/* Read application core RAM for DAQ */
AppCore_ReadMemory(pkt->mta, localBuf, pkt->length);
XcpSpi_SendDataResponse(localBuf, pkt->length);
break;
}
}