Data flashing method and device and electronic equipment

Through the Ethernet-based diagnostic communication protocol, data flushing of vehicle electronic devices is performed, and hash value comparison and functional testing is used to solve the problems of low efficiency and poor compatibility in vehicle diagnostics, and efficient and safe electronic device updates and testing are achieved.

CN120276751APending Publication Date: 2025-07-08DEEPAL AUTOMOBILE TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510351936.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

In the prior art, the test and writing efficiency of electronic devices during vehicle diagnosis is low, especially when multi-ECU collaborative testing is slow, the data transmission and processing speed is insufficient, the compatibility is insufficient, and the ability to intelligent analysis and automated testing is lacking, making it difficult to effectively support fault diagnosis and system verification.

Method used

Using Ethernet-based diagnostic communication protocols (such as DoIP protocol), we provide high bandwidth, flexibility and security by sending data to be flashed and obtaining hash value comparison results, combining functional testing and exception processing, including signal transmission testing, memory verification, compatibility testing, etc.

Benefits of technology

It improves the brushing efficiency and security of vehicle electronic devices, ensures data transmission accuracy, enhances the compatibility and intelligent analysis capabilities of the test system, and supports fault diagnosis and system verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120276751A_ABST
    Figure CN120276751A_ABST
Patent Text Reader

Abstract

The invention relates to a data flashing method and device and electronic equipment, and relates to the technical field of vehicle diagnosis. The technical problem that the efficiency of testing and flashing electronic devices is low when a vehicle is diagnosed in the prior art is at least solved. Comprising the steps that to-be-flashed data is sent to a vehicle through a preset protocol, the to-be-flashed data is used for updating a software version of an electronic device in the vehicle, and the preset protocol is an Ethernet-based diagnosis communication protocol; under the condition that the to-be-flashed data is successfully transmitted, a first hash value and a second hash value are obtained, the first hash value is a hash value determined by the vehicle based on the received data, and the second hash value is a hash value determined based on the to-be-flashed data; and determining a flashing result of the to-be-flashed data according to a comparison result of the first hash value and the second hash value. The method is used for improving the testing and flashing efficiency of the electronic device of the vehicle.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of vehicle diagnosis, and particularly to a data writing method, apparatus, and electronic device. Background Art

[0002] With the rapid development of vehicle technologies, the functions of fuel vehicles and new energy vehicles are becoming increasingly complex. Moreover, the development trend of vehicle electrification and intelligence requires vehicles to include more electronic devices (to support the complex functions of the vehicles), and the operation of the electronic devices requires the support of software data packets. Therefore, it is necessary to diagnose or write (software update) the electronic devices in the vehicle to ensure the safe operation of the electronic devices.

[0003] In related technologies, a connection with the controller under test is established to send a routing activation request to the controller under test, and based on the routing activation response returned by the controller under test, a routing connection is established. Further, a protocol test message is sent to the controller under test, and the response data returned by the controller under test for the protocol test message is received. The response data is analyzed to generate a protocol test result. This method is to test the controller to obtain the test result. In another related technology, it is detected whether a microcontroller unit (MCU) has the writing condition. When the MCU has the writing condition, MCU remote writing is selected to perform firmware writing on the MCU; or when the MCU does not have the writing condition, diagnosis and / or address information acquisition operations are performed. Also, it is detected whether an electronic control unit (ECU) has the writing condition. When the ECU has the writing condition, ECU remote writing is selected and the ECU remote writing result is output. And when the ECU remote writing result is successful, the writing ends, and if the ECU remote writing result is failed, the ECU remote writing is performed again. This method only illustrates whether to write (or perform other operations) on the MCU or ECU when the MCU or ECU has the writing condition, but does not specifically illustrate how to perform the writing. Therefore, as the number of electronic components included in the vehicle increases, a more efficient and accurate test writing scheme is needed to diagnose the vehicle. Summary of the Invention

[0004] The present application provides a data writing method, apparatus, and electronic device. The purpose of the present application is to at least solve the technical problem of low efficiency in testing and writing electronic devices when diagnosing a vehicle in related technologies.

[0005] To achieve the above purpose, the technical solution adopted by the present application is as follows:

[0006] According to a first aspect provided by the present application, a data flashing method is provided. The method includes: sending data to be flashed to a vehicle through a preset protocol, where the data to be flashed is used to update the software version of an electronic device in the vehicle, and the preset protocol is a diagnostic communication protocol based on Ethernet; in the case where the data to be flashed is successfully transmitted, obtaining a first hash value and a second hash value, where the first hash value is the hash value determined by the vehicle based on the received data, and the second hash value is the hash value determined based on the data to be flashed; determining the flashing result of the data to be flashed according to the comparison result of the first hash value and the second hash value.

[0007] According to the above technical means, the present application can send data to be flashed to a vehicle through a diagnostic communication protocol based on Ethernet to update the software version of an electronic device in the vehicle. And, in the case where the data to be flashed is successfully transmitted, by obtaining the first hash value determined by the vehicle based on the received data and the second hash value determined based on the data to be flashed, and according to the comparison result of the first hash value and the second hash value, the flashing result of the data to be flashed is determined. In this way, since the diagnostic communication protocol based on Ethernet allows diagnostic operations to be performed through Ethernet and has high bandwidth, flexibility, and security, the electronic devices in the vehicle can be flashed efficiently and safely. And, by comparing the hash value of the data to be flashed with the hash value of the data received by the vehicle, it can be determined whether the flashing is successful. In this way, the efficiency and security of flashing the electronic devices of the vehicle can be improved.

[0008] In a possible implementation manner, the data to be flashed includes multiple data blocks, and the above method further includes: receiving the data verification result of each data block returned by the vehicle, where the data verification result is used to indicate whether the data block includes error data; in the case where the data verification result of each data block indicates that the data block does not include error data and the acknowledgment character of each data block is received within a preset time period, determining that the data to be flashed is successfully transmitted, and the acknowledgment character is used to indicate that the data block is not lost.

[0009] According to the above technical means, the present application can determine whether the data block includes error data based on the data verification result of each data block returned by the vehicle, and determine whether the data block is lost based on whether the acknowledgment character of each data block is received within a preset time period. Thus, based on the data verification result and the acknowledgment character of each data block, it can be determined whether the data to be flashed is successfully transmitted. In this way, the transmission result of the data to be flashed can be accurately judged.

[0010] In a possible implementation manner, each data block in the multiple data blocks includes a preset amount of data, and the preset amount of data is determined based on a flashing tool in the data flashing device.

[0011] According to the above technical means, the present application can determine the data volume of each data block included in the data to be flashed based on the performance or characteristics of the flashing tool in the data flashing device. Thus, the data to be flashed can be accurately divided into data blocks according to the flashing tool in the data flashing device, and the data to be flashed can be efficiently sent to the vehicle.

[0012] In a possible implementation manner, the above-mentioned sending the data to be flashed to the vehicle through a preset protocol includes: when a connection with the vehicle is established, receiving a dynamic password sent by the vehicle; determining an authentication key based on the dynamic password, and sending the authentication key to the vehicle; the authentication key is used to instruct the vehicle to switch to the flashing mode; in response to the mode switching response sent by the vehicle, sending the data to be flashed to the vehicle through the preset protocol, and the mode switching response is used to indicate that the vehicle has switched to the flashing mode.

[0013] According to the above technical means, the present application can determine an authentication key based on the dynamic password sent by the vehicle, and send the authentication key to the vehicle to instruct the vehicle to switch to the flashing mode. Thus, when the mode switching response sent by the vehicle is obtained and it is confirmed that the vehicle is in the flashing mode, the data to be flashed is sent to the vehicle. In this way, the vehicle is triggered to switch modes through the dynamic password and the authentication key, and the electronic devices in the vehicle can only be flashed in the flashing mode. The data security of the vehicle can be guaranteed.

[0014] In a possible implementation manner, the above method further includes: sending a routing activation request to the vehicle, and the routing activation request is used to activate the preset protocol; in response to the routing activation response returned by the vehicle, establishing a connection with the vehicle.

[0015] According to the above technical means, the present application can activate the preset protocol by sending a routing activation request to the vehicle. Thus, when the routing activation response returned by the vehicle is obtained, a connection with the vehicle is established based on the activated preset protocol. Thus, the electronic devices in the vehicle can be efficiently and safely flashed through the preset protocol.

[0016] In a possible implementation manner, the above method further includes: performing a function test on the electronic devices in the vehicle when the data to be flashed is flashed; generating a test report when the function test passes.

[0017] According to the above technical means, the present application can further perform a function test on the electronic devices in the vehicle when the data to be flashed is flashed, so as to generate a test report when the function test passes. In this way, by further performing a function test on the electronic devices, it is further detected whether the flashing of the electronic devices is successful.

[0018] In a possible implementation, the functional test includes a signal transmission test; the above functional test of the electronic devices in the vehicle includes: sending a test signal to the electronic device; receiving a test response signal returned by the electronic device; obtaining the waveforms of the test signal and the test response signal through an oscilloscope; determining the functional test result of the signal transmission test based on the waveforms of the test signal and the test response signal, and the functional test result includes the response duration of the electronic device.

[0019] According to the above technical means, the present application can send a test signal to the electronic device and receive a test response signal returned by the electronic device, so as to obtain the waveforms of the test signal and the test response signal through an oscilloscope. In this way, the waveforms of the test signal and the test response signal can be analyzed, and the response duration of the electronic device. Thus, based on the waveforms of the test signal and the test response signal, the functional test result of the signal transmission test is determined. In this way, the signal input / output performance of the electronic device can be determined based on the response duration of the electronic device.

[0020] In a possible implementation, the functional test further includes at least one of the following: communication check, memory verification, diagnostic service coverage test, compatibility test, stress test, network interference test; the communication check is used to determine whether the software version number of the electronic device is updated, the memory verification is used to determine whether the data stored in the vehicle is the data to be flashed, the diagnostic service coverage test is used to test the electronic device through the unified diagnostic service UDS, the compatibility test is used to determine the compatibility of the electronic device with other modules, the stress test is used to repeatedly execute the flashing process of the data to be flashed on the vehicle, and the network interference test is used to determine the anti-interference ability of the electronic device through network noise.

[0021] According to the above technical means, the present application can perform at least one of the following functional tests on the electronic devices in the vehicle: communication check, memory verification, diagnostic service coverage test, compatibility test, stress test, network interference test, and verify the functions of the electronic devices after the data flashing is completed, so as to ensure the effectiveness of the data flashing.

[0022] In a possible implementation, the above method further includes: in the case where the flashing of the data to be flashed fails, sending a rollback message to the vehicle, and the rollback message is used to instruct the vehicle to load the historical software version data of the electronic device from the backup data. The failure of the flashing of the data to be flashed includes at least one of the following: the first hash value is inconsistent with the second hash value, the data flashing device is disconnected from the vehicle, the data verification result indicates that the data block includes error data, the acknowledgment character indicates that the data block is lost, and the electronic device has no response.

[0023] According to the above technical means, when the data to be flashed fails to be flashed, the present application can trigger the vehicle to roll back the software version of the electronic device to the previous historical software version by rolling back the message, thereby avoiding the inavailability of the functions of the electronic device caused by the flashing failure, and thus improving the running safety of the vehicle.

[0024] In a possible implementation manner, determining the flashing result of the data to be flashed according to the comparison result of the first hash value and the second hash value includes: when the first hash value is consistent with the second hash value, determining that the data to be flashed is successfully flashed; or, when the first hash value is inconsistent with the second hash value, determining that the data to be flashed fails to be flashed.

[0025] According to the above technical means, the present application can determine that the data to be flashed is successfully flashed when the first hash value is consistent with the second hash value, and determine that the data to be flashed fails to be flashed when the first hash value is inconsistent with the second hash value. In this way, according to the comparison result of the first hash value and the second hash value, it can be accurately determined whether the data to be flashed is successfully flashed.

[0026] According to the second aspect provided by the present application, a data flashing device is provided. The data flashing device includes: a sending module, an obtaining module, and a processing module; the sending module is configured to send the data to be flashed to the vehicle through a preset protocol, where the data to be flashed is used to update the software version of the electronic device in the vehicle, and the preset protocol is a diagnostic communication protocol based on Ethernet; the obtaining module is configured to obtain a first hash value and a second hash value when the data to be flashed is successfully transmitted, where the first hash value is a hash value determined by the vehicle based on the received data, and the second hash value is a hash value determined based on the data to be flashed; the processing module is configured to determine the flashing result of the data to be flashed according to the comparison result of the first hash value and the second hash value.

[0027] In a possible implementation manner, the data to be flashed includes a plurality of data blocks, and the obtaining module is further configured to receive the data verification result of each data block returned by the vehicle, where the data verification result is used to indicate whether the data block includes error data; the processing module is further configured to determine that the data to be flashed is successfully transmitted when the data verification result of each data block indicates that the data block does not include error data and the acknowledgment character of each data block is received within a preset time period, and the acknowledgment character is used to indicate that the data block is not lost.

[0028] In a possible implementation manner, each data block in the plurality of data blocks includes a preset amount of data, and the preset amount of data is determined based on the flashing tool in the data flashing device.

[0029] In a possible implementation, the acquisition module is further configured to receive a dynamic password sent by the vehicle when connected to the vehicle; the processing module is further configured to determine an authentication key based on the dynamic password; the sending module is further configured to send the authentication key to the vehicle; the authentication key is used to instruct the vehicle to switch to the flashing mode; specifically, the sending module is configured to send the data to be flashed to the vehicle through a preset protocol in response to a mode switching response sent by the vehicle, and the mode switching response is used to indicate that the vehicle has switched to the flashing mode.

[0030] In a possible implementation, the sending module is further configured to send a routing activation request to the vehicle, and the routing activation request is used to activate a preset protocol; the processing module is further configured to establish a connection with the vehicle in response to a routing activation response returned by the vehicle.

[0031] In a possible implementation, the processing module is further configured to perform a function test on the electronic devices in the vehicle when the data to be flashed is successfully flashed; the processing module is further configured to generate a test report when the function test passes.

[0032] In a possible implementation, the function test includes a signal transmission test; the sending module is further configured to send a test signal to the electronic device; the acquisition module is further configured to receive a test response signal returned by the electronic device; specifically, the processing module is configured to obtain the waveforms of the test signal and the test response signal through an oscilloscope; specifically, the processing module is configured to determine the function test result of the signal transmission test based on the waveforms of the test signal and the test response signal, and the function test result includes the response duration of the electronic device.

[0033] In a possible implementation, the function test further includes at least one of the following: communication check, memory verification, diagnostic service coverage test, compatibility test, stress test, network interference test; the communication check is used to determine whether the software version number of the electronic device is updated, the memory verification is used to determine whether the data stored in the vehicle is the data to be flashed, the diagnostic service coverage test is used to test the electronic device through the unified diagnostic service UDS, the compatibility test is used to determine the compatibility between the electronic device and other modules, the stress test is used to repeatedly execute the flashing process of the data to be flashed on the vehicle, and the network interference test is used to determine the anti-interference ability of the electronic device through network noise.

[0034] In a possible implementation, the sending module is further configured to send a rollback message to the vehicle when the data to be flashed fails to be flashed, and the rollback message is used to instruct the vehicle to load the historical software version data of the electronic device from the backup data. The failure of the data to be flashed includes at least one of the following: the first hash value is inconsistent with the second hash value, the data flashing device is disconnected from the vehicle, the data verification result indicates that the data block includes error data, the confirmation character indicates that the data block is lost, and the electronic device has no response.

[0035] In a possible implementation, the processing module is specifically configured to determine that the data to be flashed is successfully flashed when the first hash value matches the second hash value; or, the processing module is specifically configured to determine that the data to be flashed fails to be flashed when the first hash value does not match the second hash value.

[0036] According to a third aspect provided by the present application, there is provided an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein, the processor is configured to execute the instructions to implement the method according to the first aspect and any possible implementation manner thereof.

[0037] According to a fourth aspect provided by the present application, there is provided a computer-readable storage medium, when the computer-executable instructions stored in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is caused to execute the method according to the first aspect and any possible implementation manner thereof.

[0038] According to a fifth aspect provided by the present application, there is provided a computer program product, the computer program product includes computer instructions, when the computer instructions run on the electronic device, the electronic device is caused to execute the method according to the first aspect and any possible implementation manner thereof.

[0039] According to a sixth aspect provided by the present application, there is provided a vehicle, the vehicle includes a data flashing device as described in the second aspect, and the vehicle is used to implement the method according to the first aspect and any possible implementation manner thereof.

[0040] It should be noted that for the technical effects brought by any implementation manner in the second aspect to the sixth aspect, reference may be made to the technical effects brought by the corresponding implementation manner in the first aspect, which will not be elaborated here.

[0041] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The drawings herein are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application, and do not constitute an improper limitation to the present application.

[0043] Figure 1 is a schematic structural diagram of a data flashing system shown according to an exemplary embodiment;

[0044] Figure 2 is a flowchart of a data flashing method shown according to an exemplary embodiment;

[0045] Figure 3It is a flowchart of another data flashing method shown according to an exemplary embodiment;

[0046] Figure 4 It is a flowchart of another data flashing method shown according to an exemplary embodiment;

[0047] Figure 5 It is a flowchart of another data flashing method shown according to an exemplary embodiment;

[0048] Figure 6 It is a flowchart of another data flashing method shown according to an exemplary embodiment;

[0049] Figure 7 It is a block diagram of a data flashing device shown according to an exemplary embodiment;

[0050] Figure 8 It is a block diagram of an electronic device shown according to an exemplary embodiment. Detailed implementation manners

[0051] In order to enable those of ordinary skill in the art to better understand the technical solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.

[0052] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0053] With the development of vehicle electronics and intelligence, vehicle diagnostic technology has gradually transitioned from the traditional diagnostic method based on the Controller Area Network (CAN) bus to the diagnostic communication (Diagnostic Over Internet Protocol, DoIP) protocol based on Internet protocols (Ethernet, TCP / IP protocol). The DoIP protocol uses the Internet protocol (IP) to implement the transmission of vehicle diagnostic data, and has advantages such as high bandwidth, long-distance communication, and strong compatibility.

[0054] However, the current vehicle diagnostic technology still has the following problems: low test efficiency, especially when multiple ECUs are tested collaboratively, the data transmission and processing speeds are relatively slow; the compatibility of the test system is insufficient, making it difficult to adapt to the diverse requirements of different vehicle models and ECUs; there is a lack of intelligent analysis and automated testing capabilities for test data, and it is unable to effectively support fault diagnosis and system verification.

[0055] The data writing method provided by the embodiments of the present application can be applicable to a data writing system. Figure 1 The structure diagram of a data writing system is shown. As Figure 1 shown, the data writing system 10 includes: an electronic device 11 and a vehicle 12.

[0056] Optionally, the electronic device 11 can specifically be a data writing device (host computer, such as CANOE (bus development environment)) to perform diagnostic writing on the vehicle 12.

[0057] Optionally, a writing tool can be installed in the electronic device 11, and the writing tool supports a diagnostic communication protocol based on Ethernet (such as the DoIP protocol).

[0058] Optionally, the vehicle 12 includes multiple electronic devices, and the electronic devices can be MCUs, ECUs, etc.

[0059] Optionally, the electronic device 11 can send the data to be written to the vehicle 12 through a preset protocol (DoIP protocol), and the data to be written is used to update the software version of the electronic devices in the vehicle 12, and the preset protocol is a diagnostic communication protocol based on Ethernet.

[0060] Optionally, when the transmission of the data to be written is successful, the electronic device 11 can obtain a first hash value and a second hash value. The first hash value is the hash value determined by the vehicle 12 based on the received data, and the second hash value is the hash value determined based on the data to be written.

[0061] Optionally, the electronic device 11 can determine the writing result of the data to be written according to the comparison result of the first hash value and the second hash value.

[0062] For ease of understanding, the data writing method provided by the present application will be specifically introduced below with reference to the accompanying drawings.

[0063] It should be noted that before implementing the technical solution provided by the embodiments of the present application, a brief introduction to the three stages of writing (pre-programming, programming, and post-programming) will be given first.

[0064] First, the pre-programming stage is used to stop the update of Diagnostic Trouble Codes (DTCs) of the vehicle, perform session control, and turn off non-diagnostic network communication. It specifically includes the following steps (instructions):

[0065] Service 0x10, service 10 01, default session control;

[0066] Service 0x10, service 10 03, extended session control (DTC and communication settings are carried out in this session);

[0067] Service 0x31, routine control (check whether the vehicle condition meets the safety conditions);

[0068] Service 0x22, read Decentralized Identifier (DID) information;

[0069] Service 0x85, service 85 02, turn off DTC recording;

[0070] Service 0x28, service 28 03 01, turn off non-diagnostic network communication.

[0071] Secondly, the programming stage is used to unlock the vehicle safely, write the programming date, download the FlashDriver (driver for accessing and managing flash memory devices) and the Application. It specifically includes the following steps (instructions):

[0072] Service 0x10, service 10 02, programming session control;

[0073] Service 0x27, service 27 01, request a seed (dynamic password, random number, etc.);

[0074] Service 0x27, service 27 02, send the key. After receiving the seed, the key is obtained according to the security algorithm and sent through this service. The vehicle verifies the accuracy of the key and decides whether to unlock the ECU;

[0075] Service 0x2E, write fingerprint information;

[0076] Service 0x34, request to download data, send the data address and data length to be flashed to the ECU, and the ECU verifies the legality;

[0077] Service 0x36, request data transmission. The flashing tool sends the firmware (data to be flashed) to the ECU through this service. The ECU writes the data to the FLASH while receiving the data, and loops until the data transmission is completed;

[0078] Service 0x37, request to exit data transmission (exit the flashing mode);

[0079] 0x31 Service 31 01 02 03 Routine Control, verify programming integrity, and check the results with the host computer (data flashing device);

[0080] It should be noted that all data downloads are implemented through (0x34, 0x36, 0x37, 0x31), including flashDriver and Application. The difference lies in the data and the flashing address.

[0081] Again, the post-programming stage is used to restore system network communication and DTC updates after data download is completed. Specifically, it includes the following steps (instructions):

[0082] 0x11 Service 11 01 Software Reset, send this request after the firmware transfer ends and passes the programming integrity check, perform the reset and then jump to run the program;

[0083] 0x10 Service 10 03 Enter Extended Session, send this request after the program runs, and prepare to restore the network communication and DTC updates that were closed in the pre-programming stage;

[0084] 0x28 Service 28 00 03 Restore non-diagnostic network communication;

[0085] 0x85 Service 85 01 Restore DTC updates;

[0086] 0x14 Service 14 FFFFFF Clear DTC fault codes;

[0087] 0x10 Service 10 01 Enter Default Session.

[0088] Figure 2 It is a flowchart of a data flashing method shown according to an exemplary embodiment, as Figure 2 shown, the data flashing method includes: S201 - S203:

[0089] S201. Send the data to be flashed to the vehicle through a preset protocol.

[0090] Among them, the data to be flashed is used to update the software version of the electronic devices in the vehicle, and the preset protocol is a diagnostic communication protocol based on Ethernet.

[0091] In the embodiments of the present application, since there are a large number of electronic devices in the vehicle, and the operation of the electronic devices requires the support of software data packets. And it is necessary to update (diagnostic flash) the software data packets of the electronic devices at regular intervals to optimize the functions of the electronic devices.

[0092] Optionally, the preset protocol can be a diagnostic communication protocol based on Ethernet. Specifically, the preset protocol can be the DoIP protocol.

[0093] It should be noted that the DoIP protocol is mainly used to implement remote diagnosis and data transmission between devices. Its core lies in using network protocols to replace traditional buses, improving diagnostic efficiency and flexibility. Diagnostic data is transmitted through network protocols such as Ethernet and Wi-Fi, supporting efficient communication between devices and solving the problems of low bandwidth and limited transmission distance of traditional diagnostic protocols (such as CAN and K-Line).

[0094] The DoIP protocol has the functions of remote diagnosis and control, supporting cross-regional access to devices; and the ability of high-speed data transmission. Based on the bandwidth advantage of Ethernet (up to over 100 Mbps), it can quickly transmit a large amount of data (such as vehicle sensor information, firmware packages, etc.); Protocol compatibility: It follows the ISO 13400 international standard and can be seamlessly docked with traditional diagnostic tools (such as the UDS protocol) to ensure the coordinated operation of new and old systems.

[0095] Thus, based on the high bandwidth and real-time performance of the DoIP protocol, compared with the CAN bus (typical rate of 1 Mbps), the gigabit-level bandwidth of the DoIP protocol supports high-data-volume scenarios such as high-definition cameras and autonomous driving. And it has the ability of flexible network formation, can expand network nodes through routers and switches, and is suitable for multi-device collaborative diagnosis (such as vehicle electronic system testing); It has strong security, supports TLS / SSL encrypted transmission to prevent diagnostic data from being stolen or tampered with.

[0096] S202. When the transmission of the data to be flashed is successful, obtain the first hash value and the second hash value.

[0097] Among them, the first hash value is the hash value determined by the vehicle based on the received data, and the second hash value is the hash value determined based on the data to be flashed.

[0098] In a possible implementation, after all data blocks included in the data to be flashed are sent to the vehicle, the vehicle can determine the corresponding hash value (i.e., the first hash value) based on all the received data (received data), and send the first hash value to the data flashing device.

[0099] At the same time, the data flashing device can also determine the corresponding hash value (i.e., the second hash value) based on the sent data to be flashed.

[0100] Optionally, the data flashing device can confirm the completion of data flashing to the vehicle by sending a 0x31 service request to the vehicle, so that the ECU of the vehicle calculates the corresponding first hash value based on the received data.

[0101] S203. Determine the flashing result of the data to be flashed according to the comparison result of the first hash value and the second hash value.

[0102] In a possible implementation, after receiving the first hash value sent by the vehicle, the data flashing device can compare the first hash value with the second hash value determined locally, and thus determine the flashing result of the data to be flashed based on whether the first hash value and the second hash value are consistent.

[0103] In some embodiments, when the first hash value is consistent with the second hash value, it is determined that the flashing of the data to be flashed is successful; or, when the first hash value is inconsistent with the second hash value, it is determined that the flashing of the data to be flashed fails.

[0104] In the embodiments of the present application, the present application can determine that the flashing of the data to be flashed is successful when the first hash value is consistent with the second hash value, and determine that the flashing of the data to be flashed fails when the first hash value is inconsistent with the second hash value. In this way, according to the comparison result of the first hash value and the second hash value, it can be accurately determined whether the flashing of the data to be flashed is successful.

[0105] In a possible implementation, after the flashing of the data to be flashed is completed (flashing successfully or failing), the data flashing device can trigger the vehicle to exit the programming mode (i.e., exit the flashing mode).

[0106] Specifically, the data flashing device can send a service of 0x10 to the vehicle, so that the vehicle switches back to the default session mode, and triggers the electronic device (such as ECU) to automatically restart and load the new software version (i.e., the version corresponding to the data to be flashed).

[0107] In some embodiments, when the flashing result indicates that the flashing of the data to be flashed fails, the data flashing device can send a rollback message to the vehicle, so that the vehicle rolls back the software version of the electronic device, that is, rolls back the software version of the electronic device to the version before flashing (the old version).

[0108] Among them, the rollback message is used to instruct the vehicle to load the historical software version data of the electronic device from the backup data. The failure of the flashing of the data to be flashed includes at least one of the following: the first hash value is inconsistent with the second hash value, the data flashing device is disconnected from the vehicle, the data verification result indicates that the data block includes error data, the confirmation character indicates that the data block is lost, and the electronic device does not respond.

[0109] Optionally, when the flashing of the data to be flashed fails, it is necessary to analyze the recorded log. The error code (such as UDS NRC 0x72 indicates response timeout) is recorded in the log, so as to trigger the vehicle to load the historical software version data of the electronic device from the backup data based on the saved log (including timestamp, network status), so as to roll back the software version of the electronic device to the version before flashing.

[0110] In the embodiments of the present application, when the data to be flashed fails to be flashed, the present application can trigger the vehicle to roll back the software version of the electronic device to the previous historical software version through a rollback message, thus avoiding the inavailability of the functions of the electronic device caused by the flashing failure. Thereby improving the running safety of the vehicle.

[0111] In the embodiments of the present application, the present application can send the data to be flashed to the vehicle through a diagnostic communication protocol based on Ethernet to update the software version of the electronic device in the vehicle. And, in the case where the data to be flashed is successfully transmitted, by obtaining the first hash value determined by the vehicle based on the received data and the second hash value determined based on the data to be flashed, and according to the comparison result of the first hash value and the second hash value, the flashing result of the data to be flashed is determined. In this way, since the diagnostic communication protocol based on Ethernet allows diagnostic operations to be performed through Ethernet and has high bandwidth, flexibility and security, the electronic devices in the vehicle can be flashed efficiently and safely. And, by comparing the hash value of the data to be flashed with the hash value of the data received by the vehicle, it can be determined whether the flashing is successful. In this way, the efficiency and security of flashing the electronic devices of the vehicle can be improved.

[0112] In some embodiments, the data to be flashed includes multiple data blocks, such as Figure 3 As shown, in a data flashing method provided by an embodiment of the present application, before the above S202, specifically, S301-S302 may further be included:

[0113] S301. Receive the data verification result of each data block returned by the vehicle.

[0114] Among them, the data verification result is used to indicate whether the data block includes error data.

[0115] In a possible implementation manner, the data flashing device may divide the data to be flashed into blocks according to a size of 8KB-64KB to obtain multiple data blocks, so as to transmit the data to be flashed in segments, and thus transmit these data blocks based on the DoIP protocol.

[0116] In some embodiments, each data block in the multiple data blocks includes data of a preset data volume, and the preset data volume is determined based on a flashing tool in the data flashing device.

[0117] It can be understood that the size of each data block can be determined according to the flashing tool (such as the size of ECU Flash).

[0118] In an embodiment of the present application, the present application can determine the data volume of each data block included in the data to be flashed based on the performance or characteristics of the flashing tool in the data flashing device. Thus, the data to be flashed can be accurately divided into data blocks according to the flashing tool in the data flashing device, and the data to be flashed can be efficiently sent to the vehicle.

[0119] In a possible implementation, the data flashing device sends one data block to the vehicle each time, and the vehicle can return the corresponding CRC check result (i.e., data check result) to the data flashing device through the ECU.

[0120] Optionally, if the data check result indicates that a certain data block fails the check (the data block received by the vehicle includes incorrect data), retransmission of this data block needs to be triggered.

[0121] S302. When the data check result of each data block indicates that the data block does not include incorrect data and the acknowledgment character of each data block is received within a preset time period, it is determined that the data to be flashed is successfully transmitted.

[0122] Wherein, the acknowledgment character is used to indicate that the data block is not lost.

[0123] In a possible implementation, network exception handling also needs to be performed, such as packet loss detection. Specifically, it can be determined whether there is packet loss by judging whether the received acknowledgment character (Acknowledge character, ACK) times out.

[0124] Optionally, after the data flashing device sends one data block to the vehicle each time, the vehicle needs to return an acknowledgment character to the data flashing device within a preset time period to indicate whether the data block is received.

[0125] It can be understood that if the data check result of each data block indicates that the data block does not include incorrect data, it can be determined that the data information included in each data block received by the vehicle is correct; and if the acknowledgment character of each data block is received within a preset time period, it can be indicated that the vehicle has received all the data blocks (i.e., multiple data blocks) included in the data to be flashed.

[0126] In an embodiment of the present application, the present application can determine whether a data block includes incorrect data based on the data check result of each data block returned by the vehicle, and determine whether the data block is lost based on whether the acknowledgment character of each data block is received within a preset time period. Thus, based on the data check result and acknowledgment character of each data block, it can be determined whether the data to be flashed is successfully transmitted. In this way, the transmission result of the data to be flashed can be accurately judged.

[0127] In some embodiments, such as Figure 4As shown in the figure, in a data writing method provided by an embodiment of the present application, the above S201 may specifically include S401 - S403:

[0128] S401. When connected to the vehicle, receive the dynamic password sent by the vehicle.

[0129] It should be noted that before the data writing device sends the data to be written to the vehicle, a physical connection needs to be established with the vehicle first.

[0130] Specifically, the data writing device can use an Ethernet cable to connect to the vehicle (such as the DoIP port of the in - vehicle gateway or ECU), and when ensuring that the network link indicator light is normal (for example, the green light is always on indicating a successful physical layer connection), it is determined that the connection with the vehicle is successful.

[0131] In some embodiments, the data writing device establishing a connection with the vehicle may specifically include: the data writing device sends a routing activation request to the vehicle, so that the vehicle returns a routing activation response to the data writing device. Thus, the data writing device responds to the routing activation response returned by the vehicle and establishes a connection with the vehicle. Among them, the routing activation request is used to activate a preset protocol, so that a connection is established between the data writing device and the vehicle based on the preset protocol.

[0132] Specifically, the data writing device can send a routing activation request (RoutingActivation Request) of the DoIP protocol to the vehicle. A logical address (i.e., the address of the electronic device) is specified in this routing activation request. Thus, the vehicle can return a corresponding routing activation response to the data writing device through the ECU, and it is confirmed that the data writing device and the vehicle are in a connected state.

[0133] In the embodiment of the present application, the present application can send a routing activation request to the vehicle to activate a preset protocol. Thus, when the routing activation response returned by the vehicle is obtained, a connection is established with the vehicle based on the activated preset protocol. Thus, the electronic devices in the vehicle can be efficiently and safely written through the preset protocol.

[0134] It should be noted that the dynamic password can also be called an authentication seed, and specifically can be a random number sent by the vehicle. The data writing device can obtain the dynamic password from the vehicle based on the 0x27 service 27 01 request.

[0135] S402. Determine the authentication key based on the dynamic password and send the authentication key to the vehicle.

[0136] Among them, the authentication key is used to instruct the vehicle to switch to the writing mode (Bootloader mode).

[0137] In a possible implementation, after obtaining the dynamic password, the data writing device can determine the corresponding authentication key according to a security algorithm. And based on Service 0x27 02, send the authentication key to the vehicle. Thus, after the vehicle verifies the received authentication key to determine its accuracy, it determines whether to unlock the electronic device (i.e., switch to the writing mode, also known as the programming mode).

[0138] Optionally, after the vehicle switches to the writing mode, the vehicle can return a mode switching response to the data writing device to inform the data writing device that the vehicle is in the writing mode.

[0139] S403. In response to the mode switching response sent by the vehicle, send the data to be written to the vehicle through a preset protocol.

[0140] Among them, the mode switching response is used to indicate that the vehicle has switched to the writing mode.

[0141] Optionally, before sending the data to be written to the vehicle through a preset protocol, the storage partition in the vehicle can also be erased. Specifically, it can send Service 0x31 (routine control) to the vehicle to make the vehicle perform a Flash erase operation to erase the historical software version of the electronic device stored in the storage partition.

[0142] In the embodiments of the present application, the present application can determine the authentication key based on the dynamic password sent by the vehicle and send the authentication key to the vehicle to instruct the vehicle to switch to the writing mode. Thus, when obtaining the mode switching response sent by the vehicle and confirming that the vehicle is in the writing mode, the data to be written is sent to the vehicle. In this way, through the dynamic password and the authentication key, the vehicle is triggered to switch modes, and only in the writing mode can the electronic device in the vehicle be written. The data security of the vehicle can be guaranteed.

[0143] In some embodiments, as Figure 5 shown, in a data writing method provided by the embodiments of the present application, the above method may specifically further include S501-S502:

[0144] S501. In the case where the data to be written is written, perform a function test on the electronic device in the vehicle.

[0145] In some embodiments, the functional test includes at least one of the following: communication check, memory verification, diagnostic service coverage test, compatibility test, stress test, network interference test; the communication check is used to determine whether the software version number of the electronic device is updated, the memory verification is used to determine whether the data stored in the vehicle is the data to be flashed, the diagnostic service coverage test is used to test the electronic device through the Unified Diagnostic Service (UDS), the compatibility test is used to determine the compatibility between the electronic device and other modules, the stress test is used to repeatedly execute the flashing process of the data to be flashed on the vehicle, and the network interference test is used to determine the anti-interference ability of the electronic device through network noise.

[0146] Optionally, the data flashing device can send diagnostic service 0x22 to the vehicle to read the data identifier (decentralized identity) to verify whether the communication function of the electronic device in the vehicle is normal.

[0147] Optionally, the data flashing device can read the key address in the Flash storage area of the vehicle (i.e., the storage address of the software data packet stored in the vehicle controller) to determine whether the data stored in the vehicle is the data to be flashed.

[0148] Optionally, the data flashing device can execute the full set of UDS (ISO 14229) service tests (such as 0x19 read DTC, 0x14 clear trouble code, etc.) to perform a diagnostic service coverage test on the electronic device.

[0149] Optionally, the data flashing device can verify the protocol compatibility between the electronic device (such as ECU) in the vehicle and the associated module (such as CANdb version, Autosar configuration) to perform a compatibility test.

[0150] Optionally, the data flashing device can repeatedly execute the diagnostic flashing service under the full-load operation state of the electronic device to perform a stress test and verify the stability of the electronic device.

[0151] Optionally, the data flashing device can inject network noise (such as EMC interference) into the vehicle to perform a network interference test and check the anti-interference ability of the flashed electronic device.

[0152] In the embodiments of the present application, the present application can perform at least one of the following functional tests on the electronic device in the vehicle: communication check, memory verification, diagnostic service coverage test, compatibility test, stress test, network interference test, to verify the function of the electronic device after the data flashing is completed, so as to ensure the effectiveness of the data flashing.

[0153] S502. Generate a test report if the functional test passes.

[0154] In an embodiment of the present application, the present application can further perform a functional test on the electronic devices in the vehicle when the data to be flashed is successfully flashed, so as to generate a test report when the functional test passes. In this way, by further performing a functional test on the electronic devices, it can be further detected whether the flashing of the electronic devices is successful.

[0155] In some embodiments, the functional test includes a signal transmission test; as Figure 6 shown, in a data flashing method provided by an embodiment of the present application, the above S501 may specifically include S601 - S604:

[0156] S601. Send a test signal to the electronic device.

[0157] S602. Receive the test response signal returned by the electronic device.

[0158] Optionally, the data flashing device can send an input of an analog CAN signal (i.e., a test signal, such as the throttle pedal position) to the electronic device to verify whether the output signal of the electronic device (i.e., the test response signal, such as the torque command) meets the expectation.

[0159] S603. Obtain the waveforms of the test signal and the test response signal through an oscilloscope.

[0160] Specifically, the data flashing device can use an oscilloscope to capture the waveforms of the test signal and the test response signal, and determine the response duration of the electronic device to the test signal based on the waveforms of the test signal and the test response signal.

[0161] S604. Determine the functional test result of the signal transmission test based on the waveforms of the test signal and the test response signal.

[0162] Among them, the functional test result includes the response duration of the electronic device.

[0163] In this way, the response duration of the electronic device to the test signal determined by the waveforms of the test signal and the test response signal can indicate the functional test result of the signal transmission test. When the response duration exceeds the preset response duration, it is determined that the functional test result fails the test; when the response duration does not exceed the preset response duration, it is determined that the functional test result passes the test.

[0164] In an embodiment of the present application, the present application can send a test signal to an electronic device and receive a test response signal returned by the electronic device, so as to obtain the waveforms of the test signal and the test response signal through an oscilloscope. In this way, the waveforms of the test signal and the test response signal can be analyzed, and the response duration of the electronic device can be obtained. Then, based on the waveforms of the test signal and the test response signal, the functional test result of the signal transmission test can be determined. In this way, the signal input / output performance of the electronic device can be determined based on the response duration of the electronic device.

[0165] By providing a vehicle diagnosis and programming test method based on the DoIP protocol, the embodiment of the present application can solve the problems of low test efficiency, poor compatibility, and insufficient intelligence during vehicle diagnosis. It specifically includes the entire process of programming and testing, including three stages of programming: pre-programming, programming, and post-programming, as well as basic verification, functional testing, and exception handling and logging. By running the CAPL script through CANOE for programming and testing, based on the parsing of the programming file, decryption algorithm, CRC check, etc. included in the programming script, the test efficiency of DoIP programming can be improved, which helps with the intelligent analysis of test data and the ability of automated testing, effectively supports fault diagnosis and system verification, and improves the standardization.

[0166] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. To implement the above functions, the data programming device or electronic device includes the corresponding hardware structure and / or software module for executing each function. Those skilled in the art should easily realize that, combining the units and algorithm steps of each example described in the embodiments disclosed in this article, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0167] The embodiment of the present application can, according to the above method, exemplarily divide the functional modules of the data programming device or electronic device. For example, the data programming device or electronic device can include each functional module corresponding to each functional division, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of a software functional module. It should be noted that the division of modules in the embodiment of the present application is illustrative, only a logical function division, and there can be other division methods in actual implementation.

[0168] Figure 7 is a block diagram of a data programming device shown according to an exemplary embodiment. Refer to Figure 7, the data flashing device 700 includes: a sending module 701, an obtaining module 702, and a processing module 703; the sending module 701 is configured to send data to be flashed to a vehicle through a preset protocol, where the data to be flashed is used to update the software version of an electronic device in the vehicle, and the preset protocol is a diagnostic communication protocol based on Ethernet; the obtaining module 702 is configured to obtain a first hash value and a second hash value when the data to be flashed is successfully transmitted, where the first hash value is the hash value determined by the vehicle based on the received data, and the second hash value is the hash value determined based on the data to be flashed; the processing module 703 is configured to determine the flashing result of the data to be flashed according to the comparison result of the first hash value and the second hash value.

[0169] In a possible implementation, the data to be flashed includes multiple data blocks, and the obtaining module 702 is further configured to receive the data verification result of each data block returned by the vehicle, where the data verification result is used to indicate whether the data block includes error data; the processing module 703 is further configured to determine that the data to be flashed is successfully transmitted when the data verification result of each data block indicates that the data block does not include error data and an acknowledgement character of each data block is received within a preset time period, and the acknowledgement character is used to indicate that the data block is not lost.

[0170] In a possible implementation, each data block in the multiple data blocks includes a preset amount of data, and the preset amount of data is determined based on a flashing tool in the data flashing device.

[0171] In a possible implementation, the obtaining module 702 is further configured to receive a dynamic password sent by the vehicle when a connection is established with the vehicle; the processing module 703 is further configured to determine an authentication key based on the dynamic password; the sending module 701 is further configured to send the authentication key to the vehicle; the authentication key is used to indicate that the vehicle switches to a flashing mode; the sending module 701 is specifically configured to send the data to be flashed to the vehicle through a preset protocol in response to a mode switching response sent by the vehicle, and the mode switching response is used to indicate that the vehicle has switched to the flashing mode.

[0172] In a possible implementation, the sending module 701 is further configured to send a routing activation request to the vehicle, where the routing activation request is used to activate the preset protocol; the processing module 703 is further configured to establish a connection with the vehicle in response to a routing activation response returned by the vehicle.

[0173] In a possible implementation, the processing module 703 is further configured to perform a function test on an electronic device in the vehicle when the data to be flashed is flashed; the processing module 703 is further configured to generate a test report when the function test passes.

[0174] In a possible implementation, the functional test includes a signal transmission test; the sending module 701 is further configured to send a test signal to the electronic device; the obtaining module 702 is further configured to receive a test response signal returned by the electronic device; the processing module 703 is specifically configured to obtain the waveforms of the test signal and the test response signal through an oscilloscope; the processing module 703 is specifically configured to determine the functional test result of the signal transmission test based on the waveforms of the test signal and the test response signal, and the functional test result includes the response duration of the electronic device.

[0175] In a possible implementation, the functional test further includes at least one of the following: communication check, memory verification, diagnostic service coverage test, compatibility test, stress test, network interference test; the communication check is used to determine whether the software version number of the electronic device is updated, the memory verification is used to determine whether the data stored in the vehicle is the data to be flashed, the diagnostic service coverage test is used to test the electronic device through the unified diagnostic service UDS, the compatibility test is used to determine the compatibility between the electronic device and other modules, the stress test is used to repeatedly execute the flashing process of the data to be flashed on the vehicle, and the network interference test is used to determine the anti-interference ability of the electronic device through network noise.

[0176] In a possible implementation, the sending module 701 is further configured to send a rollback message to the vehicle in the case where the flashing of the data to be flashed fails, and the rollback message is used to instruct the vehicle to load the historical software version data of the electronic device from the backup data. The failure of the flashing of the data to be flashed includes at least one of the following: the first hash value is inconsistent with the second hash value, the data flashing device is disconnected from the vehicle, the data verification result indicates that the data block includes error data, the acknowledgment character indicates that the data block is lost, and the electronic device has no response.

[0177] In a possible implementation, the processing module 703 is specifically configured to determine that the flashing of the data to be flashed is successful when the first hash value is consistent with the second hash value; or, the processing module 703 is specifically configured to determine that the flashing of the data to be flashed fails when the first hash value is inconsistent with the second hash value.

[0178] Regarding the device in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated here.

[0179] Figure 8 is a block diagram of an electronic device shown according to an exemplary embodiment. As Figure 8 shown, the electronic device 800 includes but is not limited to: a processor 801 and a memory 802.

[0180] Among them, the above-mentioned memory 802 is used to store executable instructions of the above-mentioned processor 801. It can be understood that the above-mentioned processor 801 is configured to execute instructions to implement the data rewriting method in the above-mentioned embodiments.

[0181] It should be noted that those skilled in the art can understand that Figure 8 the structure of the electronic device shown in does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than Figure 8 shown, or combine certain components, or have different component arrangements.

[0182] The processor 801 is the control center of the electronic device, connecting various parts of the entire electronic device through various interfaces and lines. By running or executing software programs and / or modules stored in the memory 802, and calling data stored in the memory 802, it executes various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. The processor 801 may include one or more processing units. Optionally, the processor 801 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor may not be integrated into the processor 801 either.

[0183] The memory 802 can be used to store software programs and various data. The memory 802 mainly includes a program storage area and a data storage area. Among them, the program storage area can store the operating system, application programs required by at least one functional module (such as the processing module 703, etc.). In addition, the memory 802 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0184] In an exemplary embodiment, there is also provided a computer-readable storage medium including instructions, such as the memory 802 including instructions. The above-mentioned instructions can be executed by the processor 801 of the electronic device 800 to implement the data rewriting method in the above-mentioned embodiments.

[0185] In actual implementation, Figure 7 the functions of the sending module 701, the obtaining module 702, and the processing module 703 in can be Figure 8 implemented by the processor 801 in calling the computer program stored in the memory 802. The specific execution process can refer to the description of the data rewriting method part in the above embodiments, and will not be elaborated here.

[0186] Optionally, the computer-readable storage medium may be a non-transitory computer-readable storage medium. For example, the non-transitory computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0187] In an exemplary embodiment, the embodiments of the present application further provide a computer program product including one or more instructions, and the one or more instructions can be executed by the processor 801 of the electronic device 800 to complete the data writing method in the above embodiments.

[0188] It should be noted that when the instructions in the above computer-readable storage medium or the one or more instructions in the computer program product are executed by the processor of the electronic device, the various processes of the data writing method embodiment are implemented, and the same technical effects as the above data writing method can be achieved. To avoid repetition, it will not be elaborated here.

[0189] Through the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and brevity of description, only the above division of each functional module is used as an example. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.

[0190] In several embodiments provided in the present application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some interfaces. The indirect coupling or communication connection of the device or unit may be in an electrical, mechanical or other form.

[0191] The units described as separate components may or may not be physically separated. The components displayed as units may be one physical unit or multiple physical units, that is, they may be located in one place, or they may be distributed to multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0192] In addition, in each embodiment of the present application, each functional unit can be integrated into one processing unit, can exist separately physically for each unit, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0193] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to enable a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods of the various embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical discs that can store program codes.

[0194] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A data writing method, characterized in that, The method includes: Sending data to be flashed to the vehicle through a preset protocol, where the data to be flashed is used to update the software version of the electronic device in the vehicle, and the preset protocol is a diagnostic communication protocol based on Ethernet; When the data to be flashed is successfully transmitted, obtaining a first hash value and a second hash value, where the first hash value is the hash value determined by the vehicle based on the received data, and the second hash value is the hash value determined based on the data to be flashed; Determining the flashing result of the data to be flashed according to the comparison result of the first hash value and the second hash value.

2. The data flashing method according to claim 1, wherein The data to be flashed includes multiple data blocks, and the method further includes: Receiving the data verification result of each data block returned by the vehicle, where the data verification result is used to indicate whether the data block includes error data; When the data verification result of each data block indicates that the data block does not include error data and the acknowledgment character of each data block is received within a preset time period, determining that the data to be flashed is successfully transmitted, where the acknowledgment character is used to indicate that the data block is not lost.

3. The data flashing method according to claim 2, wherein Each data block in the multiple data blocks includes a preset amount of data, and the preset amount of data is determined based on the flashing tool in the data flashing device.

4. The data flashing method according to claim 1, characterized in that The sending the data to be flashed to the vehicle through the preset protocol includes: When establishing a connection with the vehicle, receiving the dynamic password sent by the vehicle; Determining an authentication key based on the dynamic password and sending the authentication key to the vehicle; the authentication key is used to instruct the vehicle to switch to the flashing mode; In response to the mode switching response sent by the vehicle, sending the data to be flashed to the vehicle through the preset protocol, where the mode switching response is used to indicate that the vehicle has switched to the flashing mode.

5. The data flashing method according to claim 4, wherein The method further includes: Sending a routing activation request to the vehicle, where the routing activation request is used to activate the preset protocol; In response to the routing activation response returned by the vehicle, establishing a connection with the vehicle.

6. The data flashing method according to claim 1, wherein The method further includes: When the flashing of the data to be flashed is completed, performing a function test on the electronic device in the vehicle; When the function test passes, generating a test report.

7. The data flashing method according to claim 6, wherein The function test includes a signal transmission test; The performing a function test on the electronic device in the vehicle includes: Sending a test signal to the electronic device; Receiving the test response signal returned by the electronic device; Obtaining the waveforms of the test signal and the test response signal through an oscilloscope; Determining the function test result of the signal transmission test based on the waveforms of the test signal and the test response signal, where the function test result includes the response duration of the electronic device.

8. The data flashing method according to claim 6, wherein The functional test further includes at least one of the following: communication check, memory verification, diagnostic service coverage test, compatibility test, stress test, network interference test; the communication check is used to determine whether the software version number of the electronic device is updated, the memory verification is used to determine whether the data stored in the vehicle is the data to be flashed, the diagnostic service coverage test is used to test the electronic device through the unified diagnostic service UDS, the compatibility test is used to determine the compatibility between the electronic device and other modules, the stress test is used to repeatedly execute the flashing process of the data to be flashed on the vehicle, and the network interference test is used to determine the anti-interference ability of the electronic device through network noise.

9. The data flashing method according to claim 1, wherein The method further includes: In the case where the flashing of the data to be flashed fails, a rollback message is sent to the vehicle, and the rollback message is used to instruct the vehicle to load the historical software version data of the electronic device from the backup data. The failure of the flashing of the data to be flashed includes at least one of the following: the first hash value is inconsistent with the second hash value, the data flashing device is disconnected from the vehicle, the data verification result indicates that the data block includes error data, the acknowledgment character indicates that the data block is lost, and the electronic device does not respond.

10. The data flashing method according to claim 1, wherein Determining the flashing result of the data to be flashed according to the comparison result of the first hash value and the second hash value includes: In the case where the first hash value is consistent with the second hash value, it is determined that the flashing of the data to be flashed is successful; Or, in the case where the first hash value is inconsistent with the second hash value, it is determined that the flashing of the data to be flashed fails.

11. A data flashing device, characterized in that, The data flashing device includes: a sending module, an obtaining module, and a processing module; The sending module is configured to send the data to be flashed to the vehicle through a preset protocol, and the data to be flashed is used to update the software version of the electronic device in the vehicle, and the preset protocol is a diagnostic communication protocol based on Ethernet; The obtaining module is configured to obtain a first hash value and a second hash value in the case where the transmission of the data to be flashed is successful. The first hash value is the hash value determined by the vehicle based on the received data, and the second hash value is the hash value determined based on the data to be flashed; The processing module is configured to determine the flashing result of the data to be flashed according to the comparison result of the first hash value and the second hash value.

12. An electronic device, characterized in that, Includes: A processor; A memory for storing executable instructions of the processor; Wherein, the processor is configured to execute the instructions to implement the data flashing method according to any one of claims 1-10.

Citation Information

Cited By

  • Safe flashing method and system for vehicle, client side and server side

    CN121637478A