CN111399472A - ECU (electronic control unit) flashing device and method - Google Patents

ECU (electronic control unit) flashing device and method Download PDF

Info

Publication number
CN111399472A
CN111399472A CN201910004028.5A CN201910004028A CN111399472A CN 111399472 A CN111399472 A CN 111399472A CN 201910004028 A CN201910004028 A CN 201910004028A CN 111399472 A CN111399472 A CN 111399472A
Authority
CN
China
Prior art keywords
ecu
flash
circuit
flashing
control circuit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910004028.5A
Other languages
Chinese (zh)
Inventor
谢昊原
于洪涛
宋铁兵
代培培
谢立哲
白宝国
宫雨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BAIC Motor Powertrain Co Ltd
Original Assignee
BAIC Motor Powertrain Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BAIC Motor Powertrain Co Ltd filed Critical BAIC Motor Powertrain Co Ltd
Priority to CN201910004028.5A priority Critical patent/CN111399472A/en
Publication of CN111399472A publication Critical patent/CN111399472A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B23/00Testing or monitoring of control systems or parts thereof
    • G05B23/02Electric testing or monitoring
    • G05B23/0205Electric testing or monitoring by means of a monitoring system capable of detecting and responding to faults
    • G05B23/0208Electric testing or monitoring by means of a monitoring system capable of detecting and responding to faults characterized by the configuration of the monitoring system
    • G05B23/0213Modular or universal configuration of the monitoring system, e.g. monitoring system having modules that may be combined to build monitoring program; monitoring system that can be applied to legacy systems; adaptable monitoring system; using different communication protocols

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Information Transfer Systems (AREA)

Abstract

The embodiment of the invention provides an ECU (electronic control unit) flashing device and a flashing method, wherein the ECU flashing device comprises a Universal Serial Bus (USB) interface circuit, a Controller Area Network (CAN) transceiver circuit and a flashing control circuit; the USB interface circuit is used for carrying out USB communication with an upper computer; the CAN transceiver circuit is used for carrying out CAN communication with an Electronic Control Unit (ECU); the first end of the flash control circuit is connected with the USB interface circuit, the second end of the flash control circuit is connected with the CAN transceiver circuit, the flash control circuit is used for acquiring the flash data sent by the upper computer through the USB interface circuit and sending the flash data to the ECU through the CAN transceiver circuit so as to perform flash. The embodiment of the invention provides the ECU flash device with simple structure and strong practicability.

Description

ECU (electronic control unit) flashing device and method
Technical Field
The embodiment of the invention relates to the technical field of automobiles, in particular to an ECU (electronic control unit) flashing device and a flashing method.
Background
With the rapid development of automotive technology and electronic technology, the modern automotive industry has widely adopted electronic control technology to improve the dynamic property, economy, drivability, safety, comfort and reduce exhaust emission pollution. The electronic control technology is an important trend and sign of modern automobile technology development, and the electronic control technology is generally adopted from fuel injection, ignition control, air intake control, emission control and fault self-diagnosis of an engine to a transmission system, a steering and braking system, an automatic transmission, an automobile body, an auxiliary device and the like of a chassis, and the application of the automobile electronic control technology plays an increasingly important role in the modern automobile industry.
An ECU (Electronic Control Unit) is currently the most important Electronic system controller of an automobile, and is also called a "driving computer" or an "on-board computer". It is composed of microprocessor (CPU), read-only memory (ROM), Random Access Memory (RAM), input/output interface (I/O), A/D converter and large scale integrated circuit for shaping and driving, etc. as common computer. The ECU acquires the working state information of each part of the engine through a temperature sensor, a pressure sensor, a rotation sensor, a flow sensor, a position sensor, an oxygen sensor, a knock sensor and the like, processes and analyzes the received information, controls air intake, oil injection and ignition of the engine according to a control program and software data, and ensures the normal operation of the engine. The ECU software data can be divided into a plurality of data areas according to different properties of control tasks, such as a part information configuration area, a power parameter area, an emission parameter area, a fault diagnosis area and the like.
Development and debugging of automotive electronic system controllers has a significant impact on developing automotive electronic systems. At present, for the flash of ECU software data, in order to avoid destructive disassembly and assembly of an ECU, data interaction is generally performed with the ECU through an OBD interface based on a CAN (Controller Area Network) communication protocol ISO 15765. The current ECU writing tool has a complex structure and is expensive.
Disclosure of Invention
The embodiment of the invention provides an ECU (electronic control unit) flashing device and a flashing method, which are used for solving the problems that an ECU flashing tool in the prior art is complex in structure and expensive in price.
In a first aspect, an embodiment of the present invention provides an ECU flashing device, configured to flash an ECU, where the ECU flashing device includes a USB interface circuit, a controller area network CAN transceiver circuit, and a flashing control circuit;
the USB interface circuit is used for carrying out USB communication with an upper computer;
the CAN transceiver circuit is used for carrying out CAN communication with an Electronic Control Unit (ECU);
the first end of the flash control circuit is connected with the USB interface circuit, the second end of the flash control circuit is connected with the CAN transceiver circuit, the flash control circuit is used for acquiring the flash data sent by the upper computer through the USB interface circuit and sending the flash data to the ECU through the CAN transceiver circuit so as to perform flash.
In a second aspect, an embodiment of the present invention provides an ECU flashing system, including an upper computer and the ECU flashing apparatus according to the embodiment of the present invention.
In a third aspect, an embodiment of the present invention provides an ECU flashing method applied to an ECU flashing apparatus according to an embodiment of the present invention, where the method includes:
the flash control circuit acquires the flash data sent by the upper computer through the USB interface circuit;
and the flash control circuit sends the flash data to the ECU through the CAN transceiving circuit so as to perform flash.
In a fourth aspect, an embodiment of the present invention provides an ECU flashing method, which is applied to an upper computer, where the upper computer is an upper computer in an ECU flashing system, and the ECU flashing system is the ECU flashing system according to the embodiment of the present invention, and the method includes:
determining a virtual serial port corresponding to the ECU flash device;
analyzing ECU software to be flashed according to a preset rule;
and sending the analyzed ECU software to the ECU flash device through the virtual serial port according to an ECU session command so that the ECU flash device performs flash on the ECU.
In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored, the program, when executed by a processor, implementing the steps in the ECU flashing method applied to the ECU flashing apparatus in the embodiment of the present invention, or the program, when executed by the processor, implementing the steps in the ECU flashing method applied to the upper computer in the embodiment of the present invention.
The ECU flash device comprises a Universal Serial Bus (USB) interface circuit, a Controller Area Network (CAN) transceiver circuit and a flash control circuit, wherein the first end of the flash control circuit is connected with the USB interface circuit, the second end of the flash control circuit is connected with the CAN transceiver circuit, and the flash control circuit is used for acquiring flash data sent by an upper computer through the USB interface circuit and sending the flash data to the ECU through the CAN transceiver circuit for flash. The embodiment of the invention provides the ECU flash device with simple structure and strong practicability.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive exercise.
FIG. 1 is a schematic structural diagram of an ECU flashing device provided by an embodiment of the invention;
FIG. 2 is a pin diagram of a single chip microcomputer of the type STM32F407VGT6 provided by the embodiment of the present invention;
fig. 3 is a schematic structural diagram of a USB interface circuit according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a CAN transceiver circuit according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a power supply circuit according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an overload protection circuit according to an embodiment of the present invention;
FIG. 7 is a schematic flow chart diagram illustrating an ECU flashing method according to an embodiment of the present invention;
FIG. 8 is a flow chart of a flash control circuit for controlling a flash according to an embodiment of the present invention;
FIG. 9 is a schematic structural diagram of another ECU flashing device provided by the embodiment of the invention;
FIG. 10 is a schematic flow chart diagram illustrating another ECU flashing method provided by an embodiment of the present invention;
fig. 11 is a schematic flow chart of the host computer performing flash on the ECU according to the embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of an ECU flash device 1 according to an embodiment of the present invention, where the ECU flash device 1 according to the embodiment of the present invention is used to flash an ECU3, and the ECU flash device 1 includes a USB interface circuit 5, a CAN transceiver circuit 6 and a flash control circuit 4;
the USB interface circuit 5 is used for carrying out USB communication with the upper computer 2;
the CAN transceiver circuit 6 is used for CAN communication with the electronic control unit ECU 3;
the first end of the flash control circuit 4 is connected with the USB interface circuit 5, the second end of the flash control circuit 4 is connected with the CAN transceiver circuit 6, and the flash control circuit 4 is used for acquiring flash data sent by the upper computer 2 through the USB interface circuit 5 and sending the flash data to the ECU3 through the CAN transceiver circuit 6 so as to perform flash.
The ECU writing device 1CAN write the ECU of the engine, the upper computer 2 CAN be a computer, the writing control circuit 4 CAN be a single chip microcomputer, as a preferred embodiment, as shown in FIG. 2, the single chip microcomputer with the model of STM32F407VGT6 CAN be used as a lower computer, information interaction between the computer and the lower computer is established by using a USB communication interface protocol, data communication between the lower computer and the ECU is established by using a CAN network communication function interface of the single chip microcomputer with the model of STM32F407VGT6, the pin function of the single chip microcomputer is configured by programming, downloading and debugging of IAR software on the computer, data packets passing through a USB (Universal Serial Bus) interface circuit 5 and a CAN transceiver circuit 6 are processed to complete interaction of data content between the two, software which takes the computer as an upper computer platform CAN be compiled by using Visual Studio software and is used for controlling the writing of the ECU writing device 1, the ECU writing software writes sixteen flash data files developed by the ECU writing control software of the engine, the ECU writing data files into the CAN transceiver circuit according to the flash memory format, the flash memory data analysis of the lower data files and the flash memory data are returned to the USB session protocol, the flash memory data are analyzed by using a USB session protocol, the flash memory interface protocol, the flash memory controller reads the flash memory, and returns the flash memory, and the flash memory data to obtain the flash memory, the flash memory.
The ECU flash device 1 of the embodiment of the invention comprises a Universal Serial Bus (USB) interface circuit 5, a Controller Area Network (CAN) transceiver circuit 6 and a flash control circuit 4, wherein a first end of the flash control circuit 4 is connected with the USB interface circuit 5, a second end of the flash control circuit 4 is connected with the CAN transceiver circuit 6, and the flash control circuit 4 is used for acquiring flash data sent by an upper computer 2 through the USB interface circuit 5 and sending the flash data to an ECU through the CAN transceiver circuit 6 for flash. The ECU flash device 1 of the embodiment of the invention has the advantages of low cost, high flash speed and simple and convenient operation, and is particularly suitable for flash of ECU software in the development stage of an electronic injection control system of an engine, production offline and after sale of the ECU along with a whole vehicle. Optionally, as shown in fig. 3, the USB interface circuit 5 includes a USB interface 51 and an ESD (Electro-Static Discharge) protection circuit 52, a second end of the refresh control circuit 4 is electrically connected to the USB interface 51 and the ESD protection circuit 52, and the ESD protection circuit 52 is configured to Discharge Static electricity on the USB interface 51 for electrostatic protection.
The ESD protection circuit 52 may be designed by using a Transient Voltage Suppressor, for example, a TVS (Transient Voltage Suppressor) element NUP2202W1, and the single chip microcomputer may use the meaning STM32F407VGT6, as shown in fig. 3, PA11 and PA12 are pins of the single chip microcomputer STM32F407VGT6, and are respectively configured to be an OTG _ FS _ DM that is a USB data negative signal and an OTG _ FS _ DP that is a USB data positive signal. The PA11 is connected with a D-pin of the USB interface, and the PA12 is connected with a D + pin of the USB interface. The D + pin of NUP2202W1 is connected to PA11, and the D-pin of NUP2202W1 is connected to PA 12.
Static electricity on the USB interface is released through the ESD protection circuit, static electricity protection is achieved, and the service life of the ECU flash device 1can be prolonged.
In fig. 3, a first resistor labeled R1, a ground labeled GND and a voltage 5V labeled VCC, and the resistance of R1 may be 10K Ω.
Optionally, as shown in fig. 4, the CAN transceiver circuit 6 includes a CAN transceiver 61 and a data interface connector 62, a first end of the CAN transceiver 61 is electrically connected to the data interface connector 62, a second end of the CAN transceiver 61 is electrically connected to a second end of the flash control circuit 4, and the data interface connector 62 is used for connecting with the ECU.
Wherein, data interface connector 62 CAN adopt DB9 interface, and CAN transceiver 61 CAN adopt NCV734 chip, and the singlechip CAN adopt meaning STM32F407VGT6 chip, and this singlechip has two CAN passageways: a first CAN channel CAN1 and a second CAN channel CAN 2. The embodiment of the invention CAN be designed by adopting a first CAN channel CAN1, wherein PD0 and PD1 are pins of a singlechip STM32F407VGT6 and are respectively configured as a receiving channel which is CAN1_ RX and a transmitting channel which is CAN1_ TX, PD0 is connected with a D pin of an NCV734 chip, and PD1 is connected with an R pin of the NCV734 chip.
Communication between the flash control circuit and the ECU CAN be realized through the CAN transceiver and the data interface connector, and the structure is simpler.
In fig. 4, a second resistor is denoted by R2, a third resistor is denoted by R3, a fourth resistor is denoted by R4, a first capacitor is denoted by C1, and a ground is denoted by GND. The second resistor R2 may have a resistance of 10K Ω, the third resistor R3 may have a resistance of 60 Ω, the fourth resistor R4 may have a resistance of 60 Ω, and the first capacitor C1 may have a capacitance of 4.7 nF.
Optionally, as shown in fig. 1, the ECU flashing device 1 further includes a power supply circuit 7, and the power supply circuit 7 is connected to a third terminal of the flashing control circuit 4 and is configured to supply power to the flashing control circuit 4.
As shown in fig. 5, the power supply circuit 7 may adopt an L D3985M33R chip 71 to reduce the voltage of 5V to 3V, so as to supply power to the single chip microcomputer;
in fig. 5, a reference numeral C2 is a second capacitor, a reference numeral C3 is a third capacitor, a reference numeral C4 is a fourth capacitor, a reference numeral C5 is a fifth capacitor, a reference numeral C6 is a sixth capacitor, a reference numeral C7 is a seventh capacitor, a reference numeral C8 is an eighth capacitor, a reference numeral C9 is a ninth capacitor, a reference numeral C10 is a tenth capacitor, and a reference numeral D1 is a first diode. The capacitance of the tenth capacitor C10 may be 1 μ F, the capacitance of the second capacitor C2 may be 100nF, the capacitance of the third capacitor C3 may be 10nF, the capacitance of the fourth capacitor C4 may be 1 μ F, the capacitance of the fifth capacitor C5 may be 100nF, and the capacitance of the first diode D1 may be IN 4148. Meanwhile, the power supply circuit 7 is further designed with a sixth capacitor C6, a seventh capacitor C7, an eighth capacitor C8 and a ninth capacitor C9 to protect the power supply circuit 7 so as to prevent static electricity and the like from breaking down the integrated circuit inside the power supply circuit 7, and the capacitance values of the sixth capacitor C6, the seventh capacitor C7, the eighth capacitor C8 and the ninth capacitor C9 may all be 100 nF.
The power supply circuit is used for providing power supply for the flash control circuit, and the flash control circuit is safe and reliable.
Optionally, as shown in fig. 1, the ECU flashing device 1 further includes an overload protection circuit 8, and the power supply circuit 7 is connected to the third terminal of the flashing control circuit 4 through the overload protection circuit 8;
the overload protection circuit 8 is configured to detect a current output to the third terminal of the flash control circuit 4, and output a preset constant current to the third terminal of the flash control circuit 4 when it is determined that the current exceeds a preset current threshold, and the overload protection circuit 8 further includes an overheat protection switch, and when the temperature of the overload protection circuit 8 is higher than a preset temperature threshold, the overheat protection switch is turned off to stop the overload protection circuit 8.
As shown IN fig. 6, the overload protection circuit 8 may be implemented by using an STMPS2141STR chip 81, an EN pin of the STMPS2141STR chip 81 is connected to a 3V voltage signal output by the power supply circuit 7 through a sixth resistor R6, an IN pin of the STMPS2141STR chip 81 is connected to a 5V voltage signal, a FAU L T pin of the STMs 2141STR chip 81 is connected to a 3V voltage signal provided by the power supply circuit 7 through an eighth resistor R8, an OUT pin of the STMs 2141STR chip 81 is connected to one end of an eleventh resistor R11, the other end of the resistor R11 is connected to a base of a first triode T1, a collector of the first triode T1 is connected to a cathode of a second light emitting diode L2, an anode of the second light emitting diode L2 is connected to one end of a tenth resistor R10, the other end of the tenth resistor R10 is used for outputting the 3V voltage signal, specifically, the other end of the tenth resistor R38 may be connected to a power supply voltage signal pin of an STMs 3932F 407, and a voltage signal output pin of a single chip microcomputer STM 39407 and a power supply circuit for monitoring the voltage output of the single chip STM 26.
In fig. 6, a fifth resistor is denoted by reference numeral R5, a sixth resistor is denoted by reference numeral R6, a seventh resistor is denoted by reference numeral R7, an eighth resistor is denoted by reference numeral R8, a ninth resistor is denoted by reference numeral R9, a tenth resistor is denoted by reference numeral R10, an eleventh resistor is denoted by reference numeral R11, a first light emitting diode is denoted by reference numeral L ED1, a second light emitting diode is denoted by reference numeral L ED2, a first triode is denoted by reference numeral T1, an eleventh capacitor is denoted by reference numeral C11, and a ground terminal is denoted by reference numeral GND, the resistance value of the fifth resistor R5 may be 0 Ω, the resistance value of the sixth resistor R6 may be 10K Ω, the resistance value of the seventh resistor R7 may be 620, the resistance value of the eighth resistor R8 may be 47K Ω, the resistance value of the ninth resistor R9 may be 0 Ω, the tenth resistor R10 may be 0 Ω, the resistance value of the eleventh resistor R4613K 4647 Ω.
The reliability of the ECU flash apparatus 1can be improved by overload protection of the flash control circuit 4 by the overload protection circuit 8.
The embodiment of the invention also provides an ECU (electronic control unit) flashing system which comprises an upper computer and the ECU flashing device in the embodiment of the invention.
The ECU flash system of the embodiment of the invention has the advantages that the main components can adopt the single chip microcomputer and the computer, the structure is simple, the carrying is convenient, and the system can adapt to various external environments.
As shown in fig. 7, fig. 7 is a schematic flowchart of an ECU flashing method according to an embodiment of the present invention, where the method is applied to an ECU flashing apparatus according to an embodiment of the present invention, and the method includes:
101, the flash control circuit acquires the flash data sent by the upper computer through the USB interface circuit;
and 102, the flash control circuit sends the flash data to the ECU through the CAN transceiving circuit so as to carry out flash.
The flash control circuit realizes the communication between the upper computer and the ECU through the USB communication interface and the CAN network communication function interface.
Specifically, as shown in fig. 8, the flow of controlling the flash by the flash control circuit is as follows:
step 201, start;
step 202, setting a system clock, wherein the system clock is set to 168 MHz;
step 203, interrupt setting, starting USB Wake-up interrupt and USB global interrupt, CAN receiving interrupt and CAN1 receiving interrupt, and setting priority according to the priority order specified by the equipment;
step 204, setting a USB clock, wherein the USB clock is set to 115200 Hz;
step 205, initializing the USB, acquiring the ID information of the equipment, powering on the connecting equipment, initializing the USB equipment (opening a default channel and opening USB global interrupt), and setting the baud rate to be 115200 Hz.
Step 206, setting whether the configuration is finished, if so, executing step 207, and otherwise, continuing to wait for the initialization to be finished;
step 207, detecting that the USB suspends Suspend interruption, if detecting that the Suspend interruption occurs, executing step 208, otherwise, synchronously executing step 210 and step 213;
step 208, entering a suspension interrupt processing function OTGD _ FS _ Handle _ USBSuspend _ ISR;
step 209, end;
step 210, the CAN receives the marking variable of the data, if the marking variable of the data received by the CAN is detected to be not 0, step 211 is executed, otherwise, step 226 is executed;
step 211, CAN receives data mark variable clear 0;
step 212, sending data to the USB;
step 213, the USB receives the data, if it is detected that the USB receives the data, step 214 is executed, otherwise step 226 is executed;
step 214, setting data of the CAN with Class being 0x01, if detecting that the CAN with Class being 0x01, executing step 215, otherwise, executing step 219;
step 215, configuring CAN1, setting the baud rate to be 500KB/s, and performing CAN ID filtering setting;
step 216, opening a CAN2 channel, if the CAN2 channel is opened, executing step 217, otherwise executing step 218;
step 217, CAN2 configuration;
step 218, the USB receives a data flag clear 0;
step 219, the CAN receives a marking variable of the data, if the marking variable of the data received by the CAN is detected to be not 0, step 220 is executed, otherwise, step 224 is executed;
step 220, setting parameters of a data structure to be launched;
step 221, selecting a CAN channel to be sent;
step 222, the transmission is successful, if the transmission is successful, step 223 is executed, otherwise, the transmission is continuously waited;
step 223, the USB receives the data flag clear 0;
step 224, receiving data errors;
step 225, error processing;
step 226, interrupt type detection;
step 227, enter corresponding interrupt handling;
and step 228, ending.
The ECU flash device comprises a Universal Serial Bus (USB) interface circuit, a Controller Area Network (CAN) transceiver circuit and a flash control circuit, wherein the first end of the flash control circuit is connected with the USB interface circuit, the second end of the flash control circuit is connected with the CAN transceiver circuit, and the flash control circuit is used for acquiring flash data sent by an upper computer through the USB interface circuit and sending the flash data to the ECU through the CAN transceiver circuit for flash. The ECU flash device of the embodiment of the invention has the advantages of low cost, high flash speed and simple and convenient operation, and is particularly suitable for flash of ECU software in the development stage of an electronic injection control system of an engine, production offline and after sale of the ECU along with a whole vehicle.
Optionally, as shown in fig. 9, the flush control circuit 4 is provided with a first buffer area and a second buffer area, and after the flush control circuit 4 obtains the flush data sent by the upper computer through the USB interface circuit, the method further includes:
the flash control circuit stores the flash data into a first buffer area;
and the flash control circuit switches the second buffer area into a data buffer area.
The flash control circuit is provided with two memory areas, namely a first buffer area and a second buffer area, which are used as buffer areas for sending and receiving data, wherein the buffer areas are switched to the second buffer area after the first buffer area receives the data, the second buffer area receives the data, and after the second buffer area receives the data, the data in the first buffer area is sent, and then the buffer areas are switched to the first buffer area to receive the data, so that efficient data conversion and transmission are realized.
As shown in fig. 10, fig. 10 is a schematic flow chart of an ECU flashing method provided in an embodiment of the present invention, where the method is applied to an upper computer, the upper computer is an upper computer in an ECU flashing system, and the ECU flashing system is the ECU flashing system in the embodiment of the present invention, and the method includes:
and 301, determining a virtual serial port corresponding to the ECU flash device.
The upper computer software may perform serial communication Programming through an API (Application Programming Interface) function. Specifically, the method may include: opening a serial port, and opening the serial port by opening a file CreateFile function; configuring a serial port, opening a handle of the communication equipment, and configuring through an equipment control block DCB structure. The DCB structure comprises information such as baud rate, data bit number, parity check, stop bit number and the like, and when the attribute of the serial port is inquired or configured, the DCB structure is used as a buffer area, a GetCommState function for setting a read serial port is called to obtain the initial configuration of the serial port, and then a SetCommState function for setting the serial port is called; reading and writing a serial port, reading a specified number of characters in a serial port input buffer area through a read file ReadFile function, copying the specified number of characters into an output buffer area through a write file WriteFile function, and sending the characters out from the serial port; and closing the serial port, and calling a close handle CloseHandle function to close the serial port by using a handle returned by the created file CreateFile function as a parameter.
And step 302, analyzing the ECU software to be flashed according to a preset rule.
The ECU software to be flashed can be preprocessed at a high processing speed of the computer, analyzed according to a preset rule, the burden of a lower computer processor is reduced, and processed data are transmitted to the ECU through the ECU flashing device, so that the ECU flashing efficiency is improved.
Specifically, the preset rule may include:
the ASCII (American Standard Code for information exchange) Code of each line in the HEX file of the ECU software to be flashed is analyzed as follows:
the first byte represents the length of the data of the line;
the second and third bytes represent the initial address of the data of the line;
the fourth byte represents a data type including: '00' identification record data; '01' identifies the end of the HEX file; '02' identifies the record of the extended segment address; '03' identifies the start segment address record; '04' identifies the record of the extended linear address; '05' identifies the start linear address record;
32 bytes from the fifth byte to the second last byte are data areas;
the last byte is a check bit.
And analyzing all data in the HEX file, putting the data into a computer cache, and waiting for sending.
And 303, sending the analyzed ECU software to the ECU flash device through the virtual serial port according to an ECU session command so that the ECU flash device can flash the ECU.
The data can be erased and downloaded one by one in a software control logic area (address field 0x 00000000-0 x0003FFFF) and a software data area (address field 0x 00040000-0 x0013FFFF) according to an ECU access command and internal register area classification. As shown in fig. 11, the flashing of the ECU by the upper computer may include the following steps:
step 401, start;
step 402, flashing session, starting ECU flashing session through a virtual serial port on an upper computer interface;
step 403, safety access;
step 404, erasing the first block area, and erasing the data of the software control logic area;
step 405, downloading the first block area data;
step 406, quitting the data downloading;
step 407, erasing the second block area, and erasing the data in the software data area;
step 408, downloading the second block area data;
step 409, quitting data downloading;
step 410, checking;
step 411, restarting the ECU;
and step 412, ending.
As a specific embodiment, the software flashing of the ECU by the upper computer may include the steps of:
selecting a file: selecting ECU software needing to be flashed as a file in an HEX format;
selecting a virtual serial port COM port: selecting a virtual serial port COM port corresponding to the ECU flash device;
loading a file: analyzing the HEX file;
flashing the file: and writing the command into the memory of the ECU through the ECU flash device and the ECU conversation command.
The ECU flash method provided by the embodiment of the invention can be used for software flash of the engine electric control unit, and can realize flash for many times only by repeating the four steps within a certain time interval.
The ECU flash method of the embodiment of the invention is mainly automatically completed by a computer, has simple operation and convenient use, and has intuitive and reliable flash function; the whole flashing process is very fast, so the method can be widely applied to various stages of development, production and after-sale of automobile engines.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the embodiment of the ECU flashing method, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (10)

1. An ECU (electronic control unit) flash device is used for flash of an ECU and is characterized by comprising a Universal Serial Bus (USB) interface circuit, a Controller Area Network (CAN) transceiver circuit and a flash control circuit;
the USB interface circuit is used for carrying out USB communication with an upper computer;
the CAN transceiver circuit is used for carrying out CAN communication with an Electronic Control Unit (ECU);
the first end of the flash control circuit is connected with the USB interface circuit, the second end of the flash control circuit is connected with the CAN transceiver circuit, the flash control circuit is used for acquiring the flash data sent by the upper computer through the USB interface circuit and sending the flash data to the ECU through the CAN transceiver circuit so as to perform flash.
2. The ECU flash apparatus of claim 1, wherein the USB interface circuit comprises a USB interface and an ESD protection circuit, wherein a first terminal of the flash control circuit is electrically connected to the USB interface and the ESD protection circuit, respectively, and the ESD protection circuit is configured to discharge static electricity on the USB interface for electrostatic protection.
3. The ECU flash device of claim 2, wherein the CAN transceiver circuit includes a CAN transceiver and a data interface connector, a first end of the CAN transceiver being electrically connected to the data interface connector, a second end of the CAN transceiver being electrically connected to a second end of the flash control circuit, the data interface connector being for connection to the ECU.
4. The ECU flashing device of claim 1, further comprising a power supply circuit connected to a third terminal of the flashing control circuit for supplying power to the flashing control circuit.
5. The ECU flash apparatus of claim 4, further comprising an overload protection circuit, wherein the power supply circuit is connected to a third terminal of the flash control circuit through the overload protection circuit;
the overload protection circuit is used for detecting current output to a third end of the flash control circuit, outputting preset constant current to the third end of the flash control circuit when the current is judged to exceed a preset current threshold value, and also comprises an overheat protection switch, wherein when the temperature of the overload protection circuit is higher than a preset temperature threshold value, the overheat protection switch is switched off to enable the overload protection circuit to stop working.
6. An ECU flashing system comprising an upper computer and the ECU flashing device of any one of claims 1-5.
7. An ECU flashing method applied to the ECU flashing apparatus according to any one of claims 1 to 5, the method comprising:
the flash control circuit acquires the flash data sent by the upper computer through the USB interface circuit;
and the flash control circuit sends the flash data to the ECU through the CAN transceiving circuit so as to perform flash.
8. The ECU flashing method of claim 7, wherein the flashing control circuit is provided with a first buffer area and a second buffer area, and after the flashing control circuit obtains the flashing data sent by the upper computer through the USB interface circuit, the method further comprises:
the flash control circuit stores the flash data into a first buffer area;
and the flash control circuit switches the second buffer area into a data buffer area.
9. An ECU (electronic control unit) flashing method is applied to an upper computer, and is characterized in that the upper computer is an upper computer in an ECU flashing system, the ECU flashing system is the ECU flashing system of claim 6, and the method comprises the following steps:
determining a virtual serial port corresponding to the ECU flash device;
analyzing ECU software to be flashed according to a preset rule;
and sending the analyzed ECU software to the ECU flash device through the virtual serial port according to an ECU session command so that the ECU flash device performs flash on the ECU.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps in the ECU flashing method as claimed in any one of claims 7 to 8, or which, when being executed by a processor, carries out the steps in the ECU flashing method as claimed in claim 9.
CN201910004028.5A 2019-01-03 2019-01-03 ECU (electronic control unit) flashing device and method Pending CN111399472A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910004028.5A CN111399472A (en) 2019-01-03 2019-01-03 ECU (electronic control unit) flashing device and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910004028.5A CN111399472A (en) 2019-01-03 2019-01-03 ECU (electronic control unit) flashing device and method

Publications (1)

Publication Number Publication Date
CN111399472A true CN111399472A (en) 2020-07-10

Family

ID=71434269

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910004028.5A Pending CN111399472A (en) 2019-01-03 2019-01-03 ECU (electronic control unit) flashing device and method

Country Status (1)

Country Link
CN (1) CN111399472A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113359678A (en) * 2021-06-25 2021-09-07 潍柴动力股份有限公司 Engine data brushing device
CN114415645A (en) * 2022-03-15 2022-04-29 陕西汽车集团股份有限公司 Batch flash and test system and method for new energy commercial vehicle

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103455027A (en) * 2013-08-16 2013-12-18 深圳市元征科技股份有限公司 Automobile ECU recovery system and recovery method
DE102014210266A1 (en) * 2013-05-29 2014-12-04 Denso Corporation ELECTRONIC CONTROL UNIT AND MEMORY OVERRACKING PROCESS
CN104950881A (en) * 2015-07-20 2015-09-30 桂凌云 Data recorder, remote program updating system based on data recorder and application method of remote program updating system
CN204856198U (en) * 2015-07-20 2015-12-09 桂凌云 Data record appearance, based on long -range system that writes with a brush dipped in chinese ink of this record appearance
CN108712502A (en) * 2018-05-29 2018-10-26 深圳市元征科技股份有限公司 Vehicle diagnosis method and connector, electronic equipment, storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102014210266A1 (en) * 2013-05-29 2014-12-04 Denso Corporation ELECTRONIC CONTROL UNIT AND MEMORY OVERRACKING PROCESS
CN103455027A (en) * 2013-08-16 2013-12-18 深圳市元征科技股份有限公司 Automobile ECU recovery system and recovery method
CN104950881A (en) * 2015-07-20 2015-09-30 桂凌云 Data recorder, remote program updating system based on data recorder and application method of remote program updating system
CN204856198U (en) * 2015-07-20 2015-12-09 桂凌云 Data record appearance, based on long -range system that writes with a brush dipped in chinese ink of this record appearance
CN108712502A (en) * 2018-05-29 2018-10-26 深圳市元征科技股份有限公司 Vehicle diagnosis method and connector, electronic equipment, storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
杨胜兵,薛冰,万宏伟,范文涛: "基于LabVIEW的车辆ECU在线编程系统设计", 《自动化与仪表》 *
白同云: "《电磁兼容设计》", 30 June 2011, 北京邮电大学出版社 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113359678A (en) * 2021-06-25 2021-09-07 潍柴动力股份有限公司 Engine data brushing device
CN114415645A (en) * 2022-03-15 2022-04-29 陕西汽车集团股份有限公司 Batch flash and test system and method for new energy commercial vehicle
CN114415645B (en) * 2022-03-15 2024-03-29 陕西汽车集团股份有限公司 Batch brushing and testing system and method for new energy commercial vehicles

Similar Documents

Publication Publication Date Title
CN101957807B (en) Method for USB device to recognize version type of Windows operating system
CN107977212A (en) Support the high speed cd-rom recorder of multiple communication modes
CN103345243A (en) Method and device for brushing vehicle electronic control unit program
CN111399472A (en) ECU (electronic control unit) flashing device and method
US7684926B2 (en) Electronic control apparatus having first microcomputer which forwards externally supplied updating data to a second microcomputer having a lower data receiving performance than the first microcomputer
CN105116868A (en) Small-sized electric control gasoline engine touching-type HMI calibration method based on CAN bus
CN103544994B (en) Flash memory controller and flash memory debugging method
CN110371022B (en) Battery matching method and device and vehicle-mounted equipment
CN109446120B (en) USB device and method for identifying MacOS system by USB device
CN107395955A (en) Method for determining power-on time sequence of camera module and user terminal
CN202306218U (en) Programming circuit of automobile electronic controller
CN116560688B (en) Software updating method for domain controller
CN102207871A (en) PC(personal computer)-end ECU (electronic control unit) debugging software based on K line and KWP2000 protocol
CN117033321A (en) Log processing method of vehicle and related equipment
CN102890661A (en) Host-slave communication protocol
CN111447231A (en) Vehicle protocol identification method and device
CN104615387A (en) Vehicle-mounted equipment based on XPE system and design method of vehicle-mounted equipment
CN113918187A (en) Automobile instrument multi-chip upgrading system and method based on CAN bus
US20220012956A1 (en) Pass-through obd-ii diagnostic interface
CN114756585A (en) Vehicle data acquisition method and device, electronic equipment and storage medium
CN208653809U (en) A kind of online fault detection system of electric vehicle
CN114056266A (en) Shutdown method and system of application system during automobile flameout
CN112991578A (en) Vehicle data stream processing method and device, electronic equipment and electronic control unit
CN111522572A (en) Online upgrading method and system for embedded software
CN111679649A (en) Vehicle-mounted terminal starting method and device, terminal equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200710

RJ01 Rejection of invention patent application after publication