CN110851163B - Software updating method compatible with multi-equipment platform based on CAN communication - Google Patents

Software updating method compatible with multi-equipment platform based on CAN communication Download PDF

Info

Publication number
CN110851163B
CN110851163B CN201911107841.1A CN201911107841A CN110851163B CN 110851163 B CN110851163 B CN 110851163B CN 201911107841 A CN201911107841 A CN 201911107841A CN 110851163 B CN110851163 B CN 110851163B
Authority
CN
China
Prior art keywords
software
downloading
upper computer
computer
lower computer
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.)
Active
Application number
CN201911107841.1A
Other languages
Chinese (zh)
Other versions
CN110851163A (en
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.)
Shaanxi Heavy Duty Automobile Co Ltd
Original Assignee
Shaanxi Heavy Duty Automobile 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 Shaanxi Heavy Duty Automobile Co Ltd filed Critical Shaanxi Heavy Duty Automobile Co Ltd
Priority to CN201911107841.1A priority Critical patent/CN110851163B/en
Publication of CN110851163A publication Critical patent/CN110851163A/en
Application granted granted Critical
Publication of CN110851163B publication Critical patent/CN110851163B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

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 discloses a software updating method compatible with a multi-device platform based on CAN communication, 1. An upper computer is connected with a lower computer by adopting downloading devices of different types, a downloading device driver is arranged in the upper computer, and an API interface object is created in the upper computer in each connection; 2. connecting an upper computer with a lower computer by adopting downloading equipment, matching an API interface object corresponding to the downloading equipment, and selecting a downloading equipment driver corresponding to the type of the downloading equipment from the upper computer; 3. the upper computer firstly sends a BootLoader request instruction to the lower computer at regular time, the lower computer enters the BootLoader after receiving the BootLoader request, and then the upper computer transmits software update data to the lower computer through a CAN communication protocol, and programming the lower computer by using a programming instruction; 4. after all the software data to be updated are downloaded, the updating is completed. When different download device drivers are used, different software is not opened any more, so that the time cost is greatly saved.

Description

Software updating method compatible with multi-equipment platform based on CAN communication
Technical Field
The invention relates to the technical field of automobile equipment, in particular to a software updating method compatible with a multi-equipment platform based on CAN communication.
Background
With the development of information technology, more and more functions are integrated into the meter and the vehicle body control module, the complex program of the software is increased, the designer may not be able to realize each detail of the meter function at the early stage of the design of the meter and the vehicle body control module, on the other hand, the end user may also put forward some new demands, and the meter and the vehicle body control module are required to be matched for implementation, which inevitably leads to the modification and upgrading of the meter and the vehicle body control module software.
Currently, two main methods for updating software of industrial vehicle instruments and vehicle body modules exist:
the first method is that the outer shell of the instrument and the automobile body control module is opened to expose the internal circuit board, the interface of programming software is reserved on the circuit board, the service personnel uses the notebook computer to connect the programming device used by the programming software, the programming interface of the programming device is connected with the programming interface of the circuit board of the instrument and the automobile body control module, then the software to be updated is programmed to the singlechip on line, and the instrument and the automobile body control module are reassembled after the completion. The disadvantage of this method is apparent in that the housing of the instrument and the body control module has to be disassembled, which is likely to be a considerable time and effort due to the different mounting locations and mounting patterns of the instrument and the body control module;
the second method is that the software to be updated is sent to the instrument and the vehicle body control module through the CAN bus by utilizing the CAN bus network of the whole vehicle, when a service person adopts different downloading devices such as USB drive, WIFi-CAN drive and the like, correspondingly, different downloading software also needs to be opened, so that the time for searching the software by the service person is increased, and after a plurality of software are opened, background resources cannot be released, which is unacceptable to the service person.
Disclosure of Invention
The invention aims to overcome the defects of the prior art, and provides a software updating method of a compatible multi-device platform based on CAN communication.
In order to achieve the purpose, the invention is realized by adopting the following technical scheme:
a software updating method compatible with a multi-device platform based on CAN communication comprises the following steps:
the method comprises the steps that firstly, an upper computer is connected with a lower computer by adopting different types of downloading equipment, downloading equipment drivers corresponding to the different types of downloading equipment are arranged in the upper computer, and an API interface object corresponding to the type of the downloading equipment is created in the upper computer every time of connection until the creation of the API interface objects of all used downloading equipment is completed;
connecting the upper computer with the lower computer by adopting downloading equipment, matching an API interface object corresponding to the downloading equipment, selecting a downloading equipment driver corresponding to the type of the downloading equipment from the upper computer, and completing connection;
step three, after the connection is completed, the lower computer starts to download the software update data from the upper computer: the upper computer firstly sends a BootLoader request instruction to the lower computer at regular time, the lower computer enters the BootLoader after receiving the BootLoader request, and then the upper computer transmits software update data to the lower computer through a CAN communication protocol, and programming the lower computer by using a programming instruction;
and step four, after the downloading of all the software data to be updated is completed, the updating is completed.
Preferably, in the first step, after the upper computer is connected with the lower computer, an API interface is created in the upper computer, a driving method of the downloading device is defined, then implementation classes of APIs are created according to different downloading device drivers, an abstract method of a driving function of the downloading device in the API interface is implemented, and finally, an implementation class corresponding to the downloading device type is selected through a factory class to create an API interface object.
Preferably, in the third step, when the upper computer sends data to the lower computer, the software update data is sent line by line, and software update is performed, wherein at least two characters in each line of the software update data represent a group of 16-system data.
Further, before the upper computer sends data to the lower computer, the upper computer analyzes the software update data, wherein the analysis format of the software update data is BBAATTHHHHHHCC, and BB represents the number of bytes of the length of the data; AA represents a start address of a data record; TT represents a record type, wherein 00 represents a data record type, 01 represents a file record end type, 02 represents an extended segment address record type, and 04 represents an extended linear address record; HH...hh represents downloaded data; CC represents a check code.
In the third step, before downloading, the upper computer sends an erasing command to the lower computer according to the address information of the analyzed software updating data, and erases the Flash and EEPROM area to be programmed.
Preferably, in the third step, after the lower computer enters the BootLoader, a hardware filter is used to filter out the CAN message irrelevant to the BootLoader function.
Preferably, in the third step, when receiving the interrupt, the message is placed in a software buffer of the lower computer, and when processing the message, the message is sequentially taken out from the software buffer.
Preferably, in the third step, the lower computer is provided with an NVM driving module, and the control register can implement self-programming during operation through a TBLRD read table, a TBLWT write table and the NVM driving module.
Compared with the prior art, the invention has the following beneficial effects:
according to the software updating method, based on the CAN bus network architecture of the vehicle, the corresponding API interface objects are created for different types of downloading equipment, so that the corresponding API interface objects are matched when the downloading equipment is connected, seamless switching of the downloading equipment drive is realized, a stable and reliable program downloading function is realized, program updating of the vehicle instrument and the vehicle body control module CAN be realized by utilizing the CAN bus network of the vehicle, different downloading equipment drives are supported, and the time consumed by a service person for opening different adapting software is saved.
Furthermore, the hardware filter is used for filtering irrelevant CAN messages, so that the load of a CPU CAN be reduced.
Further, when receiving the interrupt, the message is placed in a software buffer of a lower computer, and the message is sequentially taken out from the software buffer when being processed, so that frame loss caused by overflow of the buffer can be prevented.
Drawings
FIG. 1 is a UML diagram of the present invention;
FIG. 2 is a communication flow chart of the upper computer and the lower computer of the present invention;
FIG. 3 is a first interface diagram of software in the host computer according to the present invention;
fig. 4 is a second interface diagram of software in the host computer according to the present invention.
Detailed Description
The invention is further described below with reference to the accompanying drawings.
The invention provides a software updating method compatible with a multi-device platform based on CAN communication, the whole idea of the method is based on a CAN bus network architecture of a vehicle, and a stable and reliable program downloading function is realized by using Bootloader comprising basic function modules such as starting management, bottom driving, communication service and the like and by seamless switching of downloading device driving; meanwhile, the information interaction between the upper computer and the lower computer is simplified through communication service, and in the embodiment, the upper computer adopts a computer, and the lower computer is an instrument and a vehicle body control module; CAN communication modules are arranged in the downloading equipment and the lower computer.
The software updating method of the compatible multi-equipment platform based on CAN communication, which is provided by the invention, comprises the following steps:
and step one, selecting different driving options on the device connection interface according to different download device drivers.
As shown in fig. 1, a UML diagram of a multi-device platform compatible with CAN communication is shown, and in step one, switching between different download device drivers is performed as follows:
firstly, creating an API interface shown in fig. 1, defining an operation method, and downloading methods such as opening connection, data receiving and sending, closing connection and the like of a device driver. And then creating realization classes of the API, such as an ImpA class and an ImpB class, according to different download device drivers, simultaneously realizing abstract methods of opening connection, data receiving and sending, closing connection and the like of the download device drivers in an API interface, and finally selecting a proper realization class to create an API interface object through a simpleFacto factory class.
When the upper computer is connected with the lower computer, the upper computer acquires the API interface object through the factory class and then programs the API interface.
And secondly, selecting a target hex file from a program downloading interface and analyzing the target hex file.
The software update data is stored in the hex file, and the hex file is parsed as follows:
the characteristics of data are recorded row by row according to the hex file, each row is read from ": "initially, every at least two characters represents a set of 16-ary data in the format: bbaatthhhh. Where BB represents the number of bytes of the data length of the row. AA denotes the start address of the data record. TT denotes a record type, wherein 00 denotes a data record type, 01 denotes a file record end type, 02 denotes an extended segment address record type, and 04 denotes an extended linear address record. HH.. CC represents a check code.
Step three, as shown in a communication flow chart of the upper computer, the instrument and the vehicle body control module, in the process of downloading a program, the upper computer firstly transmits a BootLoader request instruction at regular time, the instrument and the vehicle body control module enter the BootLoader after receiving the BootLoader request, and after the instrument and the vehicle body control module enter the BootLoader, the upper computer transmits an erasing instruction to the instrument and the vehicle body control module according to the address information of the analyzed hex file, and erases Flash and EEPROM areas to be programmed; then, the upper computer sequentially transmits data to the instrument and the vehicle body control module in each row through a data packet transmission service, namely a CAN communication protocol, and the number of bytes transmitted by the upper computer each time CAN be determined according to software, the memory of the instrument and the vehicle body control module, the size of a hex file, the number of programmed bytes and the like; and finally, the upper computer programs the instrument and the vehicle body control module by using programming instructions, performs data verification on a programming area after programming is finished, and downloads the data in a circulating way until all data are downloaded.
Bootloader is organized as follows:
and (3) starting a management module: the instrument and the vehicle body control module firstly enter the starting management module after being electrified, and the instrument and the vehicle body control module can jump to the processing function of the starting management module after being electrified by modifying the linker description file. The module guides the program to enter the user program or Bootloader program through the application program valid mark and Bootloader request mark.
The communication protocol processing module: and data communication between the software and the instrument and body control module is realized through predefined services, including services such as BootLoader request.
And a driving module: first, memory address allocation: the user program is typically stored in memory space immediately following the interrupt vector table, while the BootLoader is placed in the highest address area of the application memory area. The storage space of the lower computer is allocated as follows: reset vector addresses are placed in 0x 000000-0 x000004, interrupt vector tables are placed in 0x 000004-0 x000100, application programs are placed in 0x 000100-0 x000A00, and application programs are placed in 0x000A 00-0 x00 AFFE. And secondly, a CAN driving module, which is used for filtering CAN messages irrelevant to a BootLoader function after entering the BootLoader in order to reduce the load of the CPU. Meanwhile, in order to prevent frame loss caused by buffer overflow, messages are placed in a software buffer of a lower computer when receiving interruption, and are sequentially taken out from the software buffer when processing the messages. Finally, the NVM driving module is a nonvolatile memory, the NVM driving module contained in the instrument and vehicle body control module comprises Flash and EEPROM, and the self-programming of the operation is realized by the TBLRD reading table, the TBLWT writing table and the NVM driving module.
The screen shots of the software interfaces of the compatible multi-device platform based on CAN communication are shown in fig. 3 and 4, the software of the upper computer is realized through java, a 'connection' menu is clicked, a download device driver selection interface is entered, and after the device driver is selected, other options are gray. And clicking a download menu to enter a download interface, and transmitting data to the instrument and the vehicle body control module by selecting the target equipment and the boot mode.
Finally, it should be noted that: the above embodiments are merely illustrative of the technical solution and not limiting thereof; although described in detail with reference to preferred embodiments, those of ordinary skill in the art will appreciate that: modifications may be made to the specific embodiments or equivalents may be substituted for elements thereof without departing from the spirit of the claims, which are intended to be encompassed within the scope of the claims.

Claims (6)

1. A software updating method compatible with a multi-device platform based on CAN communication is characterized by comprising the following steps:
firstly, an upper computer is connected with a lower computer by adopting different types of downloading equipment, after the upper computer is connected with the lower computer, firstly, an API interface is created in the upper computer, a driving method of the downloading equipment is defined, then, the realization class of the API is created according to different downloading equipment driving, meanwhile, the abstract method of the driving function of the downloading equipment in the API interface is realized, and finally, the realization class corresponding to the downloading equipment type is selected through a factory class to create an API interface object; the upper computer is provided with downloading device drivers corresponding to different types of downloading devices, and an API interface object corresponding to the type of the downloading device is created in the upper computer every time of connection until the creation of the API interface objects of all used downloading devices is completed;
connecting the upper computer with the lower computer by adopting downloading equipment, matching an API interface object corresponding to the downloading equipment, selecting a downloading equipment driver corresponding to the type of the downloading equipment from the upper computer, and completing connection;
step three, after the connection is completed, the lower computer starts to download the software update data from the upper computer: the upper computer firstly sends a BootLoader request instruction to the lower computer at regular time, the lower computer enters the BootLoader after receiving the BootLoader request, and then the upper computer transmits software update data to the lower computer through a CAN communication protocol, and programming the lower computer by using a programming instruction; when the upper computer sends data to the lower computer, the software updating data is sent line by line to update the software, and at least two characters in each line of the software updating data represent a group of 16-system data;
and step four, after the downloading of all the software data to be updated is completed, the updating is completed.
2. The software updating method of the compatible multi-device platform based on CAN communication according to claim 1, wherein the upper computer analyzes the software updating data before the upper computer sends the data to the lower computer.
3. The software updating method of compatible multi-device platform based on CAN communication according to claim 2, wherein in step three, the upper computer sends an erasing command to the lower computer according to the address information of the analyzed software updating data before downloading, erases the Flash and EEPROM area to be programmed.
4. The method for updating software of a compatible multi-device platform based on CAN communication according to claim 1, wherein in the third step, a hardware filter is used to filter out CAN messages irrelevant to the BootLoader function after the lower computer enters the BootLoader.
5. The method for updating software of a compatible multi-device platform based on CAN communication according to claim 1, wherein in the third step, when receiving an interrupt, a message is placed in a software buffer of a lower computer, and when processing the message, the message is sequentially fetched from the software buffer.
6. The software updating method of compatible multi-device platform based on CAN communication according to claim 1, wherein in step three, the lower computer is provided with an NVM driving module, and the control register realizes the self programming during the operation through a TBLRD reading table, a TBLWT writing table and an NVM driving module.
CN201911107841.1A 2019-11-13 2019-11-13 Software updating method compatible with multi-equipment platform based on CAN communication Active CN110851163B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911107841.1A CN110851163B (en) 2019-11-13 2019-11-13 Software updating method compatible with multi-equipment platform based on CAN communication

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911107841.1A CN110851163B (en) 2019-11-13 2019-11-13 Software updating method compatible with multi-equipment platform based on CAN communication

Publications (2)

Publication Number Publication Date
CN110851163A CN110851163A (en) 2020-02-28
CN110851163B true CN110851163B (en) 2023-04-28

Family

ID=69600291

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911107841.1A Active CN110851163B (en) 2019-11-13 2019-11-13 Software updating method compatible with multi-equipment platform based on CAN communication

Country Status (1)

Country Link
CN (1) CN110851163B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111552190B (en) * 2020-04-24 2024-01-30 杭州涂鸦信息技术有限公司 Method, system and device for controlling functions of hardware equipment
CN112857409B (en) * 2020-12-31 2022-08-09 华中光电技术研究所(中国船舶重工集团公司第七一七研究所) Automatic data acquisition and analysis system of cold atom interferometer
CN114036080A (en) * 2021-11-09 2022-02-11 许昌许继软件技术有限公司 Method and device for upgrading program by using communication serial port of display terminal
CN117092958B (en) * 2023-10-17 2024-01-12 浙江正泰中自控制工程有限公司 Multi-platform controller synchronization method of software defined hardware

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102115036B1 (en) * 2013-10-24 2020-05-26 두산인프라코어 주식회사 Communication stabilization system and the method, When the controller software updating
CN103617061A (en) * 2013-12-05 2014-03-05 中国航空无线电电子研究所 Method for multi-node on-line software updating on basis of ARM
CN108628624A (en) * 2018-04-08 2018-10-09 华南理工大学 A method of the multinode microcontroller online updating code based on CAN bus

Also Published As

Publication number Publication date
CN110851163A (en) 2020-02-28

Similar Documents

Publication Publication Date Title
CN110851163B (en) Software updating method compatible with multi-equipment platform based on CAN communication
US7669186B2 (en) Debugging applications at resource constrained virtual machines using dynamically installable lightweight agents
FI114602B (en) A method and apparatus for programming update information on a network unit to a mobile station
US20090172219A1 (en) Device and method for automatically launching applications residing on usb flash drives
US20090198770A1 (en) System and method of updating codes in controller
CN110597542B (en) Software automatic OTA (over the air) upgrading method and device and electronic equipment
US20060200815A1 (en) Electronic Device and Method for Updating Related Programs
CN106598647B (en) Intelligent device development platform
CN112947977A (en) Software online upgrading method and system
CN106796521B (en) API version control independent of product release
CN113741944A (en) Machine program system with upgrading function, upgrading method and application
CN113608772A (en) Application program upgrading method and device
CN103092654A (en) Web-based operating system (WebOS) implementation method and system based on WebKit
CN104035757A (en) MIPS-based (microprocessor without interlocked piped stages-based) U-boot (universal boot loader) transplantation implementing method
US20070233750A1 (en) Data control apparatus and method
US7047283B1 (en) Apparatus and method of upgrading program of firmware board
CN113448643B (en) Configuration data management system and method
CN106919391A (en) Towards the embedded system of the customizable operating system component of smart mobile phone
CN112667265B (en) Method and device for updating bootstrap program
CN114035853A (en) MCU bootstrap system and chip that possess SPI interface
CN111566617A (en) Firmware upgrading method and device for unmanned aerial vehicle, control device, unmanned aerial vehicle and medium
CN109254787A (en) Service logic variation, device, storage medium and electronic equipment
CN109426511A (en) Soft core update method and system
CN108536458A (en) A kind of FPGA online upgradings method, apparatus, equipment and storage medium
CN107729090A (en) A kind of user program method for down loading based on Serial Port Transmission

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
GR01 Patent grant
GR01 Patent grant