XCP Commands

Micael Coutinho,autosarbswxcp

The XCP commands are half of the way to learn about the calibration protocol. Start mastering them in this article

Last time out, on the article What is XCP (opens in a new tab), we gave you a very thorough overview of what XCP is (hence the title) and what it can do. That ranged from DAQ lists and events to the types of available frames and CTO/DTO's. Today, we'll learn about the available commands (at least, most of them) at your disposal and how you can use them. We also recommend, before starting, that you learn a bit about calibration, if this concept is vague to you: Calibration Overview (opens in a new tab).

There will be lots of tables, and these will be divided into categories: standard commands, calibration, programming, calibration paging and DAQ/STIM related commands. So, get ready for a lot of tables and remember to leave this in your bookmarks, for the next time you have to deal with the CAN frames of this module, or something else. It will prove useful. Let's start:

IDNameMandatoryDescription
0xFFCONNECTYesStart an XCP session. Only after a positive response from the ECU the communication via XCP can start. The response describes the XCP configuration, including the maximum CTO/DTO size and the supported packages (calibration paging, XCP programming, ...)
0xFEDISCONNECTYesStops an XCP communication session. It can be sent autonomously by the ECU (in case of issues, such as timeouts or overloads) or issued by the master
0xFDGET_STATUSYesLearn about the current status of the XCP slave, along with other useful information, such as which resources are protected via seed/key
0xFCSYNCHYesUsed to synchronize command execution after timeouts
0xFBGET_COMM_MODE_INFONoRetrieve information about communication timings to be obeyed by the tester, such as the minimum separation time between frames and the maximum block size
0xFAGET_IDNoUsed to identify the XCP slave
0xF9SET_REQUESTNoRequest to save the current DAQ configuration into the NvM. Part of the XCP_RESUME mode, which we'll cover someday
0xF8GET_SEEDNoPart of the seed and key mechanism, necessary to unlock specific resources. Gets the seed
0xF7UNLOCKNoUnlock the protected resources, by providing the key obtained by processing the provided seed from the XCP slave
0xF6SET_MTANoPoint to a specific address in memory. Used generally before some other commands, such as download, upload, build checksum
0xF5UPLOADNoRead data from the ECU, starting at the specified address by SET_MTA. Resultomg MTA-pointed address will have number of read bytes added
0xF4SHORT_UPLOADNoRead data from the ECU, with a size smaller than or equal to MAX_CTO / AG
0xF3BUILD_CHECKSUMNoPerform the checksum of an area starting at MTA. Integral part of calibration page switching, to detect changes in calibration
0xF2TRANSPORT_LAYER_CMDNoPerform a specific transport layer command, such as defining a PDU dynamically
0xF1USER_CMDNoUser-specific command, to perform a functionality designed by the user
IDNameMandatoryDescription
0xF0DOWNLOADYesWrite data into the XCP slave
0xEFDOWNLOAD_NEXTNoWrite consecutive data blocks into the XCP slave
0xEEDOWNLOAD_MAXNoWrite data into the ECU, at the maximum available size (MAX_CTO / AG - 1)
0xEDSHORT_DOWNLOADNoWrite data into the ECU, with a length smaller than or equal to MAX_CTO / AG
0xECMODIFY_BITSNoPerform bitwise operations inside 32 bits
IDNameMandatoryDescription
0xD2PROGRAM_STARTYesStart a programming sequence
0xD1PROGRAM_CLEARYesClear a range of memory before reprogramming
0xD0PROGRAMYesReprogram a segment of memory
0xCFPROGRAM_RESETYesSignals the end of a programming sequence
0xCEGET_PGM_PROCESSOR_INFONoGet information regarding the programming processor
0xCDGET_SECTOR_INFONoGet information regarding a specific memory sector
0xCCPROGRAM_PREPARENoPrepare a donwload command with the intent of reprogramming
0xCBPROGRAM_FORMATNoDescribe the format of the upcoming, uninterrupted memory transfer before reprogramming
0xCAPROGRAM_NEXTNoTransmit reprogramming data in block mode
0xC9PROGRAM_MAXNoTransmit the maximum available data allowed (MAX_CTO / AG - 1)
0xC8PROGRAM_VERIFYNoPerform verification after reprogramming
IDNameMandatoryDescription
0xEBSET_CAL_PAGEYesSet to a speficic calibration page
0xEAGET_CAL_PAGEYesGet the index of the current calibration page
0xE9GET_PAG_PROCESSOR_INFONoGet information regarding the calibration paging processor
0xE8GET_SEGMENT_INFONoGet information regarding a segment of a calibration page
0xE7GET_PAGE_INFONoGet information on a specific calibration page
0xE6SET_SEGMENT_MODENoSet the mode of a segment
0xE5GET_SEGMENT_MODENoGet information on the current mode of a segment
0xE4COPY_CAL_PAGENoCopy one calibration page to another
IDNameMandatoryDescription
0xE3CLEAR_DAQ_LISTYesClear a DAQ list configuration
0xE2SET_DAQ_PTRYesSelect a DAQ list to write or read it
0xE1WRITE_DAQYesWrite an ODT entry to the pointed DAQ
0xE0SET_DAQ_LIST_MODEYesSet the mode of a DAQ list
0xDESTART_STOP_DAQ_LISTYesStart or stop acquisition on a DAQ list (or select for use in RESUME_MODE)
0xDDSTART_STOP_SYNCHYesStart or stop multiple DAQ lists synchronously
0xDCGET_DAQ_CLOCKNoGet the clock of a DAQ from the XCP slave
0xDBREAD_DAQNoRead an ODT entry of a DAQ list
0xDAGET_DAQ_PROCESSOR_INFONoGet information on the DAQ processor
0xD9GET_DAQ_RESOLUTION_INFONoGet information on the resolution capabilities of a DAQ processor
0xD8GET_DAQ_LIST_INFONoGet information on a DAQ list
0xD7GET_DAQ_EVENT_INFONoGet information on a specific event
0xD6FREE_DAQNoFree all configured DAQ lists (dynamic configuration)
0xD5ALLOC_DAQNoAllocate a DAQ list (dynamic configuration)
0xD4ALLOC_ODTNoAllocate an ODT to a DAQ list (dynamic configuration)
0xD3ALLOC_ODT_ENTRYNoAllocate an ODT entry inside an ODT (dynamic configuration)
0xC7WRITE_DAQ_MULTIPLENoWrite multiple ODT entries into a DAQ list

Quite a dosage of commands, right? We hope you are one of the strong ones who managed to grasp this article. Although it's a gigantic list, it has nothing on UDS. Don't believe us? Check our UDS articles ( UDS Overview (opens in a new tab) and UDS Frames and NRC Codes (opens in a new tab)) and tell us something!

Author: Micael Coutinho (opens in a new tab)

References:

© AutosarToday —@LinkedIn