CN112015453A - Firmware upgrading method for OBD (on-Board diagnostics) embedded equipment - Google Patents

Firmware upgrading method for OBD (on-Board diagnostics) embedded equipment Download PDF

Info

Publication number
CN112015453A
CN112015453A CN202010957982.9A CN202010957982A CN112015453A CN 112015453 A CN112015453 A CN 112015453A CN 202010957982 A CN202010957982 A CN 202010957982A CN 112015453 A CN112015453 A CN 112015453A
Authority
CN
China
Prior art keywords
downloader
obd
packet
target equipment
target
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
CN202010957982.9A
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.)
Asiatelco Technologies Shanghai Co ltd
Original Assignee
Asiatelco Technologies Shanghai 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 Asiatelco Technologies Shanghai Co ltd filed Critical Asiatelco Technologies Shanghai Co ltd
Priority to CN202010957982.9A priority Critical patent/CN112015453A/en
Publication of CN112015453A publication Critical patent/CN112015453A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention is suitable for the technical field of firmware upgrading of OBD embedded equipment, and provides a firmware upgrading method of the OBD embedded equipment, which comprises the steps of providing a downloader with an OBD interface and pre-storing an upgrading file into the downloader; after the downloader is connected with target equipment through an OBD interface, the maximum CAN rate and the CAN packet size of the target equipment are obtained; sending the maximum CAN rate and the maximum CAN packet length supported by the downloader to the target equipment; adapting hardware performance of a downloader and target equipment; and sending the upgrade file to the target equipment. Therefore, the invention can give full play to the hardware performance of the target equipment and the downloader, has simple firmware upgrading process and does not need to disassemble and assemble the hardware.

Description

Firmware upgrading method for OBD (on-Board diagnostics) embedded equipment
Technical Field
The invention relates to the technical field of firmware upgrading of OBD (on-board diagnostics) embedded equipment, in particular to a firmware upgrading method of the OBD embedded equipment.
Background
Generally, the upgrading method of the firmware of the embedded device includes: 1. remote online upgrading; 2. upgrading is carried out through a JTAG/SWD interface of the micro-control processor. The remote online upgrade needs a network, mobile communication network standards (2G/3G/4G/5G) of different countries are different, and the network standard of the country producing the equipment is often different from that of the target consumption country of the equipment, so that the network standards are incompatible with each other. And a certain amount of flow is consumed by remote online upgrade, which causes some expense. Different network systems and different network environments are often inconsistent in speed, and the upgrading experience is influenced very quickly or slowly. Upgrading is carried out through a JTAG/SWD interface of the micro-control processor, after equipment is produced and a shell is installed, the shell is required to be disassembled, and the equipment is possibly damaged.
In view of the above, the prior art is obviously inconvenient and disadvantageous in practical use, and needs to be improved.
Disclosure of Invention
In view of the above-mentioned drawbacks, an object of the present invention is to provide a method for upgrading firmware of an OBD embedded device, which can save a certain production cost in the stages of factory production and after-sales repair.
In order to achieve the above object, the present invention provides an update method for firmware of an OBD embedded device, the method including
Providing a downloader with an OBD interface, and pre-storing an upgrade file into the downloader;
after the downloader is connected with target equipment through an OBD interface, the maximum CAN rate and the CAN packet size of the target equipment are obtained;
sending the maximum CAN rate and the maximum CAN packet length supported by the downloader to the target equipment;
adapting hardware performance of a downloader and target equipment;
and sending the upgrade file to the target equipment.
According to the firmware upgrading method of the OBD embedded device, the method further comprises the following steps:
after the target equipment receives the upgrading indication character, sending information whether the upgrading file needs to be cut into a plurality of parts for transmission to a downloader;
and if the sub-packet transmission is needed, the target device sends the byte number of each sub-packet to the downloader.
According to the firmware upgrading method of the OBD embedded device, the step of sending the upgrading file to the target device comprises the following steps:
and after one packet is transmitted, the downloader transmits the next packet after obtaining the correct packet check value.
The firmware upgrading method of the OBD embedded equipment comprises the following steps:
and the downloader judges whether all the data are sent completely, and if so, inquires the target equipment to update the integral check value of the data packet.
According to the firmware upgrading method of the OBD embedded device, the method further comprises the following steps:
if an unrecoverable exception occurs during the firmware upgrade process, the upgrade is stopped and prompt information is sent.
According to the firmware upgrading method of the OBD embedded device, if the packet check value is wrong, whether the maximum value of the packet retransmission times is reached or not is judged, and if not, retransmission processing is carried out.
According to the firmware upgrading method of the OBD embedded device, the downloader supports an FDCAN bus and is provided with a USB interface and an external FLASH memory.
The invention is suitable for the technical field of firmware upgrading of OBD embedded equipment, and provides a firmware upgrading method of the OBD embedded equipment, which comprises the steps of providing a downloader with an OBD interface and pre-storing an upgrading file into the downloader; after the downloader is connected with target equipment through an OBD interface, the maximum CAN rate and the CAN packet size of the target equipment are obtained; sending the maximum CAN rate and the maximum CAN packet length supported by the downloader to the target equipment; adapting hardware performance of a downloader and target equipment; and sending the upgrade file to the target equipment. Therefore, the invention can give full play to the hardware performance of the target equipment and the downloader, has simple firmware upgrading process and does not need to disassemble and assemble the hardware.
Drawings
FIG. 1 is a flow chart of a method of the present invention;
FIG. 2 is a flow chart of a method according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, the present invention provides an OBD embedded device firmware upgrade method, which includes the following steps:
step S101, providing a downloader with an OBD interface, and pre-storing an upgrade file into the downloader.
And step S102, after the downloader is connected with the target equipment through the OBD interface, the maximum CAN rate and the CAN packet size of the target equipment are obtained.
The invention connects the target OBD equipment to the downloader through the OBD interface, connects the power supply and initializes
Various bus and peripheral resources are initialized. The target device sends an instruction to the downloader through a serial port (UART) or starts an upgrading process through a key.
And step S103, the downloader sends the maximum CAN rate and the maximum CAN packet length supported by the downloader to the target equipment.
And step S104, adapting the hardware performance of the downloader and the target device.
And step S105, sending the upgrade file to the target equipment.
During the firmware upgrade process of the target device by the downloader, the upgrade is stopped if unrecoverable exception occurs, and different exception types are indicated by different LED lamp states. These error indication states need to be restored when the upgrade is started again.
In the specific upgrading process, only the equipment with the OBD interface is needed, the shell does not need to be disassembled, other downloading interfaces do not need to be added, and the equipment software can be upgraded without a mobile network, so that the production cost is saved, and the operation and maintenance cost is saved. And the downloader rate is stable, can compatible different grades of OBD equipment to make full use of OBD equipment self hardware performance, the file transmission process is reliable. The downloader of the invention has the following functions:
1) supporting an FDCAN bus;
the FDCAN bus has variable speed, and the maximum speed CAN reach 5Mbp/s (the classic CAN is 1 Mbp/s);
the maximum length of the FDCAN data packet is 64Bytes (the classic CAN is 8 Bytes);
FDCAN CAN be offline compatible with Classic CAN.
2) The method supports external Flash and can support larger firmware;
3) the USB bus is supported, and the firmware to be upgraded can be stored in the external Flash of the downloader like a USB Flash disk;
4) file transfer protocol based on FDCAN;
transmission rate negotiation with a target device
Packet size negotiation with a target device
Whether a positive acknowledgement is required with the target device, and the interval of the positive acknowledgement
Packet loss retransmission mechanism
Positive acknowledgement timeout retransmission mechanism
Target device anomaly monitoring
And in the transmission process, the integrity and the correctness of the data are verified.
After connection initialization is established, the method is executed according to the following steps in combination with the step shown in fig. 2:
after the connection is established, the downloader queries the target device for the maximum CAN rate and CAN packet size.
The maximum supported rate of the classic CAN is 1Mbp/s and the maximum supported rate of the FDCAN is 5 Mbp/s. The maximum packet size supported by classicccan is 8bytes, and the maximum packet size supported by FDCAN is 64 bytes. In order to fully exploit the performance of the hardware and to be compatible with different devices, it is first necessary to confirm the rate and packet length used by the downloader and the target device during the upgrade process.
And the downloader informs the target equipment of the maximum CAN rate and the maximum CAN packet length supported by the downloader. If the hardware performance of the downloader is not as high as that of the target device, the target device needs to switch to the corresponding rate and the corresponding data packet length after receiving the information provided by the downloader, so that the CAN rate and the CAN packet length of the target device are matched with the downloader. On the contrary, if the hardware performance of the downloader is higher than that of the target device, the downloader switches the hardware performance of the downloader according to the hardware performance of the target device, namely, the CAN rate and the CAN packet length of the downloader are adjusted to be matched with the target device.
After adapting the hardware performance, the downloader queries the CAN rate and CAN packet length switching ready state of the target device. After the rate and packet length are switched, communication needs to be performed at a new rate and packet length, and thus it is necessary to confirm whether the target device is ready.
And if the target equipment can not complete the rate and packet length switching in the specified time, judging that the target equipment fails to switch. The invention CAN also indicate the CAN rate CAN packet length switching failure of the target equipment through the LED lamp.
Before the upgrade begins, the downloader may tell the target device that the upgrade is about to begin, and the number of bytes of the upgrade file it tells.
After the target device receives the upgrade indication characters, the target device can tell the downloader whether the upgrade file needs to be cut into a plurality of parts for transmission, namely sub-package transmission. If the transmission of the sub-packets is needed, the target device needs to be high-compliant with a downloader, and the number of bytes of each sub-packet is large. Only after one packet transmission is completed, the downloader obtains the correct packet check value, and the downloader will perform the transmission of the next packet. If the data does not need to be transmitted in a subpackaging way, the downloader sends all the data to the target device at one time.
After all the upgrade file data is sent to the target device, the downloader queries the verification value of the entire file received by the target device. And the downloader calculates the check value of the local whole upgrade file, compares the check value with the check value returned by the target equipment, if the check value is equal to the check value, the upgrade is successful, and otherwise, the upgrade fails.
If the target device informs the downloader that the sub-packages are required to be transmitted, the downloader can cut the upgrade file into a plurality of sub-packages for transmission according to the sub-package size provided by the target device. When the target device receives a packet, the target device sends a check value of the packet to the downloader. The downloader compares the packet check value provided by the target device with the local packet check value, and if the packet check value is not equal to the local packet check value, the packet check value is wrong. If the packet check value is correct, the downloader will determine whether all data has been sent. And if all the data packets are sent out, inquiring the overall check value of the upgrading data packet of the target equipment. If the packet check value is wrong, firstly judging whether the maximum value of the packet retransmission times is reached, if not, retransmitting. And if the packet check value is wrong and the maximum value of the packet retransmission times is not reached, retransmitting the packet. If the packet check value is wrong and the maximum value of the packet retransmission times is reached, the LED lamp is used for indicating the packet retransmission failure error.
The invention can upgrade the equipment software for the equipment with only the OBD interface without disassembling the shell, increasing other downloading interfaces and passing through a mobile network, thereby saving the production cost and the operation and maintenance cost. And can be compatible with different grades of OBD equipment, and make full use of the hardware performance of OBD equipment itself.
On the software implementation: the invention can adopt C or C + + language; 2. a driver;
corresponding bus driving is realized according to the specific MCU and the plug-in Flash, and the read, write and erase functions of the Flash are realized;
the USB interface initialization and data transmission driving are realized according to a specific MCU;
and realizing the initialization drive of the FDCAN controller according to a specific MCU.
3. Carrying a USB flash memory class library;
4. file transfer protocol
Defining some structural bodies for storing the type of CAN bus supported by the equipment, the supporting transmission rate, the size of a data packet, a mark for judging whether a positive acknowledgement is needed or not and the interval of the positive acknowledgement;
at the beginning stage of file transmission, information is exchanged through the structure body, and parameters supported together are used as final parameters;
in the file transmission stage, if a positive acknowledgement is needed, after the downloader sends data of a corresponding packet number, the positive acknowledgement of the target device is waited; (the positive acknowledgement needs to contain the check information, the request information of the next packet) if waiting for the response overtime, resend the data packet several times. And if no response still exists after a plurality of times, judging that the target equipment is abnormal.
In summary, the present invention is applicable to the technical field of firmware upgrade of an OBD embedded device, and provides a firmware upgrade method of an OBD embedded device, where the method includes providing a downloader with an OBD interface, and prestoring an upgrade file into the downloader; after the downloader is connected with target equipment through an OBD interface, the maximum CAN rate and the CAN packet size of the target equipment are obtained; sending the maximum CAN rate and the maximum CAN packet length supported by the downloader to the target equipment; adapting hardware performance of a downloader and target equipment; and sending the upgrade file to the target equipment. Therefore, the invention can give full play to the hardware performance of the target equipment and the downloader, has simple firmware upgrading process and does not need to disassemble and assemble the hardware.
The present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof, and it should be understood that various changes and modifications can be effected therein by one skilled in the art without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (7)

1. An OBD embedded device firmware upgrading method is characterized by comprising
Providing a downloader with an OBD interface, and pre-storing an upgrade file into the downloader;
after the downloader is connected with target equipment through an OBD interface, the maximum CAN rate and the CAN packet size of the target equipment are obtained;
sending the maximum CAN rate and the maximum CAN packet length supported by the downloader to the target equipment;
adapting hardware performance of a downloader and target equipment;
and sending the upgrade file to the target equipment.
2. The firmware upgrade method for an OBD embedded device according to claim 1, wherein the step of sending the upgrade file to the target device comprises:
after the target equipment receives the upgrading indication character, sending information whether the upgrading file needs to be cut into a plurality of parts for transmission to a downloader;
and if the sub-packet transmission is needed, the target device sends the byte number of each sub-packet to the downloader.
3. The firmware upgrade method for an OBD embedded device according to claim 2, wherein the step of sending the upgrade file to the target device further comprises:
and after one packet is transmitted, the downloader transmits the next packet after obtaining the correct packet check value.
4. The firmware upgrade method for an OBD embedded device according to claim 1, wherein the step of sending the upgrade file to the target device comprises:
and the downloader judges whether all the data are sent completely, and if so, inquires the target equipment to update the integral check value of the data packet.
5. The OBD embedded device firmware upgrade method according to claim 1, further comprising:
if an unrecoverable exception occurs during the firmware upgrade process, the upgrade is stopped and prompt information is sent.
6. The firmware upgrade method for an OBD embedded device according to claim 3, wherein if the packet check value is wrong, it is determined whether the maximum value of the number of times of packet retransmission has been reached, and if not, the retransmission process is performed.
7. The firmware upgrade method for an OBD embedded device according to claim 1, wherein the downloader supports FDCAN bus and has a USB interface and an external FLASH memory.
CN202010957982.9A 2020-09-14 2020-09-14 Firmware upgrading method for OBD (on-Board diagnostics) embedded equipment Pending CN112015453A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010957982.9A CN112015453A (en) 2020-09-14 2020-09-14 Firmware upgrading method for OBD (on-Board diagnostics) embedded equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010957982.9A CN112015453A (en) 2020-09-14 2020-09-14 Firmware upgrading method for OBD (on-Board diagnostics) embedded equipment

Publications (1)

Publication Number Publication Date
CN112015453A true CN112015453A (en) 2020-12-01

Family

ID=73521394

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010957982.9A Pending CN112015453A (en) 2020-09-14 2020-09-14 Firmware upgrading method for OBD (on-Board diagnostics) embedded equipment

Country Status (1)

Country Link
CN (1) CN112015453A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160253849A1 (en) * 2015-02-27 2016-09-01 TrueLite Trace, Inc. Unknown on-board diagnostics (obd) protocol interpreter and conversion system
CN107943007A (en) * 2017-12-14 2018-04-20 吉旗(成都)科技有限公司 A kind of decoding method of different automobile types engine data
CN110134422A (en) * 2019-04-19 2019-08-16 东风汽车集团有限公司 System and method based on OBD and CAN bus downloading flash drive upgrade controller software
CN110557310A (en) * 2018-05-31 2019-12-10 迈来芯科技有限公司 Flexible data rate handling in a data bus receiver

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160253849A1 (en) * 2015-02-27 2016-09-01 TrueLite Trace, Inc. Unknown on-board diagnostics (obd) protocol interpreter and conversion system
CN107943007A (en) * 2017-12-14 2018-04-20 吉旗(成都)科技有限公司 A kind of decoding method of different automobile types engine data
CN110557310A (en) * 2018-05-31 2019-12-10 迈来芯科技有限公司 Flexible data rate handling in a data bus receiver
CN110134422A (en) * 2019-04-19 2019-08-16 东风汽车集团有限公司 System and method based on OBD and CAN bus downloading flash drive upgrade controller software

Similar Documents

Publication Publication Date Title
CN103530146B (en) Low-power-consumption embedded equipment remote radio upgrade method
EP1152338A2 (en) Method and apparatus for downloading firmware
CN111694579A (en) Remote upgrading method of energy storage system, energy management system and battery management system
CN101605189B (en) System and method for upgrading intelligent platform management controller (IPMC) on line
CN108337120A (en) A kind of remote upgrade method of internet-of-things terminal equipment
CN102185754B (en) Method for upgrading board card in switch system
CN109857437A (en) A kind of upgrade method and system of bluetooth equipment
CN101621411B (en) Method and system for remotely updating microcontrollers
WO2010135897A1 (en) Firmware over the air upgrade method and apparatus for exclusive flash compound device
CN110262820A (en) Method, apparatus, system and storage medium based on MQTT protocol realization OTA upgrading
CN113746892B (en) Remote upgrading method and wireless terminal equipment
US20030033026A1 (en) Drive controller operator interface and serial protocol
CN114915671A (en) NB-IoT-based remote upgrading method for street lamp controller
KR101428778B1 (en) Apparatus and method for upgrading firmware of automatic meter reading terminal on the remote
CN108958781B (en) Remote embedded firmware online upgrading method
CN114020304A (en) LoRaWan-based OTA implementation method, terminal device and computer storage medium
CN112015453A (en) Firmware upgrading method for OBD (on-Board diagnostics) embedded equipment
CN109889368B (en) GPRS remote upgrading method based on STM32 controller
CN110308916B (en) OTA upgrading method, device, equipment, system and storage medium based on lorawan protocol
CN114745740B (en) Intelligent household appliance upgrading system and method
JP3545659B2 (en) Program updating method and communication terminal device
US20040127202A1 (en) Method for remotely updating software for radio port
CN113849213A (en) OTA (over the air) upgrading system and method of edge device
CN114020294A (en) Method, system and storage medium for wireless upgrading of ECU
CN112905206A (en) Circuit upgrading method based on serial port

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: 20201201

RJ01 Rejection of invention patent application after publication