A method and system for multi-mode activation and reset of a diagnostic code reader
By employing a multi-mode activation and reset method for the diagnostic code reader, adaptive protocol identification and online/offline programming selection for the ECU are achieved, solving the problems of communication failure and cumbersome operation in existing technologies, and improving diagnostic efficiency and ECU security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-08
- Publication Date
- 2026-03-24
AI Technical Summary
Existing vehicle diagnostic code readers are prone to communication failures and ECU damage when faced with various communication protocols and unstable network environments. Their operation process is cumbersome and not intelligent enough.
By identifying the protocol type of the ECU response frame, reading the VIN code sequence, and performing seed key authentication, adaptive selection of online and offline programming modes is achieved. This is combined with multi-mode activation of the TPMS sensor and precise ECU positioning, including technologies such as adaptive protocol identification, seed key authentication, online and offline programming selection, and precise sensor positioning.
It effectively prevents ECU damage, improves diagnostic efficiency and operational intelligence, and ensures accurate positioning and successful communication in different maintenance scenarios.
Smart Images

Figure CN121501565B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of fault diagnosis, in particular to a multi-mode activation and reset method and system of a diagnostic code reader. BACKGROUND
[0002] When a vehicle after-sales maintenance diagnostic code reader performs protocol identification, an engineer manually selects a communication protocol type. When a vehicle ECU supports multiple protocols or adopts a new protocol such as CAN FD, manual judgment is prone to misselection, which leads to communication establishment failure and affects diagnostic efficiency. In the scene of ECU programming and TPMS sensor maintenance, the existing scheme processes programming operation and sensor activation as independent processes. An engineer needs to exit the programming session after completing ECU software flashing and then separately start TPMS maintenance mode, which is a cumbersome operation process and is prone to communication interruption due to improper session state switching. Moreover, the existing diagnostic device lacks the ability to adaptively select online or offline programming mode according to network environment and battery state. When the network is unstable or the voltage is insufficient, online programming is still forced to be performed, which leads to flashing failure. SUMMARY
[0003] The main purpose of the present application is to provide a multi-mode activation and reset method and system of a diagnostic code reader. The present application can effectively prevent ECU damage caused by flashing failure. Four modes of OBD duplication, activation duplication, automatic creation, and manual creation meet the needs of different maintenance scenes and realize accurate positioning of sensor wheel positions.
[0004] To achieve the above purpose, the present application provides a multi-mode activation and reset method of a diagnostic code reader, comprising the following steps:
[0005] Protocol type identification is performed on an ECU response frame, and a VIN code sequence is read;
[0006] Seed key authentication is performed based on the VIN code sequence, and a programming session state flag is returned;
[0007] Online programming mode or offline programming mode is selected according to the programming session state flag, and Flash writing is performed, and a programming completion flag is returned;
[0008] TPMS sensor activation and ID mapping table writing are performed based on the programming completion flag, and a writing confirmation flag of the ID mapping table is returned;
[0009] Fault code clearing, throttle learning value resetting, and clutch pressure calibration table resetting are performed according to the writing confirmation flag, and ECU hard reset is performed, and a reset completion flag is returned.
[0010] Optionally, in the first implementation manner of the first aspect, the protocol type identification of the ECU response frame and the reading of the VIN code sequence comprise:
[0011] sending a wake-up frame to the OBD interface and receiving an ECU response frame, and extracting a first byte of the ECU response frame as a protocol type identifier;
[0012] determining a protocol type according to the protocol type identifier, the protocol type being any one of an ISO 9141 protocol, a KWP2000 protocol or a CAN protocol;
[0013] setting a communication baud rate and a frame interval parameter according to the protocol type and returning a protocol configuration completion flag, and reading a VIN code sequence through a UDS diagnosis service according to the protocol configuration completion flag.
[0014] Optionally, in the second implementation manner of the first aspect, the seed key authentication based on the VIN code sequence and the return of a programming session state flag comprise:
[0015] extracting a year code and a vehicle description code in the VIN code sequence, and establishing a session state transition sequence of a basic diagnosis session, an extended diagnosis session and a programming session based on the year code and the vehicle description code;
[0016] sending a seed request service to the ECU to obtain a random seed sequence, extracting a manufacturer identification code from the VIN code sequence, performing a key operation on the random seed sequence according to the manufacturer identification code to obtain a key operation result;
[0017] sending the key operation result to the ECU to complete verification, and returning a key authentication completion flag;
[0018] sending a programming session request to the ECU according to the key authentication completion flag, receiving a programming session confirmation response returned by the ECU, and returning a programming session state flag.
[0019] Optionally, in the third implementation manner of the first aspect, the selection of an online programming mode or an offline programming mode according to the programming session state flag, the execution of Flash writing, and the return of a programming completion flag comprise:
[0020] reading a network connection state and a battery voltage according to the programming session state flag, and selecting the online programming mode or the offline programming mode according to the network connection state and the battery voltage;
[0021] When the online programming mode is selected, the calibration file is obtained from the cloud server and the file metadata is received, and when the offline programming mode is selected, the calibration file is read from the local storage path and the file metadata is obtained;
[0022] The file metadata is divided into multiple data blocks, a local hash value is calculated for each data block and accumulated into a global hash value;
[0023] The global hash value is compared with a target hash value in the file metadata for verification, and a file verification result is returned;
[0024] According to the file verification result, data blocks are cyclically written into the Flash memory of the ECU through the UDS request download service and the transmission service, the transmission exit service is sent, the ECU internal CRC verification program is triggered, a verification success response returned by the ECU is received, and a programming completion flag is obtained.
[0025] Optionally, in a fourth implementation manner of the first aspect of the present application, the data blocks are cyclically written into the Flash memory of the ECU according to the file verification result, the transmission exit service is sent, the ECU internal CRC verification program is triggered, a verification success response returned by the ECU is received, and a programming completion flag is obtained, including:
[0026] According to the file verification result, a request download service is sent to the ECU and carries a Flash starting address and a data total length parameter, and a block transmission configuration parameter is obtained;
[0027] According to the block transmission configuration parameter, a CRC verification value of each data block is calculated and sent to the ECU through the transmission service, and a data block transmission completion flag is returned;
[0028] According to the data block transmission completion flag, the transmission exit service is sent to the ECU, the ECU internal CRC verification program is triggered, and the CRC calculation is performed on the Flash region by the ECU and verified with the CRC verification value;
[0029] When the verification is consistent, a success response is received and a programming completion flag is returned, and when the verification is inconsistent, the ECU soft reset is triggered to load the backup program.
[0030] Optionally, in a fifth implementation manner of the first aspect of the present application, the TPMS sensor is activated and the ID mapping table is written based on the programming completion flag, and a write confirmation flag of the ID mapping table is returned, including:
[0031] According to the programming completion flag, a TPMS fault flag bit is read to determine whether sensor activation is required, a four-wheel sensor ID mapping table stored by an ECU is obtained through OBD reading service, a manufacturer code and a CRC check code of each ID are extracted to perform XOR operation to verify ID validity, and a known sensor list is obtained;
[0032] When the known sensor list is empty, an activation pulse sequence is sent to the tires to wake up the sensors, a programming frame is constructed and sent to the new sensor, and a sensor programming completion list is obtained;
[0033] According to the sensor programming completion list or the known sensor list, an ID mapping table write service is sent to the ECU, and a write confirmation flag of the ID mapping table is returned.
[0034] Optionally, in the sixth implementation manner of the first aspect of the present application, when the known sensor list is empty, an activation pulse sequence is sent to the tires to wake up the sensors, a programming frame is constructed and sent to the new sensor, and a sensor programming completion list is obtained, including:
[0035] When the known sensor list is empty, an activation pulse sequence is sent to each tire, data frames returned by the sensors are received, and sensor response data sets are obtained by decoding;
[0036] According to the sensor response data sets, receiving signal strength values corresponding to four-wheel antennas are measured, distance parameters of the sensors to each wheel position are calculated based on the receiving signal strength values, a wheel position corresponding to a minimum distance parameter is selected as an installation position of the new sensor, and an ID wheel position mapping table is obtained;
[0037] According to the ID wheel position mapping table, a programming frame is constructed, the programming frame is sent to the new sensor, a confirmation frame returned by the new sensor is received, and a sensor programming completion list is obtained.
[0038] Optionally, in the seventh implementation manner of the first aspect of the present application, according to the write confirmation flag, fault code clearing and throttle learning value and clutch pressure calibration table resetting and ECU hard resetting are performed, and a reset completion flag is returned, including:
[0039] According to the write confirmation flag, a fault code clearing service is sent to the ECU to clear all diagnostic fault codes, a fault indicator light lighting counter zero service is synchronously sent to clear the MIL light counter register, and a clearing completion flag is returned;
[0040] According to the clearing completion flag, whether the throttle and the clutch need to be reset is determined, and a learning completion flag is returned;
[0041] According to the learning completion flag, a hard reset service trigger is sent to the ECU, the ECU closes the peripheral device, empties the RAM and reloads the Flash program, the heart beat frame is continuously sent at a fixed time interval, the ECU restores the state, and when the heart beat response frame returned by the ECU is received, the reset completion flag is returned.
[0042] Optionally, in the eighth implementation form of the first aspect of the present application, the judging whether the throttle valve and the clutch need to be reset according to the clearing completion flag and returning the learning completion flag comprises:
[0043] According to the clearing completion flag, the opening difference value of the throttle valve is calculated, when the opening difference value exceeds the opening threshold value, the offset value zero clearing service and the self-learning starting service are sent, the ECU performs the full stroke movement of the throttle valve to complete the zero point calibration and returns the throttle valve completion flag;
[0044] According to the clearing completion flag, the pressure difference value between the theoretical pressure value of the clutch and the measured pressure value is calculated, when the pressure difference value exceeds the pressure threshold value, the default calibration table writing service and the adaptive learning starting service are sent, the ECU performs the multi-speed point cycle measurement to update the calibration table and returns the clutch completion flag;
[0045] When the throttle valve completion flag and the clutch completion flag are both true values, the learning completion flag is returned.
[0046] The present application also provides a multi-mode activation and reset system of a diagnostic code reader, comprising:
[0047] An identification module is configured to identify the protocol type of the ECU response frame and read the VIN code sequence;
[0048] An authentication module is configured to perform seed key authentication based on the VIN code sequence and return a programming session state flag;
[0049] A selection module is configured to select the online programming mode or the offline programming mode according to the programming session state flag, perform Flash writing and return a programming completion flag;
[0050] An activation module is configured to perform TPMS sensor activation and ID mapping table writing based on the programming completion flag and return a writing confirmation flag of the ID mapping table;
[0051] A reset module is configured to perform fault code clearing and throttle valve learning value and clutch pressure calibration table resetting according to the writing confirmation flag and perform ECU hard reset, and return a reset completion flag.
[0052] In summary, the application constructs a VIN intelligent positioning driven protocol adaptive identification mechanism, the diagnostic code reader automatically determines the ISO 9141, KWP2000 or CAN protocol type according to the first byte of the ECU response frame and further detects the CAN FD capability for the CAN protocol, avoids the communication failure caused by manual selection of the protocol, and ensures the accuracy of vehicle identity recognition by performing weighted summation modulo check algorithm on the VIN code sequence. The three-layer state machine architecture is established to realize the standardized switching of the basic diagnostic session, the extended diagnostic session and the programming session, the seed key authentication is performed by querying the key algorithm table according to the manufacturer identification code in the VIN code, and the safe entry of the programming session is ensured. The online and offline dual-mode programming adaptive selection mechanism dynamically decides the programming mode according to the network connection state, signal strength and battery voltage parameters, performs block hash check and Flash area CRC check on the calibration file, automatically triggers ECU soft reset to load the backup program when the check fails, and effectively prevents ECU damage caused by flashing failure. The TPMS four-mode sensor activation scheme of the application meets the needs of different maintenance scenes through four modes of OBD copy, activation copy, automatic creation and manual creation, and realizes accurate positioning of the sensor wheel position. BRIEF DESCRIPTION OF DRAWINGS
[0053] Figure 1 is a multi-mode activation and reset method steps schematic diagram of the diagnostic code reader in an embodiment of the application;
[0054] Figure 2 is a multi-mode activation and reset system structure block diagram of the diagnostic code reader in an embodiment of the application.
[0055] The implementation, functional features and advantages of the application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical scheme and advantages of the application more clear, the application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the application and do not limit the application.
[0057] With reference to Figure 1 , the embodiment provides a multi-mode activation and reset method of a diagnostic code reader, including the following steps:
[0058] S1, protocol type identification is performed on the ECU response frame and the VIN code sequence is read;
[0059] In this embodiment, the VCI module of the diagnostic code reader sends a set of preset format general wake-up frames to the OBD diagnostic interface of the vehicle, wherein the frame ID is set to 0x7DF, the data field is configured as a three-byte sequence [0x02, 0x09, 0x02], to wake up the ECU of the vehicle and request it to return a communication response. After sending the wake-up frame, the VCI module enters a preset 200 ms receiving window, listens to and receives the response frame returned by the ECU, and extracts the first byte content in the data area of the response frame as the protocol type identification field, i.e. the protocol type identifier. The diagnostic code reader determines the protocol type according to the value range of the protocol type identifier: when the value of the protocol identifier is equal to 0x41, it is determined that the communication protocol is the ISO 9141 protocol, the communication baud rate is configured to 10.4 kbit / s and the frame interval is set to 5 ms; when the identifier is equal to 0x83, it is determined that the protocol type is the KWP2000 protocol, and the baud rate is also set to 10.4 kbit / s but the frame interval is extended to 55 ms; when the identifier value is greater than or equal to 0xC0, it is determined that the communication protocol is the CAN protocol, and enters the CAN FD capability detection stage, and detects whether the ECU supports the CAN FD protocol by sending an extended frame with a frame ID of 0x18DAF110 and a data length of 64 bytes. If the ECU responds to the extended frame, it is confirmed as the CAN FD protocol and the arbitration segment baud rate is set to 500 kbit / s and the data segment baud rate is set to 2 Mbit / s; if there is no response, it is rolled back to the standard CAN protocol and the baud rate is fixed to 500 kbit / s. After completing the adaptive configuration of the communication parameters, the diagnostic code reader returns a protocol configuration completion flag, and starts the UDS diagnostic service 0x09 0x02 instruction according to the flag, requests the ECU to read a 17-byte VIN code sequence, and then completes the intelligent identification of the vehicle identification code.
[0060] S2, seed key authentication based on the VIN code sequence, return programming session status flag;
[0061] In this embodiment, the diagnostic code reader extracts the 10th character from the VIN code sequence as the Year_code and the 4th to 8th characters as the Vehicle Description Code (VDS), and judges the vehicle type and the era generation through the two fields, executes the built-in mode activation priority judgment function to establish a multi-level diagnostic state machine. In the multi-level diagnostic state machine, the state jump process from the default diagnostic session (State_diag) to the extended diagnostic session (State_extend) and then to the programming session (State_program) is executed in turn, each level of state needs to interact with the ECU and respond to the instruction confirmation, and the current state flag is recorded for legality verification and process backtracking mechanism. After entering the extended session, the diagnostic code reader sends the UDS 0x27 0x01 service instruction to the ECU to request the seed value, and the ECU returns a four-byte random seed sequence Seed=[S1, S2, S3, S4]. The diagnostic code reader extracts the first three characters from the VIN code as the WMI manufacturer identification code, and determines the key operation model to be used according to the WMI value from the preset key algorithm lookup table. For example, when WMI is WVW, Volkswagen algorithm is executed, when WMI is JTD, Toyota algorithm is executed, and when WMI is 1GC, General Motors algorithm is executed. According to the selected algorithm, the seed sequence Seed is executed for non-linear or exclusive or combination key calculation, and the key operation result Key is obtained. The diagnostic code reader sends Key to the ECU for authentication verification through the UDS 0x27 0x02 service, and if the ECU returns the confirmation frame 0x67 0x02, it is considered that the key verification is successful, and the authentication success flag is set. After the key authentication completion flag is set to true, the diagnostic code reader sends the UDS 0x10 0x02 service request to enter the programming session, and the ECU returns the confirmation response frame 0x50 0x02, which indicates that the programming session is started successfully. At this time, the system internal state flag variable is updated to State_program=0x02, indicating that the current has entered the highest authority state of executable Flash data writing and parameter configuration and other programming functions.
[0062] S3, selecting online programming mode or offline programming mode according to the programming session state flag, and executing Flash writing, returning a programming completion flag;
[0063] In this embodiment, the Network_status field recorded in the network status register and the Battery_voltage value returned by the battery voltage sampling module are read according to the current State_program flag, and the programming adaptation path is jointly judged according to the two. When it is detected that the network connection state is "WiFi connected", the signal strength RSSI is higher than -65dBm, and the battery voltage is greater than 13.0V, the diagnostic code reader enters the online programming mode preferentially; if the above online programming conditions are not met, but there is a calibration file in the local storage path / storage / calib / that matches the first 11 bits of the VIN code, and the battery voltage is higher than 12.5V, then switch to offline programming mode. In online mode, the diagnostic code reader sends a parameter URL containing the VIN code and ECU address to the cloud server by constructing an HTTPS request, requesting the calibration file of the corresponding ECU. The server returns file metadata including file size, total number of blocks, and SHA256 hash value, and the diagnostic code reader allocates Flash_buffer in the local memory for data reception accordingly. The diagnostic code reader downloads the file in blocks of 256 bytes, and performs local hash operation Hash_i=SHA256(Block_i) on each Block_i, and updates Hash_i in sequence with the historical hash variable Hash_global to form the global hash value through Hash_global=SHA256(Hash_global||Hash_i). If offline mode is selected, the diagnostic code reader directly loads the corresponding calibration file from the local path / storage / calib / {VIN} / ecu_{address}.bin, reads the Flash_start_addr, Data_length and CRC32_target fields in the header, and divides the file into data blocks of the same size as in online mode. After all data blocks are downloaded or read, the diagnostic code reader compares the calculated Hash_global with the target hash value hash_sha256 provided in the file metadata for consistency. When the comparison is completely consistent, it is confirmed that the file integrity verification is passed, and the positive verification result is returned and the Flash writing stage is entered. The diagnostic code reader initiates the download by requesting the UDS 0x34 service, carrying the Flash start address and total data length parameters, and enters the transmission cycle stage after the ECU confirms. For each block of data, the diagnostic code reader first performs CRC32 check to obtain CRC_block, and then sends the data block in block_seq order through the UDS 0x36 service. The ECU returns a 0x76 response frame for each successfully received block.If any data block transmission fails and the number of consecutive retransmissions exceeds 3 times, the block is marked as a non-writable area and recorded to the Bad_block_list. After all data block transmissions are completed, the diagnostic code reader sends the UDS 0x37 instruction to exit the transmission state, and triggers the ECU internal CRC checking logic through the UDS 0x31 service, and the ECU performs full segment CRC32 calculation on the Flash written area and compares it with the original file CRC32_target. If 0x71 is returned, it indicates that the verification is successful, that is, the programming completion flag is set to true.
[0064] S4, based on the programming completion flag, activating the TPMS sensor and writing the ID mapping table, and returning a write confirmation flag of the ID mapping table;
[0065] In this embodiment, the TPMS fault flag register is read by the UDS 0x22 0xF4 0x0D service, and the value of bit 7 in the returned data is checked. If the value is 1, it is determined that the current TPMS system has a sensor fault, and the sensor activation and ID mapping table reconstruction operations are performed. The diagnostic code reader calls the UDS 0x22 0xF4 0x40 service through OBD to obtain the four-wheel TPMS sensor ID mapping table stored in the ECU. The mapping table contains four 32-bit sensor IDs, corresponding to the left front wheel, right front wheel, left rear wheel, and right rear wheel, respectively. The highest byte of each sensor ID is extracted as the manufacturer code Manufacturer_code, and the lowest byte is extracted as the CRC check code CRC_byte. The middle three bytes (bits 8~31) are subjected to a preset XOR operation, i.e. CRC_calc = (ID>>8) ⊕ ((ID>>16)&0xFF) ⊕ ((ID>>24)&0xFF). If CRC_calc is equal to CRC_byte, the ID is considered valid and is added to the known sensor list. If the known sensor list is empty, it means that the vehicle has not obtained any valid sensor ID through OBD, and the low-frequency activation copy or automatic creation mode is switched to. A 125kHz activation pulse sequence is sent to each tire area in turn, with pulse parameters including width 20ms, interval 5ms, and repetition 8 times, to wake up the sensors in sleep state. After activation, the sensors send data frames containing ID, pressure, temperature, battery level, etc. through 433MHz (European standard) or 315MHz (American standard) frequency band. The diagnostic code reader decodes the data frame through its integrated radio frequency receiving module, extracts the sensor ID, and performs signal attenuation distance calculation combined with the received signal strength indication RSSI to locate the wheel position, and writes the (ID, wheel position) pair into the sensor programming completion list Copy_list. The diagnostic code reader selects the corresponding four valid IDs from Copy_list or Known_list according to the priority logic, reconstructs the complete ID mapping table in the order of left front, right front, left rear, and right rear, and writes the mapping table into the ECU using the UDS 0x2F 0xF4 0x40 service, with the control byte set to 0x03 indicating the forced overwrite mode. The ECU returns a 0x6F 0xF4 0x40 response frame after successfully processing the write request, and the diagnostic code reader sets the ID write confirmation flag to true accordingly.
[0066] S5, according to the write confirmation flag, the fault code is cleared and the throttle learning value and clutch pressure calibration table are reset, and the ECU is hard reset, returning a reset completion flag.
[0067] In this embodiment, according to the write confirmation flag, the UDS 0x140xFF 0xFF 0xFF instruction is sent to the ECU to clear all diagnostic fault codes of the vehicle, the UDS 0x2F 0x02 0x0E 0x00 instruction is sent synchronously to clear the lighting counter of the malfunction indicator lamp MIL lamp, to ensure that the fault lamp is extinguished, and the clear completion flag is set to true after receiving the 0x54 and 0x6F response frames returned by the ECU. The diagnostic code reader determines whether the adaptive parameter reset of the throttle system and the clutch pressure control system is needed according to the fault code clear completion flag. For the throttle system, the current throttle opening and its learning offset value Offset_learned are read through the UDS 0x220xF1 0x91, the target factory opening Angle_target is set to 7.5°, and the current deviation Δ = Angle_current - Angle_target is calculated. When the absolute value of the deviation exceeds 0.5°, it is determined that the reset is needed, and then the Offset_learned is cleared to 0 through the UDS 0x2E service, and then the UDS 0x310x01 0x0E 0x01 instruction is sent to start the throttle self-learning program, and the ECU controls the throttle to perform a mechanical scan from full closing to full opening and calibrate the zero point. After completion, the confirmation frame is returned, that is, the Throttle_learned_flag is set to 1. For the clutch pressure control system, the diagnostic code reader reads the current 12-point pressure calibration table and the measured pressure value through the UDS 0x220xF1 0xA2, calculates the expected pressure based on the interpolation algorithm, and compares it with the measured value. If the deviation exceeds 0.3 bar, it is considered that the reset is needed, then the factory default pressure control point is written into the ECU through the UDS 0x2E service, and the clutch learning program is started through the UDS 0x310x01 0x0E 0x02, and the ECU controls the clutch to cycle engagement and separation at different speeds, a total of 50 times, to update the calibration curve. After completion, the Clutch_learned_flag is set to 1. After detecting that the Throttle_learned_flag and the Clutch_learned_flag are both 1, the diagnostic code reader sends the UDS 0x110x01 instruction to the ECU to issue a hard reset request, so that the ECU closes the peripheral interface, clears the RAM and reloads the control program in the Flash, and in this process, the UDS 0x3E 0x00 heartbeat frame is continuously sent at a fixed interval of 2 seconds to monitor its recovery state. When the 0x7E 0x00 heartbeat response frame returned by the ECU is received, it is confirmed that the ECU has been successfully recovered, and the diagnostic code reader sets the reset completion flag to true accordingly.
[0068] In one example, the protocol type of the ECU response frame is identified and the VIN code sequence is read, including:
[0069] sending a wake-up frame to the OBD interface and receiving an ECU response frame, extracting a first byte of the ECU response frame as a protocol type identifier;
[0070] determining a protocol type according to the protocol type identifier, the protocol type being any one of an ISO 9141 protocol, a KWP2000 protocol or a CAN protocol;
[0071] setting communication baud rate and frame interval parameters according to the protocol type and returning a protocol configuration completion flag, and reading a VIN code sequence through a UDS diagnostic service according to the protocol configuration completion flag.
[0072] In this example, the diagnostic code reader establishes a physical connection with the vehicle OBD-II interface through its VCI module, and sends a standard format of general wake-up frame to the interface according to the preset communication wake-up process, the frame ID of the wake-up frame is set to 0x7DF, and the data field consists of a three-byte sequence [0x02, 0x09, 0x02], which functions to wake up the vehicle-mounted ECU and trigger its response signal returning the current communication protocol environment. After sending the wake-up frame, the diagnostic code reader enters a 200 ms listening window, and receives the response frame information from the ECU within the time period. The first byte of the data area of the response frame is extracted as the core parameter for identifying the communication protocol type, i.e. the protocol type identifier. The diagnostic code reader executes the protocol determination logic according to the value range of the identifier: when the first byte value is equal to 0x41, it is determined that the current communication uses the ISO9141 protocol, and the communication baud rate is set to 10.4 kbit / s, and the frame interval is set to 5 ms; if the first byte is equal to 0x83, it is determined as KWP2000 protocol, and the baud rate is set to 10.4 kbit / s but the frame interval is extended to 55 ms; if the first byte value is greater than or equal to 0xC0, it is determined as a CAN protocol environment, and further sends a CAN extended frame with frame ID 0x18DAF110 and data length code DLC of 64 bytes to the ECU to detect whether it supports CAN FD protocol, if the ECU returns a response to this extended frame, the communication configuration is set to the CAN FD composite parameters of 500 kbit / s arbitration segment and 2 Mbit / s data segment, otherwise it is rolled back to the standard CAN protocol and uses a fixed baud rate of 500 kbit / s. After the above communication parameter setting is completed, the diagnostic code reader generates a protocol configuration completion flag internally, and calls the 0x09 0x02 service command in the UDS protocol to initiate a VIN code reading request to the ECU. The ECU returns the vehicle identification code in the format of a 17-byte data sequence, and the diagnostic code reader performs a legality check on the complete VIN code after receiving it, extracts the 9th bit as a check bit and generates a check value through a weighted sum with a weight modulo 11 algorithm, and compares it with the check bit in the original VIN, if they are consistent, it is confirmed that the VIN code is valid and is written into the memory buffer VIN_buffer.
[0073] The process of reading the VIN code sequence via the UDS diagnostic service according to the configuration completion flag includes: when the UDS diagnostic service fails to read the VIN code sequence, starting the lens scanning mode, acquiring the VIN nameplate image through the diagnostic tablet camera and performing grayscale processing on the image, calculating the grayscale value of each pixel as the weighted sum of the red channel multiplied by the first weight coefficient, the green channel multiplied by the second weight coefficient, and the blue channel multiplied by the third weight coefficient, to obtain a grayscale image; calculating the gradient values in the horizontal and vertical directions of the grayscale image, calculating the gradient magnitude of each pixel as the square root of the sum of the squares of the horizontal gradient and the squares of the vertical gradient, marking the pixel as an edge pixel when the gradient magnitude exceeds the edge detection threshold, connecting the edge pixels to form the character region boundary, segmenting multiple independent character regions to obtain the character segmentation result; normalizing each character region in the character segmentation result into a standard-sized pixel matrix, and calculating the phase difference with multiple character templates in the pre-stored character template library. The correlation coefficient is calculated by dividing the sum of the products of the pixel values in the character region and the template pixel values by the square root of the product of the squares of the pixel values in the character region and the squares of the template pixel values. The template character corresponding to the maximum correlation coefficient is selected as the recognition result. When the maximum correlation coefficient is lower than the confidence threshold, the character is marked as a low-confidence character and the engineer is prompted to confirm manually to obtain the lens scan recognition result. When the lens scan recognition result contains low-confidence characters or the lens scan fails, the manual input mode is activated. After the engineer inputs the VIN character digit by digit, the manufacturer identification code of the input VIN code is extracted and verified by querying the pre-stored manufacturer code table. The year code of the input VIN code is extracted and its legality is verified according to the encoding rules. The check digit of the input VIN code is extracted and a weighted sum modulo division verification algorithm is performed on the entire VIN code sequence. When the manufacturer identification code, the year code, and the check digit are verified, the input VIN code is stored in the VIN code buffer.
[0074] In one example, seed key authentication is performed based on the VIN code sequence, returning programming session status flags, including:
[0075] Extract the year code and vehicle description code from the VIN code sequence, and establish a session state transition sequence for the basic diagnostic session, extended diagnostic session, and programming session based on the year code and vehicle description code;
[0076] Send a seed request service to the ECU to obtain a random seed sequence, extract the manufacturer identification code from the VIN code sequence, and perform key operations on the random seed sequence based on the manufacturer identification code to obtain the key operation result;
[0077] The key calculation result is sent to the ECU to complete the verification, and a key authentication completion flag is returned.
[0078] Based on the key authentication completion flag, a programming session request is sent to the ECU, a programming session confirmation response is received from the ECU, and a programming session status flag is returned.
[0079] In this example, the diagnostic code reader extracts the 10th character from the successfully read and verified 17-bit VIN code sequence as the year code (Year_code), and simultaneously extracts the 4th to 8th characters as the vehicle description code (VDS). Combining these two fields, a preset mode activation priority function determines whether to enable advanced programming capabilities. Specifically, when the character value of the year code is greater than or equal to the character 'K' and the vehicle description code contains an identifier character representing new energy characteristics (such as "E" for hybrid power and "H" for pure electric drive), the vehicle is determined to be a newer generation of new energy vehicle, and the mode priority flag is set to 1, prioritizing entry into the online programming scenario; otherwise, it is set to 0, supporting only the traditional offline mode. According to the priority, the diagnostic code reader sequentially sends the UDS 0x10 0x01 command to the ECU to enter the default diagnostic session. After receiving the 0x50 0x01 response, it continues to send the UDS 0x10 0x03 command to request an extended session, and after receiving the 0x50 0x03 response, it sets the current session state to extended diagnostic state. In extended mode, a security seed is requested from the ECU via the UDS 0x27 0x01 command. The ECU returns a seed sequence containing four bytes of random numbers: Seed=[S1, S2, S3, S4]. The diagnostic code reader then extracts the first three characters from the VIN code as the World Manufacturer Identifier (WMI) and retrieves the corresponding key algorithm function from its locally pre-configured key algorithm table. For example, when WMI equals "WVW," it indicates the Volkswagen brand, using an XOR and bitwise shift encryption formula; when it is "JTD," it indicates Toyota, using a mixed addition, subtraction, and multiplication algorithm; and when it is "1GC," it matches General Motors, using byte concatenation and addition algorithms. The diagnostic code reader converts the seed sequence into a 16-bit key based on the corresponding WMI algorithm and sends the key to the ECU for verification via the UDS 0x27 0x02 service. If the ECU returns a 0x67 0x02 response frame, it indicates successful key authentication, and the system sets the authentication completion flag to true. After key authentication is complete, the diagnostic code reader immediately sends a UDS 0x10 0x02 service request to the ECU to enter the programming session. If the ECU returns an acknowledgment frame of 0x50 0x02, the current session state flag is set to State_program=0x02, indicating that the programming state with write permissions has been securely entered. At this time, the diagnostic code reader records the current state to the session state buffer and generates a log entry.
[0080] In the method, the CRC check value of each data block is calculated according to the block transmission configuration parameter and sent to the ECU through the transmission service, and a data block transmission completion flag is returned, and the method further comprises: initializing the retransmission queue as an empty queue and initializing the retransmission counter of each data block as zero, sequentially sending each data block to the Flash memory of the ECU through the transmission service according to the data block index order, calculating the CRC check value of each data block as a transmission integrity verification identifier before sending each data block, and obtaining a data block sending sequence; during the transmission of the data block sending sequence, when a transmission failure negative response returned by the ECU is received, the failure data block index in the negative response is extracted, the failure data block index is added to the tail of the retransmission queue, and the retransmission counter corresponding to the failure data block index is incremented by one, so as to obtain an updated retransmission queue and retransmission counter state; after the first transmission of all data blocks is completed, the failure data block index is sequentially taken out from the head of the retransmission queue, the retransmission counter value corresponding to the failure data block index is read, when the retransmission counter value is less than or equal to the maximum retransmission number threshold, the data block is retransmitted and an ECU confirmation response is waited for, if a transmission failure negative response is received again, the failure data block index is added to the tail of the retransmission queue again and the retransmission counter is incremented again, if a transmission success positive response is received, the data block index is removed from the retransmission queue, and a retransmission processing result is obtained; for the remaining failure data block indexes in the retransmission queue, it is judged whether the retransmission counter value corresponding to each failure data block index exceeds the maximum retransmission number threshold, when the maximum retransmission number threshold is exceeded, the data block index is marked as a bad block, the Flash physical address corresponding to the bad block is extracted and recorded to a bad block address list, and the bad block information including the data block index, the Flash address and the retransmission failure number is recorded in an abnormal log buffer, and when the retransmission queue is empty or all over-limit data blocks are marked as bad blocks, a data block transmission completion flag is returned.
[0081] In one example, an online programming mode or an offline programming mode is selected according to the programming session state flag, and a Flash write is performed, and a programming completion flag is returned, comprising:
[0082] The network connection state and the battery voltage are read according to the programming session state flag, and the online programming mode or the offline programming mode is selected according to the network connection state and the battery voltage;
[0083] When the online programming mode is selected, the calibration file is obtained from the cloud server and the file metadata is received, and when the offline programming mode is selected, the calibration file is read from a local storage path, and the file metadata is obtained;
[0084] The file metadata is divided into a plurality of data blocks, a local hash value of each data block is calculated and accumulated to a global hash value;
[0085] The global hash value is compared with the target hash value in the file metadata to return a file verification result;
[0086] According to the file verification result, data blocks are written into the Flash memory of the ECU in a loop through the UDS request download service and the transmission service, the transmission exit service is sent, the ECU internal CRC verification program is triggered, a verification success response returned by the ECU is received, and a programming completion flag is obtained.
[0087] In this example, the diagnostic code reader reads the Network_status field in the network status register and the Battery_voltage value in the battery voltage sampling register after entering the programming session state, and judges whether the conditions for online programming are met according to the above, including the WiFi connection state, the RSSI signal strength higher than -65dBm, and the battery voltage higher than 13.0V. If all the above conditions are met, the online programming mode is preferentially selected; otherwise, if there is a calibration file in the local path / storage / calib / that matches the first 11 bits of the VIN code, and the battery voltage is greater than 12.5V, the offline programming mode is selected. In the case of selecting the online programming mode, the diagnostic code reader constructs the HTTPS request URL, accesses the cloud server interface and attaches the VIN code and ECU address as query parameters, the server returns the metadata information of the target calibration file, including file_size (total byte number), block_count (data block number) and hash_sha256 (SHA256 digest value), the diagnostic code reader allocates the Flash_buffer storage area according to the above, and downloads the file data in blocks of 256 bytes. After receiving each data block Block_i, the SHA256 operation is performed to obtain the local hash value Hash_i, and the global hash value Hash_global is updated in the manner of Hash_global = SHA256(Hash_global || Hash_i). If the offline programming mode is selected, the calibration file is read from the local path / storage / calib / {VIN} / ecu_{address}.bin, the parameters such as Flash_start_addr, Data_length, CRC32_target are extracted from the header field, and the data content is divided into blocks and Hash_global is calculated in the same way. When all the data blocks are processed, the diagnostic code reader compares the Hash_global calculated locally with the hash_sha256 value provided in the cloud or local file metadata, and when they are completely consistent, it is considered that the file data integrity verification is successful, the file verification result is true, and the UDS 0x34 download service request is started, the starting address and total data length of the Flash write are sent, and the ECU returns 0x74 response to enter the block transmission stage. The diagnostic code reader performs CRC32 check calculation on each block of data in the order of block_seq and sends it to the ECU through the UDS 0x36 service, and the ECU returns 0x76 confirmation frame after each block is successfully received, if it fails, the block number is added to Retry_queue for retransmission three times, and if it exceeds the threshold, it is marked as a bad block.After all the blocks are transmitted, the UDS 0x37 service is used to exit the transmission state, and the ECU is triggered to perform a CRC check process of the Flash area using the UDS 0x31 service instruction. After the ECU compares the calculated CRC value with the target value of the file, a 0x71 response flag is returned to indicate that the programming is successful. Accordingly, the diagnostic code reader sets a programming completion flag.
[0088] In one example, the data blocks are written into the Flash memory of the ECU according to the file check result. After the transmission exit service is sent, the ECU internal CRC check program is triggered, and a check success response returned by the ECU is received to obtain a programming completion flag, including:
[0089] According to the file check result, a request download service is sent to the ECU, and a Flash starting address and a data total length parameter are carried to obtain block transmission configuration parameters;
[0090] According to the block transmission configuration parameters, a CRC check value of each data block is calculated and transmitted to the ECU through a transmission service to return a data block transmission completion flag;
[0091] According to the data block transmission completion flag, a transmission exit service is sent to the ECU to trigger the ECU internal CRC check program, and the ECU performs a CRC calculation on the Flash area and checks the CRC check value;
[0092] When the check is consistent, a success response is received and a programming completion flag is returned, and when the check is inconsistent, the ECU is triggered to perform a soft reset to load a backup program.
[0093] In this example, the data packet of the request download service is constructed based on the file check result, and the starting address of the target Flash write operation and the total length of the entire data are attached. The request is sent to the ECU through the UDS protocol. The ECU returns a set of block transmission configuration parameters after analyzing the request, including the maximum length of a single block, the transmission rate limit, and the maximum number of allowed continuous transmissions. The diagnostic code reader performs block processing on the file metadata to be written according to the set of block transmission configuration parameters, calculates the CRC check value of each data block, and constructs the transmission service frame by block to send to the ECU. After each data block transmission is completed, the state word returned by the ECU is used to determine whether the data block transmission completion flag is received. When all data blocks are successfully transmitted and the flag is confirmed, the transmission exit service instruction is sent to the ECU. After receiving the instruction, the ECU automatically triggers the internal preset CRC check subroutine to perform integrity calculation on all data in the written Flash area, and compares the obtained CRC value with the target CRC check value recorded in the file metadata bit by bit. When the comparison result is consistent, it indicates that the Flash written data is complete and has not been disturbed. The ECU returns a response frame indicating programming success, and the diagnostic code reader generates a programming completion flag based on this, marking the end of the entire programming process. When the comparison result is inconsistent, it is determined that the current Flash data has a write error or is disturbed. The system issues a soft reset instruction to the ECU to instruct the ECU to abort the current program and load the preset safety backup program, ensuring the stable operation of the ECU system and providing a recovery entry for repair, thereby completing fault tolerance protection in abnormal situations.
[0094] In one example, based on the programming completion flag, the TPMS sensor is activated and the ID mapping table is written. The write confirmation flag of the ID mapping table is returned, including:
[0095] According to the programming completion flag, the TPMS fault flag bit is read to determine whether the sensor needs to be activated. The four-wheel sensor ID mapping table stored in the ECU is obtained through the OBD read service. The manufacturer code and CRC check code of each ID are extracted to perform XOR operation to verify the validity of the ID, and the known sensor list is obtained;
[0096] When the known sensor list is empty, an activation pulse sequence is sent to the tire to wake up the sensor. The programming frame is constructed and sent to the new sensor to obtain the sensor programming completion list.
[0097] According to the sensor programming completion list or the known sensor list, the ID mapping table write service is sent to the ECU, and the write confirmation flag of the ID mapping table is returned.
[0098] In this example, after the diagnostic code reader completes the Flash programming operation and obtains the programming completion flag, the TPMS fault related status flag bit is read to determine whether the current vehicle has a fault state of the tire pressure monitoring system. If the fault flag bit is in an abnormal state, the sensor activation process is started. After entering the sensor activation process, a standard read service request is initiated to the ECU through the OBD communication interface to obtain the TPMS four-wheel sensor ID mapping table data currently stored by the ECU. Each ID is composed of multiple fields, including a unique identification code, a manufacturer identification code (manufacturer code), and a redundancy check field such as a CRC check code. Perform field parsing operation on each sensor ID to extract the manufacturer code and CRC check code, and verify the redundancy consistency of the two fields by performing bitwise XOR operation to determine whether the ID is valid. When all the parsed and verified valid sensor sets form a known sensor list, it is determined whether new sensor activation is needed based on the known sensor list. If the known sensor list is empty, it is determined that the current vehicle is not configured with valid sensors, and the TPMS activation module is controlled to send a high-frequency activation pulse signal to the tire surrounding area. The high-frequency activation pulse signal is designed according to a specific modulation timing rule to wake up the tire pressure sensor in sleep state. The sensor receives the valid wake-up pulse and enters the response state, builds a programming frame containing manufacturer authorization information, current VIN code mapping field and logical position information, and sends it to the activated sensor through wireless radio frequency. After each sensor receives the programming frame and completes local parameter configuration and ID binding, it actively returns a programming completion confirmation signal. The system receives responses from all sensors and forms a sensor programming completion list. According to the sensor programming completion list or the known sensor list, an ID mapping table is constructed in a unified format and written into a data frame, and a TPMS ID mapping write service is initiated to the ECU. After writing is completed, the ECU returns a mapping write confirmation flag.
[0099] In one example, when the known sensor list is empty, an activation pulse sequence is sent to the tire to wake up the sensor, a programming frame is built and sent to the new sensor, and a sensor programming completion list is obtained, including:
[0100] When the known sensor list is empty, an activation pulse sequence is sent to each tire, and a data frame returned by the sensor is received and decoded to obtain a sensor response data set;
[0101] According to the sensor response data set, the received signal strength values corresponding to the four-wheel antennas are measured, the distance parameters of the sensors to each wheel position are calculated based on the received signal strength values, the wheel position corresponding to the minimum distance parameter is selected as the installation position of the new sensor, and an ID wheel position mapping table is obtained;
[0102] According to the ID wheel position mapping table, a programming frame is constructed, the programming frame is sent to the new sensor, an acknowledgement frame returned by the new sensor is received, and a sensor programming completion list is obtained.
[0103] In this example, when it is detected that the four-tire pressure monitoring sensor ID mapping table stored in the current ECU is empty, that is, the effective wheel position and sensor ID correspondence relationship has not been established, the activation operation of the full wheel position is triggered. Through the diagnostic code reader, preset format activation pulse sequences are sent to the TPMS sensors installed at the four tire mounting positions of the vehicle, and the activation signals are sent through the low-frequency communication antenna to wake up the sensors in the dormant state. After responding to the activation instruction, the TPMS sensors package the identification ID, transmission frequency, tire pressure value, temperature data and other information stored in the internal storage to generate a response data frame, and return it to the receiving module of the diagnostic code reader through the radio frequency channel. The reader decodes and analyzes the response data frame received by each antenna module to form a response data set containing the original information of each sensor, and records the received signal strength RSSI value detected by the corresponding receiving antenna port for each response data. On this basis, combined with the radio frequency propagation model or empirical formula, the received signal strength is converted into a rough estimated transmission distance to obtain a distance parameter matrix between the sensor and each wheel position antenna. By comparing the four antenna distance parameter values corresponding to a certain sensor, the wheel position corresponding to the antenna with the smallest distance value is selected as the actual installation wheel position of the sensor, and an initial mapping relationship table between the ID and the wheel position is constructed. Based on the ID wheel position mapping table, a programming frame is generated according to the sensor ID of each wheel position, the programming frame carries the target ID, the corresponding wheel position label and the check code and other fields, and is sent to the TPMS sensor through the diagnostic interface to execute the programming operation. After receiving the programming frame, the sensor updates the built-in ID or wheel position identification parameter, and returns a standard format acknowledgement frame as feedback, which contains the program execution status code, the sensor's own ID and the response check data. After checking and analyzing all the returned acknowledgement frames, the diagnostic code reader obtains a sensor programming completion list.
[0104] In one example, according to the write confirmation flag, the fault code is cleared and the throttle learning value and clutch pressure calibration table are reset and the ECU is reset, and a reset completion flag is returned, including:
[0105] According to the write confirmation flag, the ECU is sent a fault code clearing service to clear all diagnostic fault codes, and a fault indicator light lighting counter zero service is synchronously sent to clear the MIL light counter register, and a clearing completion flag is returned;
[0106] According to the clearing completion flag, it is determined whether the throttle and clutch need to be reset and a learning completion flag is returned;
[0107] According to the learning completion flag, the ECU is sent a hard reset service trigger, the ECU closes the peripheral device, empties the RAM and reloads the Flash program, a heartbeat frame is continuously sent at a fixed time interval, the ECU resumes the state, and when a heartbeat response frame returned by the ECU is received, a reset completion flag is returned.
[0108] In this example, according to the write confirmation flag, the ECU enters the maintenance phase, a fault code clearing service instruction in the standardized UDS service is sent to the vehicle ECU, the service number is 0x14, to clear all recorded diagnostic fault codes; at the same time, in order to ensure that the MIL indication state of the instrument panel is consistent with the actual ECU internal state, an additional private or manufacturer extended service is synchronously sent to the ECU for clearing or zeroing the MIL lamp lighting counter, the corresponding register value is set to the initial state, ensuring that the next self-checking period is re-counted, thereby completing the overall clearing of the fault code and fault display state, and after receiving the clearing completion response returned by the ECU, a clearing completion flag is generated. According to the clearing completion flag, a learning value state judgment is started for the throttle actuator and the clutch hydraulic mechanism, the learning state bit or cumulative error identifier recorded in the related parameter register is read, when the state bit is detected to be in the uninitialized or abnormal offset range, the diagnostic code reader immediately constructs a throttle position learning and clutch pressure calibration value clearing service frame, triggers a re-learning process through a preset UDS service (such as 0x2E Write Data By Identifier or 0x31 Routine Control), and generates a learning completion flag after the ECU returns the corresponding service response after learning is completed. Based on the learning completion flag, a hard reset request is initiated through the 0x11 (ECU Reset) service instruction in the UDS service, and the specific reset type is set to 0x01 (hardware reset), indicating that the ECU is powered off and restarted, and all peripheral modules are closed, the internal RAM cache is emptied, and the operating system image and programming data in the Flash are reloaded, ensuring that all configurations are reactivated under cold start conditions. During the ECU reset process, the diagnostic code reader sends a custom heartbeat frame to the ECU at a preset periodic time interval (such as 100ms), for detecting whether the ECU has completed startup and initialization, when a heartbeat response frame or a diagnostic response frame returned by the ECU is received, it is confirmed that the ECU has recovered to a normal communication state, and a reset completion flag is generated accordingly.
[0109] In one example, according to the clearing completion flag, whether the throttle and the clutch need to be reset and the learning completion flag is returned, including:
[0110] According to the clearing completion flag, the opening difference value of the throttle is calculated, when the opening difference value exceeds the opening threshold value, the offset value zero service and the self-learning start service are sent, the ECU performs the zero point calibration of the full stroke movement of the throttle and returns a throttle completion flag;
[0111] According to the clear completion flag, the theoretical pressure value of the clutch is calculated and the pressure difference between the measured pressure value, when the pressure difference exceeds the pressure threshold, the default calibration table writing service and adaptive learning start service are sent, and the ECU performs multiple speed point cycle measurement to update the calibration table and returns the clutch completion flag;
[0112] When the throttle completion flag and the clutch completion flag are both true values, the learning completion flag is returned.
[0113] In this example, when the diagnostic code reader detects that the fault clearing work has been completed according to the fault code clear completion flag, that is, the MIL lamp counter and the fault register have both been reset to zero, the throttle and clutch reset judgment process is entered. The diagnostic code reader reads the current measured opening value of the throttle from the ECU, and consults the preset throttle reference opening value of the working condition, and the difference between the two is obtained. If the opening difference exceeds the set opening threshold, it is considered that the current throttle is in the offset state, which cannot guarantee the consistency of idle speed accuracy and torque response, so the diagnostic code reader immediately sends an offset value zero service request to the ECU and attaches the ID of the throttle subsystem, and the ECU responds to enter the throttle control module self-learning process, drives the throttle to perform a full stroke reciprocating motion, to calibrate the throttle motor opening to zero, and update the zero point parameter in the EEPROM, and return the throttle completion flag after completing the calibration. At the same time, the diagnostic code reader synchronously opens the clutch verification logic according to the clear completion flag, calculates the theoretical pressure value of the clutch under the current vehicle condition, and obtains the actual pressure reading of the clutch oil pressure unit in real time through the sensor, and takes the difference between the two as the pressure offset parameter. If the pressure difference is greater than the set pressure threshold, the default calibration table writing service and the clutch adaptive learning start service are sent to the ECU. The ECU switches to the clutch calibration mode after receiving the instruction, performs master-slave pump pressure response measurement at multiple speed points, updates and corrects the current oil pressure control characteristics, and replaces the internal calibration pressure mapping table, and returns the clutch completion flag after completion. The diagnostic code reader performs logical AND operation on the throttle completion flag and the clutch completion flag, and if both are true values, that is, both have completed the reset and calibration process, the learning completion flag is generated by the controller and written into the state register, and the state is notified to the upper control host through the UDS session, indicating that the key controller parameters in the vehicle powertrain have returned to the initial learning state.
[0114] The method comprises the following steps: judging whether the throttle valve and the clutch need to be reset according to the clear completion flag and returning the learning completion flag, comprising: calculating the opening deviation value according to the current opening value of the throttle valve and the learning offset value, and calculating the pressure deviation value according to the current pressure value of the clutch and the theoretical pressure value of the calibration table; querying the same vehicle model historical reset record from the maintenance station database, and counting the frequency of simultaneous occurrence of the throttle valve deviation overrun and the clutch deviation overrun, and marking as a strong correlation state when the frequency exceeds the correlation threshold; when marked as a strong correlation state, first performing throttle valve reset and then performing clutch reset after waiting for learning completion, and when marked as a non-strong correlation state, simultaneously performing throttle valve reset and clutch reset; receiving the throttle valve learning completion response and the clutch learning completion response returned by the ECU, and returning the learning completion flag after verifying that the two learning flags are in the completion state.
[0115] When the heartbeat response frame returned by the ECU is received, the reset completion flag is returned, and the following is further included: according to the reset completion flag, the reference data stream file of the normal vehicle of the same model is read from the maintenance station database server through the Ethernet interface, the reference data stream file contains the engine speed reference value and its tolerance range, the intake manifold pressure reference value and its tolerance range, the throttle opening reference value and its tolerance range, the oxygen sensor voltage reference value and its tolerance range, the coolant temperature reference value and its tolerance range, the fuel correction value reference range, and the complete reference data stream file is obtained; the data stream parameters of the current vehicle are read in real time through the UDS diagnostic service, and a plurality of parameter identifier reading requests are sent to obtain the engine speed measured value, the intake manifold pressure measured value, the throttle opening measured value, the oxygen sensor voltage measured value, the coolant temperature measured value, the short-term fuel correction measured value and the long-term fuel correction measured value, and the current vehicle data stream parameter set is obtained; for each parameter in the current vehicle data stream parameter set, the deviation absolute value between the measured value of the parameter and the corresponding parameter reference value in the reference data stream file is calculated, and the deviation absolute value is compared with the tolerance range threshold corresponding to the parameter; when the deviation absolute value exceeds the tolerance range threshold, the parameter is marked as an abnormal parameter and the parameter identifier, measured value, reference value and deviation value of the parameter are recorded to the audit log buffer, the audit log buffer also records the VIN code, the current Unix timestamp, the operation type enumeration value and the operator identifier, and the complete audit log data structure is obtained; the audit log data structure is formatted into a PDF report file, the complete byte stream of the PDF report file is calculated to obtain a SHA256 hash value as a digital fingerprint of the audit record, a TCP connection with the maintenance station management background is established through the DoIP Ethernet diagnostic protocol, a DoIP diagnostic message is constructed including a protocol version field, a payload type field, a payload length field and a PDF file byte stream payload, the DoIP diagnostic message is sent to the maintenance station management background, the maintenance station management background recalculates the SHA256 hash value after receiving the PDF file and performs consistency verification with the digital fingerprint sent, and after verification, the audit record is stored to the block chain audit chain, each audit record is taken as a leaf node using a Merkle tree structure, the hash values of adjacent nodes are merged two by two to generate parent node hash values until a root hash value is generated, and the audit record is anchored to the block chain through the root hash value to ensure operation traceability and data tamper resistance.
[0116] Referring to Figure 2 The embodiment provides a multi-mode activation and reset system of a diagnostic code reader, comprising:
[0117] An identification module 1 is configured to identify the protocol type of the ECU response frame and read the VIN code sequence;
[0118] An authentication module 2 is configured to perform seed key authentication based on the VIN code sequence and return a programming session state flag;
[0119] The selecting module 3 is configured to select the online programming mode or the offline programming mode according to the programming session status flag, and perform the Flash writing, and return a programming completion flag;
[0120] The activating module 4 is configured to activate the TPMS sensor and write the ID mapping table based on the programming completion flag, and return a write confirmation flag of the ID mapping table;
[0121] The resetting module 5 is configured to clear the fault code and reset the throttle learning value and clutch pressure calibration table according to the write confirmation flag, and perform the ECU hard reset, and return a reset completion flag.
[0122] In the embodiment, the specific implementation of each unit in the system embodiment is described above in the method embodiment, and will not be described here.
[0123] It should be noted that in this paper, the terms "include", "contain" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, system, article or method including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or includes elements inherent to such process, system, article or method. Without more limitations, the element defined by the statement "including a" does not exclude the existence of other identical elements in the process, system, article or method including the element.
[0124] The above is only the preferred embodiment of the present application, and does not limit the patent scope of the present application, and any equivalent structure or equivalent process transformation using the content of the present application specification and drawings, or direct or indirect application in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A multi-mode activation and reset method for a diagnostic code reader, characterized in that, include: Send a wake-up frame to the OBD interface and receive an ECU response frame, extracting the first byte of the ECU response frame as a protocol type identifier; The protocol type is determined based on the protocol type identifier; Set the communication baud rate and frame interval parameters according to the protocol type and return the protocol configuration completion flag, and read the VIN code sequence through the UDS diagnostic service according to the protocol configuration completion flag; Seed key authentication is performed based on the VIN code sequence, and a programming session status flag is returned. Specifically, this includes: extracting the year code and vehicle description code from the VIN code sequence, and establishing a session state transition sequence for basic diagnostic sessions, extended diagnostic sessions, and programming sessions based on the year code and vehicle description code; sending a seed request service to the ECU to obtain a random seed sequence; extracting the manufacturer identification code from the VIN code sequence; performing key operations on the random seed sequence based on the manufacturer identification code to obtain a key operation result; sending the key operation result to the ECU to complete verification and returning a key authentication completion flag; sending a programming session request to the ECU based on the key authentication completion flag, receiving a programming session confirmation response from the ECU, and returning a programming session status flag. The process involves selecting either online or offline programming mode based on the programming session status flags, performing Flash writing, and returning a programming completion flag. Specifically, this includes: reading the network connection status and battery voltage based on the programming session status flags, and selecting either online or offline programming mode based on these parameters; when online programming mode is selected, retrieving the calibration file from the cloud server and receiving file metadata; when offline programming mode is selected, reading the calibration file from the local storage path and obtaining file metadata; dividing the file metadata into multiple data blocks, calculating a local hash value for each data block and accumulating it to a global hash value; comparing the global hash value with the target hash value in the file metadata and returning a file verification result; based on the file verification result, requesting download and transmission services via UDS to cyclically write the data blocks into the ECU's Flash memory; after sending the transmission exit service, triggering the ECU's internal CRC verification program; receiving a verification success response from the ECU; and obtaining a programming completion flag. Based on the programming completion flag, the TPMS sensor is activated and written to the ID mapping table, and the write confirmation flag of the ID mapping table is returned. Based on the written confirmation flag, the fault code is cleared and the throttle learning value and clutch pressure calibration table are reset, and an ECU hard reset is performed, returning to the reset completion flag.
2. The multi-mode activation and reset method for a diagnostic code reader according to claim 1, characterized in that, The process involves cyclically writing data blocks into the ECU's Flash memory based on the file verification result, triggering the ECU's internal CRC verification program after the transmission service exits, receiving a verification success response from the ECU, and obtaining a programming completion flag, including: Based on the file verification result, a request for download service is sent to the ECU, carrying the Flash start address and total data length parameters, to obtain the block transfer configuration parameters; Calculate the CRC check value of each data block according to the block transmission configuration parameters and send it to the ECU through the transmission service, and return the data block transmission completion flag; After sending the data block transmission completion flag to the ECU, the internal CRC check program of the ECU is triggered. The ECU performs CRC calculation on the Flash area and verifies it with the CRC check value. When the verification is successful, a success response is received and a programming completion flag is returned. When the verification is unsuccessful, an ECU soft reset is triggered to load the backup program.
3. The multi-mode activation and reset method for a diagnostic code reader according to claim 1, characterized in that, The step of activating the TPMS sensor and writing it to the ID mapping table based on the programming completion flag, and returning the write confirmation flag of the ID mapping table, includes: Based on the programming completion flag, read the TPMS fault flag bit to determine whether sensor activation is required. Obtain the four-wheel sensor ID mapping table stored in the ECU through the OBD reading service, extract the manufacturer code and CRC check code of each ID, perform an XOR operation to verify the ID validity, and obtain the list of known sensors. When the known sensor list is empty, an activation pulse sequence is sent to the tire to wake up the sensor, a programming frame is constructed and sent to the new sensor, and a list of sensor programming completed is obtained. Based on the sensor programming completion list or the known sensor list, the system sends an ID mapping table write service to the ECU and returns a write confirmation flag for the ID mapping table.
4. The multi-mode activation and reset method for a diagnostic code reader according to claim 3, characterized in that, When the known sensor list is empty, an activation pulse sequence is sent to the tire to wake up the sensors, a programming frame is constructed and sent to the new sensor, and a sensor programming completion list is obtained, including: When the known sensor list is empty, an activation pulse sequence is sent to each tire, the data frames returned by the sensors are received, and the sensor response data set is decoded. The received signal strength values of the four-wheel antennas are measured according to the sensor response data set. The distance parameters from the sensor to each wheel position are calculated based on each received signal strength value. The wheel position corresponding to the minimum distance parameter is selected as the installation position of the new sensor, and the ID wheel position mapping table is obtained. A programming frame is constructed based on the ID wheel position mapping table, the programming frame is sent to the new sensor, and a confirmation frame is received from the new sensor to obtain the sensor programming completion list.
5. The multi-mode activation and reset method for a diagnostic code reader according to claim 1, characterized in that, The process of clearing fault codes and resetting the throttle learning value and clutch pressure calibration table according to the written confirmation flag, and performing an ECU hard reset, returning a reset completion flag, includes: Based on the write confirmation flag, send a fault code clearing service to the ECU to clear all diagnostic fault codes, and simultaneously send a fault indicator light illuminating counter clearing service to clear the MIL lamp counter register, and return a clearing completion flag; Based on the clearing completion flag, determine whether the throttle and clutch need to be reset and return to the learning completion flag; Based on the learning completion flag, a hard reset service is sent to the ECU to trigger the ECU to shut down peripherals, clear RAM, and reload the Flash program. Heartbeat frames are continuously sent at fixed time intervals to detect the ECU's recovery status. When a heartbeat response frame is received from the ECU, a reset completion flag is returned.
6. The multi-mode activation and reset method for a diagnostic code reader according to claim 5, characterized in that, The step of determining whether the throttle body and clutch need to be reset and returning to the learning completion flag based on the clearing completion flag includes: The throttle opening difference is calculated based on the clearing completion flag. When the opening difference exceeds the opening threshold, the offset value clearing service and self-learning start service are sent. After the ECU completes the zero-point calibration of the full stroke of the throttle, it returns to the throttle completion flag. Based on the clearing completion flag, the theoretical pressure value of the clutch is calculated and the pressure difference between it and the measured pressure value. When the pressure difference exceeds the pressure threshold, the default calibration table writing service and the adaptive learning start service are sent. After the ECU performs multi-speed point cyclic measurement to update the calibration table, the clutch completion flag is returned. When both the throttle completion flag and the clutch completion flag are true, return to the learning completion flag.
7. A multi-mode activation and reset system for a diagnostic code reader, characterized in that, The steps for implementing the multi-mode activation and reset method of the diagnostic code reader according to any one of claims 1 to 6 include: The identification module is used to identify the protocol type of the ECU response frame and read the VIN code sequence; The authentication module is used to perform seed key authentication based on the VIN code sequence and return the programming session status flag; The selection module is used to select online programming mode or offline programming mode according to the programming session status flag, perform Flash writing, and return a programming completion flag; The activation module is used to activate the TPMS sensor based on the programming completion flag and write it into the ID mapping table, and return the write confirmation flag of the ID mapping table. The reset module is used to reset the fault code clearing and throttle learning value and clutch pressure calibration table according to the written confirmation flag, and perform ECU hard reset, and return the reset completion flag.
Citation Information
Patent Citations
Vehicle fault diagnosis method, vehicle terminal, vehicle MCU and storage medium
CN116820068A
Emergency situation detection and avoidance
EP3474190A1