CN111459526A - Single chip microcomputer online upgrading method based on CAN communication - Google Patents
Single chip microcomputer online upgrading method based on CAN communication Download PDFInfo
- Publication number
- CN111459526A CN111459526A CN201910048547.1A CN201910048547A CN111459526A CN 111459526 A CN111459526 A CN 111459526A CN 201910048547 A CN201910048547 A CN 201910048547A CN 111459526 A CN111459526 A CN 111459526A
- Authority
- CN
- China
- Prior art keywords
- upgrading
- page data
- upper computer
- cpu
- chip microcomputer
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 31
- 238000004891 communication Methods 0.000 title claims abstract description 25
- 238000012790 confirmation Methods 0.000 claims description 10
- 238000003860 storage Methods 0.000 claims description 8
- 230000009191 jumping Effects 0.000 claims description 6
- 238000012795 verification Methods 0.000 claims description 3
- 238000012545 processing Methods 0.000 claims description 2
- 238000004806 packaging method and process Methods 0.000 abstract 1
- 238000010586 diagram Methods 0.000 description 4
- 239000013598 vector Substances 0.000 description 4
- 238000012356 Product development Methods 0.000 description 3
- 238000007493 shaping process Methods 0.000 description 3
- 238000009826 distribution Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 125000004122 cyclic group Chemical group 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000003466 welding Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
- G06F8/654—Updates using techniques specially adapted for alterable solid state memories, e.g. for EEPROM or flash memories
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/08—Error detection or correction by redundancy in data representation, e.g. by using checking codes
- G06F11/10—Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
- G06F11/1004—Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's to protect a block of data words, e.g. CRC or checksum
Abstract
The invention provides a single chip microcomputer online upgrading method based on CAN communication, which relates to the field of electronic communication and mainly comprises two parts of software: upgrading software by the upper computer; and the upper computer upgrading software is responsible for reading and analyzing the executable HEX file, communicating with the single chip microcomputer through a CAN bus, packaging and sending data to the single chip microcomputer upgrading guidance software, and the single chip microcomputer upgrading guidance software is responsible for judging the upgrading state, receiving, verifying and storing the data of the executable HEX file and feeding back the operation result to the upper computer. The invention completes the program update of the C8051F singlechip through the commonly used CAN bus without disassembling the product, and has simple interface and low complexity of software and hardware realization.
Description
Technical Field
The invention relates to the field of electronic communication, in particular to a single chip microcomputer online upgrading method based on CAN communication.
Background
At present, a program updating method of a single chip microcomputer generally comprises two methods, namely 1, directly downloading the program into an F L ASH inside the single chip microcomputer for operation through an emulator, 2, burning the program into an F L ASH inside the single chip microcomputer for operation before welding of the single chip microcomputer through a special burner, wherein the method 1 is suitable for a product development stage, program functions need to be verified and modified in the product development stage, the method 2 is suitable for a product shaping post-stage, the program is already solidified in the product shaping post-stage, and the program is solidified before chip mounting in order to improve the production efficiency of products, the method 1 and the method 2 are respectively suitable for the product development and shaping stages, the problem that a program updating method after a user changes requirements after the product is delivered cannot be solved, and if the program is updated through the method 1 or the method 2, the product needs to be disassembled, time and labor are.
Patent application No.: CN201710090428.3, patent name: the method is suitable for an embedded system program updating method, the method establishes a TFIP server by using configured server parameters through a control machine program updating tool, and informs a Bootloader online upgrading program to acquire a program name and an address which need to be updated through the control machine program updating tool; and after the Bootloader online upgrading program finishes downloading the updating program, writing the updating program into the designated address, and updating the program after the user changes the requirement after the interaction of the single chip microcomputer product is solved. However, this method requires establishing a TFIP server, configuring IP and port modes, and is complicated to operate.
Patent application No.: CN201710123905.3, patent name: the method completes the interconnection of an upper computer and a DSP processor through a serial bus interface, transmits a DSP and FPGA program file to be upgraded to the DSP processor, upgrades a Flash memory of the DSP or the FPGA under the control of an automatic upgrading algorithm of the DSP, and also solves the problem of program updating after a user changes the requirement after the interaction of a single chip microcomputer product. However, the method needs the DSP and the FPGA to have automatic upgrade algorithm control, has complex program and is not suitable for a C8051 singlechip system.
Disclosure of Invention
In view of the above drawbacks of the prior art, an object of the present invention is to provide a method for upgrading a single chip microcomputer on line based on CAN communication, in which program update of a C8051F single chip microcomputer is completed through a commonly used CAN bus without detaching a product, an interface is simple, and software and hardware implementation complexity is low.
A single chip microcomputer online upgrading method based on CAN communication comprises the following steps:
step 1: reading an executable HEX file through upper computer upgrading software, opening a communication port, and waiting for a CPU (central processing unit) online upgrading communication connection instruction;
step 2: after the CPU is electrified, executing an upgrading bootstrap program, sending a communication connection request command, if a communication connection confirmation command fed back by an upper computer is received, turning to the step 3, otherwise, turning to the step 10;
and step 3: the CPU sends a request command for uploading the characteristic information, and if the request command for uploading the characteristic information fed back by the upper computer is received, the characteristic information is sent to the upgrading software of the upper computer;
and 4, step 4: after the upper computer upgrading software receives the feature information, distinguishing the feature information, ensuring the feature information to be consistent with the feature information in the executable HEX file, and sending a feature information confirmation instruction to enable the upgrading button 3 to be confirmed;
and 5: a user clicks an upgrade confirmation button and sends an upgrade starting command;
step 6: the method comprises the steps that a CPU sends a page data acquisition request instruction, upper computer upgrading software receives the request instruction and judges whether unsent page data exist or not, if yes, storage address information of the page data is sent, and if not, an upgrading ending instruction is sent; the CPU judges the received page data, if the received page data is the storage address information of the page data, the step 7 is carried out, otherwise, the step 10 is carried out;
step 7, the CPU sends a page data erasing request command, when an erasing command fed back by the upper computer is received, the internal F L ASH is erased, and erasing verification is carried out after erasing;
and 8: after the erasing is successful, the CPU sends a page data acquisition request instruction, and the upper computer packs the page data and sends the page data to the CPU;
step 9, the CPU checks the received page data, if the check is successful, the page data is written into an internal F L ASH, the correct write check is carried out on the written page data after the operation is finished, and the step 6 is carried out after the correct check is carried out;
step 10: and jumping the program to an application program area by an absolute address jumping mode, and running the application program.
Further, the characteristic information includes a CPU type, a current program version, and an application code program address.
Further, the check mode of the CPU checking the received data is CRC check. As mentioned above, the method for upgrading the single chip microcomputer on line based on CAN communication has the following beneficial effects: under the condition of not disassembling a product, the program updating of the C8051F singlechip is completed through a commonly used CAN bus, the interface is simple, the software hardware implementation complexity is low, and a simple and effective method is provided for the online upgrading of the C8051F singlechip.
Drawings
FIG. 1 is a diagram of the upgrade software of the upper computer disclosed in the embodiment of the present invention;
FIG. 2 is a diagram showing a distribution diagram of Flash storage inside a CPU disclosed in the embodiment of the present invention;
FIG. 3 is a flowchart illustrating the upgrading process disclosed in the embodiment of the present invention;
the figure shows that:
1-an upper computer UART serial port configuration area; 2-executable HEX file select button; 3-confirm upgrade button; 4-information prompt clear button; 5-upgrading progress bar and 6-upgrading prompt information area.
Detailed Description
The embodiments of the present invention are described below with reference to specific embodiments, and other advantages and effects of the present invention will be easily understood by those skilled in the art from the disclosure of the present specification. The invention is capable of other and different embodiments and of being practiced or of being carried out in various ways, and its several details are capable of modification in various respects, all without departing from the spirit and scope of the present invention. It is to be noted that the features in the following embodiments and examples may be combined with each other without conflict.
It should be noted that the drawings provided in the following embodiments are only for illustrating the basic idea of the present invention, and the drawings only show the components related to the present invention rather than the number, shape and size of the components in actual implementation, and the type, quantity and proportion of the components in actual implementation may be changed freely, and the layout of the components may be more complicated.
The invention mainly comprises two parts of software: (1) upgrading software by the upper computer; (2) the boot software is upgraded. The upper computer upgrading software is responsible for reading and analyzing the executable HEX file, communicates with the single chip microcomputer through a CAN bus, packages and sends data to the single chip microcomputer upgrading guide software, the single chip microcomputer upgrading guide software is responsible for judging the upgrading state, receiving, verifying and storing the data of the executable HEX file, and feeds back the operation result to the upper computer.
As shown in fig. 1, the upper computer upgrading software is provided with an upper computer UART serial port configuration area, an executable HEX file selection button, an upgrade confirmation button, an information prompt clear button, an upgrade progress bar, and an upgrade prompt information area.
A single chip microcomputer online upgrading method based on CAN communication comprises the following steps:
step 1: a user reads the executable HEX file through an executable HEX file selection button of the upper computer upgrading software, opens a communication port of a UART serial port configuration area of the upper computer and waits for a CPU online upgrading communication connection instruction;
step 2: powering on and starting the CPU, executing an upgrading bootstrap program, sending a communication connection request command as shown in FIG. 3, if a communication connection confirmation command fed back by the upper computer is received, turning to step 3, otherwise, turning to step 10;
and step 3: the CPU sends a request command for uploading the characteristic information, and if the request command for uploading the characteristic information fed back by the upper computer is received, the characteristic information is sent to the upgrading software of the upper computer;
the feature information is located in a Flash storage distribution diagram in the CPU shown in fig. 2 and comprises a single chip microcomputer upgrading guide software area, an application program area, a feature signal area and a C8051F register address area, the feature information comprises a single chip microcomputer type, a current program version and an application program address, the upgrading guide software comprises resetting vectors, interruption vector remapping and upgrading guide software, the size of the upgrading guide software can be adjusted according to actual conditions, and the upgrading guide software comprises resetting vectors and interruption vector remapping.
And 4, step 4: after the upper computer upgrading software receives the feature information, distinguishing the feature information, ensuring the feature information to be consistent with the feature information in the executable HEX file, and sending a feature information confirmation instruction to enable the upgrading button to be confirmed;
and 5: a user clicks an upgrade confirmation button and sends an upgrade starting command;
step 6: the method comprises the steps that a CPU sends a page data acquisition request instruction, upper computer upgrading software receives the request instruction and judges whether unsent page data exist or not, if yes, storage address information of the page data is sent, and if not, an upgrading ending instruction is sent; the CPU judges the received page data, if the received page data is the storage address information of the page data, the step 7 is carried out, otherwise, the step 10 is carried out;
step 7, the CPU sends a page data erasing request command, when an erasing command fed back by the upper computer is received, the internal F L ASH is erased, and erasing verification is carried out after erasing;
and 8: after the erasing is successful, the CPU sends a page data acquisition request instruction, and the upper computer packs the page data and sends the page data to the CPU;
step 9, the CPU checks the received page data, if the check is successful, the page data is written into an internal F L ASH, the correct write check is carried out on the written page data after the operation is finished, and the step 6 is carried out after the correct check is carried out;
the checking mode of the CPU for checking the received data is CRC (cyclic redundancy check);
step 10: and jumping the program to an application program area by an absolute address jumping mode, and running the application program.
In conclusion, the invention completes the program update of the C8051F singlechip through the commonly used CAN bus without disassembling the product, and has simple interface and low complexity of software and hardware realization. Therefore, the invention effectively overcomes various defects in the prior art and has high industrial utilization value.
The foregoing embodiments are merely illustrative of the principles and utilities of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or change the above-mentioned embodiments without departing from the spirit and scope of the present invention. Accordingly, it is intended that all equivalent modifications or changes which can be made by those skilled in the art without departing from the spirit and technical spirit of the present invention be covered by the claims of the present invention.
Claims (3)
1. A single chip microcomputer online upgrading method based on CAN communication is characterized by comprising the following steps:
step 1: reading an executable HEX file through upper computer upgrading software, opening a communication port, and waiting for a CPU (central processing unit) online upgrading communication connection instruction;
step 2: after the CPU is electrified, executing an upgrading bootstrap program, sending a communication connection request command, if a communication connection confirmation command fed back by an upper computer is received, turning to the step 3, otherwise, turning to the step 10;
and step 3: the CPU sends a request command for uploading the characteristic information, and if the request command for uploading the characteristic information fed back by the upper computer is received, the characteristic information is sent to the upgrading software of the upper computer;
and 4, step 4: after the upper computer upgrading software receives the feature information, distinguishing the feature information, ensuring the feature information to be consistent with the feature information in the executable HEX file, and sending a feature information confirmation instruction to enable the upgrading button 3 to be confirmed;
and 5: a user clicks an upgrade confirmation button and sends an upgrade starting command;
step 6: the method comprises the steps that a CPU sends a page data acquisition request instruction, upper computer upgrading software receives the request instruction and judges whether unsent page data exist or not, if yes, storage address information of the page data is sent, and if not, an upgrading ending instruction is sent; the CPU judges the received page data, if the received page data is the storage address information of the page data, the step 7 is carried out, otherwise, the step 10 is carried out;
step 7, the CPU sends a page data erasing request command, when an erasing command fed back by the upper computer is received, the internal F L ASH is erased, and erasing verification is carried out after erasing;
and 8: after the erasing is successful, the CPU sends a page data acquisition request instruction, and the upper computer packs the page data and sends the page data to the CPU;
step 9, the CPU checks the received page data, if the check is successful, the page data is written into an internal F L ASH, the correct write check is carried out on the written page data after the operation is finished, and the step 6 is carried out after the correct check is carried out;
step 10: and jumping the program to an application program area by an absolute address jumping mode, and running the application program.
2. The CAN communication-based single chip microcomputer online upgrading method according to claim 1, characterized in that: the characteristic information comprises a CPU type, a current program version and an application code program address.
3. The CAN communication-based single chip microcomputer online upgrading method according to claim 1, characterized in that: the checking mode of the CPU for checking the received data is CRC checking.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910048547.1A CN111459526A (en) | 2019-01-18 | 2019-01-18 | Single chip microcomputer online upgrading method based on CAN communication |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910048547.1A CN111459526A (en) | 2019-01-18 | 2019-01-18 | Single chip microcomputer online upgrading method based on CAN communication |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111459526A true CN111459526A (en) | 2020-07-28 |
Family
ID=71678173
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910048547.1A Pending CN111459526A (en) | 2019-01-18 | 2019-01-18 | Single chip microcomputer online upgrading method based on CAN communication |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111459526A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113608771A (en) * | 2021-06-20 | 2021-11-05 | 山东云海国创云计算装备产业创新中心有限公司 | Method, device and equipment for quickly programming FPGA firmware and readable medium |
-
2019
- 2019-01-18 CN CN201910048547.1A patent/CN111459526A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113608771A (en) * | 2021-06-20 | 2021-11-05 | 山东云海国创云计算装备产业创新中心有限公司 | Method, device and equipment for quickly programming FPGA firmware and readable medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110134415A (en) | A kind of controller and its method for upgrading software and device | |
CN104102518B (en) | double-CPU system and program upgrading method thereof | |
CN112910714B (en) | Remote firmware upgrading method for Internet of things terminal equipment with master-slave machine structure | |
CN102426531B (en) | A kind of intelligent terminal, application program update system and update method thereof | |
CN109358887B (en) | On-line upgrading method, device and system for single chip microcomputer program | |
CN110597542B (en) | Software automatic OTA (over the air) upgrading method and device and electronic equipment | |
CN106897090B (en) | Embedded equipment program upgrading method and system | |
CN111240720A (en) | Boot program upgrading method and device and storage medium | |
CN112988183A (en) | Program upgrading method and device, electronic equipment and storage medium | |
CN104407878A (en) | On-line upgrading method of C6000 digital signal processor | |
CN105760191A (en) | Embedded system equipment programming mass production method | |
CN107678765A (en) | A kind of online upgrading method based on C8051F series monolithics | |
CN108182078B (en) | Optimized missile-borne device non-dismantling software online upgrading method | |
CN108920168B (en) | Bootloader method supporting simultaneous upgrading of multiple similar ECUs and having function of preventing program mismatching | |
CN104133743B (en) | A kind of by burning file to the method for EMMC chip and device | |
KR20090055074A (en) | Method of transaction-based firmware upgrade in mobile telephone and firmware upgrade system thereof | |
CN111782246A (en) | Embedded program upgrading method of multi-node equipment based on bus | |
CN111371610A (en) | Network card firmware batch refreshing method, system, terminal and storage medium | |
CN107479924B (en) | Software upgrading verification method based on Android system | |
CN111459526A (en) | Single chip microcomputer online upgrading method based on CAN communication | |
CN106775778A (en) | Embedded program exploitation Program updates recognition methods and system | |
CN112152846B (en) | Metering instrument remote upgrading method based on Internet of things | |
CN113741944A (en) | Machine program system with upgrading function, upgrading method and application | |
CN110377303B (en) | Method and equipment for upgrading program based on spare storage area mode | |
JPH11149379A (en) | On-line version-up method for firmware program of isdn terminal device |
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 | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20200728 |
|
WD01 | Invention patent application deemed withdrawn after publication |