ECU Communication
Function: GetUdsError
Description:Retrieves the latest UDS error description.
Returns:
A string containing the description of the last UDS error.
Usage Example | |
---|---|
Function: GetUdsErrorCode
Description:Fetches the error code corresponding to the latest UDS error.
Returns:
A byte representing the error code.
HEX Code | Abbreviation | Description |
---|---|---|
0x00 | NO_ERROR | No error detected |
0x10 | GENERAL_REJECT | General rejection of the request |
0x11 | SERVICE_NOT_SUPPORTED | Service is not supported |
0x12 | SUBFUNCTION_NOT_SUPPORTED | Subfunction is not supported |
0x13 | INCORRECT_MSG_LENGTH_OR_FORMAT | Incorrect message length or format |
0x14 | RESPONSE_TOO_LONG | Response too long to be processed |
0x21 | BUSY | ECU is busy and cannot process the request |
0x22 | CONDITIONS_NOT_CORRECT | Conditions not correct for the request |
0x24 | REQUEST_SEQUENCE_ERROR | Sequence of request messages was wrong |
0x25 | NoResponseFromSubnetComponent | No response from the subnet component |
0x31 | REQUEST_OUT_OF_RANGE | Request is out of the acceptable range |
0x33 | SECURITY_ACCESS_DENIED | Security access is denied |
0x35 | INVALID_SECURITY_KEY | The provided security key is invalid |
0x36 | SECURITY_ATTEMPS_EXCEEED | Security access attempts exceeded |
0x37 | REQUIRED_TIME_DELAY_NOT_EXPIRED | Required time delay for the operation has not yet expired |
0x70 | UPLOAD_DOWNLOAD_NOT_ACCEPTED | Upload or download request is not accepted |
0x71 | TRANSFER_DATA_SUSPENDED | Transfer data has been suspended |
0x72 | GENERAL_PROGRAMMING_FAILURE | General programming failure occurred |
0x73 | WRONG_BLOCK_SEQUENCE_COUNTER | Wrong block sequence counter detected |
0x78 | REPONSE_PENDING | Response for the request is still pending |
0x79 | INVALID_DATA_BLOCK | Invalid data block detected |
0x7E | SUBFUNCTION_NOT_SUPPORTED_IN_ACTIVE_SESSION | Subfunction is not supported in the current session |
0x7F | SERVICE_NOT_SUPPORTED_IN_ACTIVE_SESSION | Service is not supported in the current session |
0x81 | RPM_TOO_HIGH | RPM value is too high for operation |
0x82 | RPM_TOO_LOW | RPM value is too low for operation |
0x83 | ENGINE_IS_RUNNING | Engine is currently running |
0x84 | ENGINE_IS_NOT_RUNNING | Engine is not currently running |
0x85 | ENGINE_RUN_TIME_TOO_LOW | Engine run time is too low |
0x86 | TEMPERATURE_TOO_HIGH | Temperature is too high for operation |
0x87 | TEMPERATURE_TOO_LOW | Temperature is too low for operation |
0x88 | VEHICLESPEED_TOO_HIGH | Vehicle speed is too high for operation |
0x89 | VEHICLESPEED_TOO_LOW | Vehicle speed is too low for operation |
0x8A | THROTTLE_PEDAL_TOO_HIGH | Throttle pedal position is too high |
0x8B | THROTTLE_PEDAL_TOO_LOW | Throttle pedal position is too low |
0x8C | TRANSMISSION_RANGE_NOT_IN_NEUTRAL | Transmission is not in neutral |
0x8D | TRANSMISSION_RANGE_NOT_IN_GEAR | Transmission is not in gear |
0x8F | BRAKE_PEDAL_NOT_PRESSED_OR_NOT_APPLIED | Brake pedal is not pressed or applied |
0x90 | SHIFTER_LEVER_NOT_IN_PARK | Shifter lever is not in park position |
0x91 | TORQUE_CONVERTER_CLUTCH_LOCKED | Torque converter clutch is locked |
0x92 | VOLTAGE_TOO_HIGH | System voltage is too high for operation |
0x93 | VOLTAGE_TOO_LOW | System voltage is too low for operation |
0xEF | SYNC_ERROR | Synchronization error occurred |
0xF0 - 0xFA | CONDITIONS_NOT_CORRECT_Fx | Conditions not correct (specific code) |
0xFB | NOT_CONNECTED_TO_ECU | Not connected to ECU |
0xFC | NO_RESPONSE | No response received from ECU |
0xFD | CONNECTION_ERROR | Connection error occurred |
0xFE | VCI_ERROR | Vehicle communication interface error |
0xFF | UNKNOWN | Unknown error or state |
Function: OpenEcu
Description:Attempts to establish communication with the ECU at the specified address.
Parameters:
- address
: The address of the target ECU.
- session
: The session type to which to switch (by default = 0x03):
session | Description |
---|---|
0x01 | OBD Diagnostic mode |
0x02 | Programming session |
0x03 | Extended session |
0x40 | EOL session |
0x4F | Engineering session |
Returns:
true
if the connection was successful, false
otherwise.
Usage Example 1 | |
---|---|
Usage Example 2 | |
---|---|
Procedure: CloseEcu
Description:Terminates the communication with the ECU.
Returns:
None.
Function: EcuReset
Description:Performs a reset on the ECU.
Parameters:
- mode
: The type of reset to be performed. Default is 0x02
.
mode | Description |
---|---|
0x01 | Hard reset |
0x02 | Soft reset |
Returns:
true
if the reset was successful, false
otherwise.
Usage Example | |
---|---|
Function: ChangeSession
Description:Changes the current ECU session.
Parameters:
- session
: The session type to which to switch:
session | Description |
---|---|
0x01 | OBD Diagnostic mode |
0x02 | Programming session |
0x03 | Extended session |
0x40 | EOL session |
0x4F | Engineering session |
Returns:
true
if the session change was successful, false
otherwise.
Usage Example | |
---|---|
Function: ReadDataById
Description:Reads data from the ECU by specifying a data ID.
Parameters:
- id
: The ID of the data to be read.
Returns:
An array of bytes representing the data read from the ECU.
Usage Example | |
---|---|
Function: WriteDataById
Description:Writes data to the ECU by specifying a data ID.
Parameters:
- id
: The ID where the data should be written.
- data
: The data to be written.
- writeFingerPrint
: A flag indicating whether a fingerprint should be written. Default is true
.
Returns:
true
if the write operation was successful, false
otherwise.
Usage Example | |
---|---|
Function: SendRawHex
Description:Sends raw hexadecimal data to the ECU.
Parameters:
- data
: The raw data to be sent.
- supressResponse
: A flag indicating whether the ECU response should be suppressed. Default is false
.
Returns:
An array of bytes representing the ECU's response.
Usage Example | |
---|---|
Security Access
Function: Login
Description:Attempts to authenticate to the ECU with the given login value.
Parameters:
- login
: The value used to attempt to authenticate.
Returns:
true
if login was successful, false
otherwise.
Usage Example | |
---|---|
Function: Login
Description:
Attempts to login to the system using the specified hexadecimal algorithm and mode.
Parameters:
- hexAlg
: Hexadecimal algorithm to be used for login.
- mode
: Mode for the login process.
Return Value:
Returns true
if the login was successful, otherwise false
.
Usage Example | |
---|---|
Function: GetSeed
Description:Requests a security seed from the ECU for the specified mode.
Parameters:
- mode
: The mode for which a seed is requested.
Returns:
An array of bytes representing the seed provided by the ECU.
Usage Example | |
---|---|
Function: SendKey
Description:Sends a security key to the ECU for the specified mode.
Parameters:
- mode
: The mode for which the key is sent.
- data
: The calculated key to be sent to the ECU.
Returns:
true
if the key was accepted by the ECU, false
otherwise.
Usage Example | |
---|---|
Routine Control
Function: StartRoutine
Description:
Initiates a specified routine in the ECU. Optional data can be provided.
Parameters:
- routine
: The identifier of the routine to be started.
- data
: Optional data to be sent alongside the routine start command.
Returns:
An array of bytes representing the response from the ECU upon starting the routine.
Usage Example | |
---|---|
Function: StopRoutine
Description:
Terminates a specified routine in the ECU. Optional data can be provided if necessary for the termination process.
Parameters:
- routine
: The identifier of the routine to be stopped.
- data
: Optional data to be sent alongside the routine stop command.
Returns:
An array of bytes representing the response from the ECU upon stopping the routine.
Usage Example | |
---|---|
Function: ResultRoutine
Description:
Requests the result of a specified routine from the ECU.
Parameters:
- routine
: The identifier of the routine whose result is being queried.
- data
: Optional data to be sent alongside the routine result request.
Returns:
An array of bytes representing the routine's result.
Usage Example | |
---|---|
Memory Cells Service
Function: ReadMemoryByAddress
Description:
Retrieves a specific block of memory from the ECU based on the provided address and size.
Parameters:
- address
: The starting memory address from which the read should begin.
- size
: The amount of memory, in bytes, to read.
- alfid
: is a parameter that denotes the dimensionality of the address and data block size length. It can assume values ranging from 0 to 4 for each digit, for example: 0x11, 0x21, 0x33, 0x42, 0x44, etc.
Returns:
An array of bytes representing the retrieved memory block from the ECU.
Usage Example | |
---|---|
Function: WriteMemoryByAddress
Description:
Writes a block of data to a specified memory address within the ECU.
Parameters:
- address
: The starting memory address where the data should be written.
- size
: The amount of memory, in bytes, that will be overwritten.
- alfid
: is a parameter that denotes the dimensionality of the address and data block size length. It can assume values ranging from 0 to 4 for each digit, for example: 0x11, 0x21, 0x33, 0x42, 0x44, etc.
- data
: The data that needs to be written to the memory.
Returns:
A boolean indicating whether the write operation was successful (true
) or not (false
).
Usage Example | |
---|---|
Upload/download service
Function: RequestUpload
Description:
Initiates a request to upload a specific block of memory content from the ECU. This function helps facilitate the upload of data blocks, often necessary for tasks like firmware updates or data extraction.
Parameters:
- address
: The starting memory address from which the upload should begin.
- size
: The amount of memory, in bytes, to upload.
- alfid
: is a parameter that denotes the dimensionality of the address and data block size length. It can assume values ranging from 0 to 4 for each digit, for example: 0x11, 0x21, 0x33, 0x42, 0x44, etc.
- dfi
: Data Format Identifier, indicating the format or structure of the memory being requested.
Returns:
An array of bytes representing the acknowledgment or response from the ECU to the upload request. This often contains metadata about the upload process or the status of the request.
Usage Example | |
---|---|
Uploading Datasets
Function: UploadXmlDatasetFromContainer (Full Dataset)
bool UploadXmlDatasetFromContainer(string dataName, uint login = 0, string name = null, string version = null)
Description:
Uploads the full dataset stored in the container alongside the application.
Parameters:
- dataName
: The name of the dataset in the container.
- login
: Optional login ID for ECU authentication.
- name
: Optional name for the dataset.
- version
: Optional version for the dataset.
Usage Example | |
---|---|
Function: UploadXmlDatasetFromContainer (Specific Indexes)
bool UploadXmlDatasetFromContainer(string dataName, uint login = 0, string name = null, string version = null, params int[] indexes)
Description:
Uploads only specified addresses by indexes from the dataset stored in the container. You can get a list of addresses with indexes using the ListDatasetFromContainer()
procedure.
Parameters:
- dataName
: The name of the dataset in the container.
- login
: Optional login ID for ECU authentication.
- name
: Optional name for the dataset.
- version
: Optional version for the dataset.
- indexes
: Array of index values representing specific addresses to upload.
Usage Example | |
---|---|
Function: UploadXmlDatasetFromFile (Full Dataset)
bool UploadXmlDatasetFromFile(string fileName, uint login = 0, string name = null, string version = null)
Description:
Uploads the entire dataset from a file located in the same folder as the application.
Parameters:
- fileName
: Name of the file containing the dataset.
- login
: Optional login ID for ECU authentication.
- name
: Optional name for the dataset.
- version
: Optional version for the dataset.
Usage Example | |
---|---|
Function: UploadXmlDatasetFromFile (Specific Indexes)
bool UploadXmlDatasetFromFile(string fileName, uint login = 0, string name = null, string version = null, params int[] indexes)
Description:
Uploads only specified addresses by indexes from a dataset file located in the same directory as the application. You can get a list of addresses with indexes using the ListDatasetFromFile()
procedure.
Parameters:
- fileName
: Name of the file containing the dataset.
- login
: Optional login ID for ECU authentication.
- name
: Optional name for the dataset.
- version
: Optional version for the dataset.
- indexes
: Array of index values representing specific addresses to upload.
Usage Example | |
---|---|
Procedure: ListDatasetFromContainer
Description:
List all data sets available in the specified container.
Parameters:
- dataName
: The name of the data set container.
Usage Example | |
---|---|
Procedure: ListDatasetFromFile
Description:
List all data sets available in the specified file.
Parameters:
- fileName
: The name of the file that contains the data sets.
Usage Example | |
---|---|
Function: UploadDatasetGen1
bool UploadDatasetGen1(uint login, uint address, byte alfid, bool erase, byte[] data, bool restart = true, string name = "", string version = "")
Description:
Uploads a Generation 1 dataset using the provided parameters and dataset in the form of a byte array.
Parameters:
- login
: Login ID for ECU authentication.
- address
: Starting memory address.
- alfid
: is a parameter that denotes the dimensionality of the address and data block size length. It can assume values ranging from 0 to 4 for each digit, for example: 0x11, 0x21, 0x33, 0x42, 0x44, etc.
- erase
: Flag indicating whether to erase existing data.
- data
: Dataset in the form of a byte array.
- restart
: Optional flag to restart after upload.
- name
: Optional name for the dataset.
- version
: Optional version for the dataset.
Usage Example | |
---|---|
byte[] datasetData = GetDataBytesFromContainer("databytes.bin");
bool isSuccess = UploadDatasetGen1(12345, 0x2000, 0x44, true, datasetData);
PrintLine($"Upload Status: {isSuccess}");
Function: UploadDatasetGen2
bool UploadDatasetGen2(uint login, ushort address, byte[] data, bool restart = true, string name = "", string version = "")
Description:
Uploads a Generation 2 dataset.
Parameters:
- login
: Login ID for ECU authentication.
- address
: Starting memory address.
- data
: Dataset in the form of a byte array.
- restart
: Optional flag to restart after upload.
- name
: Optional name for the dataset.
- version
: Optional version for the dataset.
Usage Example | |
---|---|
byte[] datasetData = GetDataBytesFromContainer("databytes_gen2.bin");
bool isSuccess = UploadDatasetGen2(12345, 0x7202, datasetData);
PrintLine($"Upload Status: {isSuccess}");
Flashing
Function: GetFlashingResult
Description:
Retrieve a textual description of the flashing operation's outcome.
Return Value:
A string describing the flashing operation result.
Function: GetFlashingResultCode
Description:
Obtain a numerical code corresponding to the result of the flashing operation.
Return Value:
A byte representing the result code of the flashing operation.
Usage Example | |
---|---|
Code | Abbreviation | Description |
---|---|---|
0 | Successfull | The flashing process was successful |
1 | PreConditionsNotCorrect | Preconditions for flashing are not correct |
2 | WrongSecurityKey | The provided security key for flashing is wrong |
3 | SessionError | Error encountered during the session |
4 | SigningError | Error encountered during the signing process |
5 | DataBlockDownloadingError | Error encountered while downloading data blocks |
6 | ErasingRoutineError | Error encountered during the erasing routine |
7 | FinalizationError | Error encountered during finalization |
8 | FlashingContainerIsEmpty | The container for flashing is empty |
9 | ConnectionError | Error encountered with the connection |
10 | ErrorWritingFingerprint | Error encountered while writing the fingerprint |
11 | Timeout | The flashing process timed out |
12 | FunctionNotAssigned | The required function for flashing is not assigned |
13 | UpdateExecutionError | Error encountered during update execution |
14 | FdsWrongKey | The FDS key in container is wrong |
15 | NoResponseFromEcu | No response received from the ECU |
16 | UpdateExecutionPhase2Error | Error encountered during the second phase of update execution |
252 | IoError | Input/Output error |
253 | Cancelled | The flashing process was cancelled |
Function: PerformFlashFromContainer
Description:
Execute a flashing operation using a dataset stored in the container. The firmware procedure automatically turns on the working plate and displays the progress of the firmware process on the progress bar. Firmware containers of ODX, FRF and VCTF formats are supported.
Attention! Interface type checking is up to you! It is strongly not recommended to use the firmware functions of control units with ELM interfaces!
Parameters:
- name
: Name of the dataset in the container.
- checkBlockVersions
: (Optional) Flag to determine whether block versions should be checked before the operation. Default is true.
- silent
: (Optional) Flag to suppress any user prompts or notifications during the flashing process. Default is false.
Usage Example | |
---|---|
Function: PerformFlashFromFile
Description:
Execute a flashing operation using a dataset from a file. The firmware procedure automatically turns on the working plate and displays the progress of the firmware process on the progress bar. Firmware containers of ODX, FRF and VCTF formats are supported.
Attention! Interface type checking is up to you! It is strongly not recommended to use the firmware functions of control units with ELM interfaces!
Parameters:
- filename
: Name of the file containing the dataset.
- checkBlockVersions
: (Optional) Flag to determine whether block versions should be checked before the operation. Default is true.
- silent
: (Optional) Flag to suppress any user prompts or notifications during the flashing process. Default is false.
Usage Example | |
---|---|
Procedure: ListFlashDataBlocksFromContainer
Description:
List all flash data blocks available in the specified container.
Parameters:
- name
: The name of the container that contains the flash data blocks.
Usage Example | |
---|---|
Procedure: ListFlashDataBlocksFromFile
Description:
List all flash data blocks available in the specified file.
Parameters:
- filename
: The name of the file that contains the flash data blocks.
Usage Example | |
---|---|
SWaP/FoD
Function: EcuHasSwap
Description:
Check if the connected ECU supports the SWaP (Software as a Product) feature.
Return Value:
Returns true
if the ECU supports SWaP, otherwise false
.
Usage Example | |
---|---|
Function: CheckSwap
Description:
Check the SWaP status for a given FSID (Feature Set ID).
Parameters:
- fsid
: Feature Set ID to be checked.
- status
: Output parameter returning the status byte corresponding to the given FSID.
Return Value:
Returns true
if the FS ID code is unlocked, otherwise false
.
Usage Example | |
---|---|
Function: GetCompleteSwapList
Description:
Retrieves a complete list of swap codes, along with their descriptions and statuses.
Parameters:
None
Return Value:
Returns an array of tuples, where each tuple consists of a swap code, its description, and its status.
Usage Example | |
---|---|
Function: SendFscDataset
Description:
Send the FSC (Feature Set Code) dataset to the ECU and starts the activation process.
Parameters:
- dataset
: Byte array containing the FSC dataset.
Return Value:
Returns true
if the dataset was successfully sent, otherwise false
.