CN104090794A - ATmega single-chip microcomputer program network remote upgrading method and system thereof - Google Patents

ATmega single-chip microcomputer program network remote upgrading method and system thereof Download PDF

Info

Publication number
CN104090794A
CN104090794A CN201410320164.2A CN201410320164A CN104090794A CN 104090794 A CN104090794 A CN 104090794A CN 201410320164 A CN201410320164 A CN 201410320164A CN 104090794 A CN104090794 A CN 104090794A
Authority
CN
China
Prior art keywords
chip microcomputer
sort command
order
atmega
starting
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
CN201410320164.2A
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.)
NANNING KAIMEI ELECTRONIC TECHNOLOGY Co Ltd
Original Assignee
NANNING KAIMEI ELECTRONIC TECHNOLOGY 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 NANNING KAIMEI ELECTRONIC TECHNOLOGY Co Ltd filed Critical NANNING KAIMEI ELECTRONIC TECHNOLOGY Co Ltd
Priority to CN201410320164.2A priority Critical patent/CN104090794A/en
Publication of CN104090794A publication Critical patent/CN104090794A/en
Pending legal-status Critical Current

Links

Abstract

The invention discloses an ATmega single-chip microcomputer program network remote upgrading method and a system thereof. The system comprises a starting module, three judging modules and three corresponding executing modules. The starting module is used for starting an ATmega single-chip microcomputer, the judging modules are used for judging received PC end commands, and the different PC end commands are executed through the corresponding executing modules. According to the ATmega single-chip microcomputer program network remote upgrading method and the system thereof, the functions of software coding, upgrading, data verifying and the like are achieved through network interfaces of the system according to the received PC end commands, and the coding mode is easier, more convenient to implement and more reliable compared with a traditional coding mode.

Description

A kind of ATmega Single Chip Microcomputer (SCM) program network remote upgrade method and system thereof
Technical field
The inventive method relates to computer information processing and ATmega single-chip microcomputer is write a yard technology, particularly a kind of machine code files through network communication interface by HEX form is transferred to ATmega single-chip microcomputer (hereinafter to be referred as single-chip microcomputer), and applies IAP technology and machine code program is write to the method for Flash in monolithic Bigpian.
Background technology
ATmega is the high-grade single-chip microcomputer of a new A VR that atmel corp releases, and possesses more interface function, and comparatively thorough and perfect aspect power saving performance, stability, anti-interference and dirigibility, and this single-chip microcomputer is widely used in various electronic products.For the download of program, traditional method is first passing through specific download line, to connect ATmega single-chip microcomputer, is writing under the control of yard software, completes the interior FlashROM of sheet that HEX machine code program is written to single-chip microcomputer.The defect of classic method or deficiency: owing to writing code at every turn, first judge machine power, and use specific download line to connect PC and single-chip microcomputer, carry out down operation, after download completes, remove downloading wire, single-chip microcomputer is again started shooting and could normally be moved newly downloaded program, this method inefficiency, method of operating is complicated, needs special-purpose download tool, can not realize the shortcomings such as remote download.
Summary of the invention
Technical matters to be solved by this invention is to provide a kind of ATmega Single Chip Microcomputer (SCM) program network remote upgrade method, and the method is based on ENC28J60 network communication interface, and Adoption Network transmission realizes the software of ATmega single-chip microcomputer under IAP mode and writes code or upgrading.
The present invention solves the problems of the technologies described above with following technical scheme:
An ATmega Single Chip Microcomputer (SCM) program network remote upgrade method, it comprises the steps:
A, power on or reset: the power on start or reset of ATmega single-chip microcomputer, enters following step B;
B, single-chip microcomputer initialization: single-chip microcomputer enters IAP mode of operation, read the network communication parameters on EEPROM, and configure ENC28J60, completes network interface initialization, enters following step C.
C, circular wait PC sort command: circular wait receives PC sort command, if receive PC sort command, according to the order of receiving, proceeds to respectively step D or step H; If do not receive PC order, auto-returned step C after 5s.
If the PC sort command that D receives, for " starting to download ", enters step e; If the PC sort command of receiving is not " starting to download ", enter step H.
E, reception HEX machine code data: the HEX machine code data that single-chip microcomputer inquire-receive PC transmits by network interface, enter step F;
F, machine code data are written to FlashROM: the HEX file data receiving is written to user program FlashROM in the sheet of ATmega, enters step G;
Whether G, judgement are write code and are completed, if write code, do not complete, and return to step e, if write code, complete, and exit IAP pattern, return to step C, again wait for PC sort command.
Whether H, the PC sort command that receives of judgement " execution user program ", if receive " execution user program " order, enters step I; Do not receive " execution user program " order, return to step C.
I, execution user software: normally carry out user software, enter step J;
J, judge whether network interface receives " software reset " order, if receive reset command, enters step K, otherwise, return to step I, continue to carry out user program.
In above-mentioned steps D, if what receive is not " start download " order, can increase following step:
Whether the PC sort command that L, judgement receive is " verification ", is, enters step M, and no, and words enter step H;
M. check FlashROM data: order reads FlashROM data, with the comparison of PC end HEX file, enter step N;
N, judge whether FlashROM data and PC end HEX file exists inconsistent content, if there is inconsistent content, enters step O, if there is no inconsistent content, directly returns to step C.
O, put check errors sign: check error flag is set, returns to step C.
Above-mentioned steps A, step B and step C, operate by starting module execution user.
In above-mentioned steps D, by judge module one, differentiate whether the PC sort command receiving is " starting to download " order.
In above-mentioned steps L, by judge module three, differentiate whether the PC sort command receiving is " verification " order.
In above-mentioned steps H, by judge module two, differentiate whether the PC sort command receiving is " execution user program " order.
Above-mentioned steps E, step F and step G, carry out respective operations by execution module one.
Above-mentioned steps I, step J and step K, carry out respective operations by execution module two.
Above-mentioned steps M, step N and step O, carry out respective operations by execution module three.
An ATmega Single Chip Microcomputer (SCM) program network remote upgrade-system, it comprises:
Start module, for the startup of ATmega single-chip microcomputer, comprise powering on or resetting of ATmega single-chip microcomputer, carry out initialization, and enter circular wait and accept PC sort command state;
Judge module one, for differentiating whether the PC sort command receiving is " starting to download " order;
Execution module one, for carrying out when the PC sort command receiving is " starting to download ", respective operations.Described respective operations comprises carrying out accepts HEX machine code data, and data are write to FlashROM;
Whether judge module two, while not being " starting to download ", is " execution user program " order for differentiating the PC sort command receiving;
Execution module two, while ordering for " execution user program " for the PC sort command when receiving, carries out respective operations.Described respective operations comprises execution user program, until receive software reset's order.
Whether judge module three, while not being " starting to download ", is " verification " order for differentiating the PC sort command receiving.
Execution module three, while ordering for " verification " for the PC sort command when receiving, carries out respective operations.Described respective operations comprises that order reads FlashROM data, with the comparison of PC end HEX file, if inconsistent by check errors flag set.
The present invention has following effect:
This inventive method is based on ENC28J60 network communication interface, and the software that Adoption Network transmits under the IAP mode that realizes ATmega single-chip microcomputer is write code or upgrading.Contrast traditional ATmega single-chip microcomputer software-downloading method, Adoption Network communication interface realizes HEX machine code file and downloads, reading and writing data processing speed is fast, do not need specific download instrument, can realize remote upgrade, after writing code and completing, this interface can be used as again the normal communication interface of user program simultaneously and uses, convenient and swift.
Accompanying drawing explanation
Fig. 1 is a kind of ATmega Single Chip Microcomputer (SCM) program of the present invention network remote upgrade-system schematic diagram.
Fig. 2 is the process flow diagram of ATmega Single Chip Microcomputer (SCM) program network remote upgrade method of the present invention.
In figure:
100---start module judge module;
101---judge module one
102---judge module two
103---judge module three
201---execution module one
202---execution module two
203---execution module three
Embodiment
Below in conjunction with drawings and Examples, the present invention is further detailed explanation; embodiments of the invention and explanation thereof are only for explaining the present invention; not as a limitation of the invention; within the spirit and principles in the present invention all; any modification of making, be equal to replacement, improvement etc., within protection scope of the present invention all should be included in.
Fig. 1 is a kind of ATmega Single Chip Microcomputer (SCM) program of the present invention network remote upgrade-system schematic diagram.As shown in Figure 1, this ATmega Single Chip Microcomputer (SCM) program network remote upgrade-system mainly comprises startup module 100, judge module 1, judge module 2 102, judge module 3 103 and execution module 1, execution module 2 202, execution module 3 203.
Start module 100, for the startup of ATmega single-chip microcomputer, comprise powering on or resetting of ATmega single-chip microcomputer, carry out initialization, and enter circular wait and accept PC sort command state;
Judge module 1, for differentiating whether the PC sort command receiving is " starting to download " order;
Execution module 1, for carrying out when the PC sort command receiving is " starting to download ", respective operations.Described respective operations comprises carrying out accepts HEX machine code data, and data are write to FlashROM;
Whether judge module 2 102, while not being " starting to download ", is " execution user program " order for differentiating the PC sort command receiving;
Execution module 2 202, while ordering for " execution user program " for the PC sort command when receiving, carries out respective operations.Described respective operations comprises execution user program, until receive software reset's order.
Whether judge module 3 103, while not being " starting to download ", is " verification " order for differentiating the PC sort command receiving.
Execution module 3 203, while ordering for " verification " for the PC sort command when receiving, carries out respective operations.Described respective operations comprises that order reads FlashROM data, with the comparison of PC end HEX file, if inconsistent by check errors flag set.
Wherein, by starting module 100, judge module 1, judge module 2 102 and execution module 1, execution module 2 202, formed basic configuration of the present invention.Judge module 3 103 and execution module 3 203 can arrange according to demand.
Fig. 2 is the method flow diagram of the embodiment of the present invention.
System of the present invention realizes ATmega Single Chip Microcomputer (SCM) program network remote by following operation steps and upgrades:
Step 301:ATmega single-chip microcomputer powers on or resets;
Step 302:ATmega single-chip microcomputer enters IAP mode of operation, reads the network communication parameters on EEPROM, and configures ENC28J60, completes network interface initialization;
Step 303:ATmega single-chip microcomputer circular wait PC sort command;
Step 304: if the PC sort command receiving is for " starting to download ", enter step 305; If the PC sort command receiving is not " starting to download ", enter step 308;
Step 305: the HEX machine code data that single-chip microcomputer inquire-receive PC transmits by network interface, enter step 306;
Step 306: the HEX file data receiving is written to user program FlashROM in the sheet of ATmega, enters step 307;
Step 307: whether judgement is write code and completed, and completes and returns to step 303, does not complete and returns to step 305;
Step 308: whether the PC sort command that judgement receives is " verification ", and the words that are enter step 309, no, and words enter step 312;
Step 309: check FlashROM data, enter step 310;
Step 310: by the FlashROM data that read and the comparison of PC end HEX file, if check is correct, return to step 303, if incorrect words enter step 311;
Step 311: check error flag is set, and returns to step 303.
Step 312: whether the PC sort command that judgement receives is " execution user program ", and the words that are enter step 313, otherwise return to step 303;
Step 313: normally carry out user software, enter step 314;
Step 314: judge whether network interface receives " software reset " order, and the words that are enter step 315, do not receive this order, return to step 313;
Step 315: software reset.
The above, be only a kind of specific embodiment of the present invention, is not intended to limit protection scope of the present invention.

Claims (10)

1. an ATmega Single Chip Microcomputer (SCM) program network remote upgrade method, is characterized in that, it comprises the steps:
A, power on or reset: by starting module, by the power on start or reset of ATmega single-chip microcomputer, entering following step B;
B, single-chip microcomputer initialization: single-chip microcomputer enters IAP mode of operation, read the network communication parameters on EEPROM, and configure ENC28J60, completes network interface initialization, enters following step C;
C, circular wait PC sort command: circular wait receives PC sort command, if receive PC sort command, according to the order of receiving, proceeds to respectively step D or step H; If do not receive PC order, auto-returned step C after 5s;
If the PC sort command that D receives, for " starting to download ", enters step e; If the PC sort command of receiving is not " starting to download ", enter step H;
E, reception HEX machine code data: the HEX machine code data that single-chip microcomputer inquire-receive PC transmits by network interface, enter step F;
F, machine code data are written to FlashROM: the HEX file data receiving is written to user program FlashROM in the sheet of ATmega, enters step G;
Whether G, judgement are write code and are completed, if write code, do not complete, and return to step e, if write code, complete, and exit IAP pattern, return to step C, again wait for PC sort command;
Whether H, the PC sort command that receives of judgement " execution user program ", if receive " execution user program " order, enters step I; Do not receive " execution user program " order, return to step C;
I, execution user software: normally carry out user software, enter step J;
J, judge whether network interface receives " software reset " order, if receive reset command, enters step K, otherwise, return to step I, continue to carry out user program.
2. ATmega Single Chip Microcomputer (SCM) program network remote upgrade method according to claim 1, is characterized in that, in described step D, if what receive is not " starting to download " order, can increase following step:
Whether the PC sort command that L, judgement receive is " verification ", is, enters step M, and no, and words enter step H;
M. check FlashROM data: order reads FlashROM data, with the comparison of PC end HEX file, enter step N;
N, judge whether FlashROM data and PC end HEX file exists inconsistent content, if there is inconsistent content, enters step O, if there is no inconsistent content, directly returns to step C;
O, put check errors sign: check error flag is set, returns to step C.
3. ATmega Single Chip Microcomputer (SCM) program network remote upgrade method according to claim 1, is characterized in that, described steps A, step B and step C carry out user and operate by starting module.
4. ATmega Single Chip Microcomputer (SCM) program network remote upgrade method according to claim 1, is characterized in that, in described step D, by judge module one, differentiates whether the PC sort command receiving is " starting to download " order.
5. ATmega Single Chip Microcomputer (SCM) program network remote upgrade method according to claim 1, is characterized in that, in described step L, by judge module three, differentiates whether the PC sort command receiving is " verification " order.
6. ATmega Single Chip Microcomputer (SCM) program network remote upgrade method according to claim 1, is characterized in that, in described step H, by judge module two, differentiates whether the PC sort command receiving is " execution user program " order.
7. ATmega Single Chip Microcomputer (SCM) program network remote upgrade method according to claim 1, is characterized in that, described step e, step F and step G carry out respective operations by execution module one.
8. ATmega Single Chip Microcomputer (SCM) program network remote upgrade method according to claim 1, is characterized in that, described step I, step J and step K are carried out respective operations by execution module two.
9. ATmega Single Chip Microcomputer (SCM) program network remote upgrade method according to claim 1, is characterized in that, described step M, step N and step O carry out respective operations by execution module three.
10. an ATmega Single Chip Microcomputer (SCM) program network remote upgrade-system, is characterized in that, described this system comprises:
Start module, for the startup of ATmega single-chip microcomputer, comprise powering on or resetting of ATmega single-chip microcomputer, carry out initialization, and enter circular wait and accept PC sort command state;
Judge module one, for differentiating whether the PC sort command receiving is " starting to download " order;
Execution module one, for carrying out when the PC sort command receiving is " starting to download ", respective operations, described respective operations comprises carrying out accepts HEX machine code data, and data are write to FlashROM;
Whether judge module two, while not being " starting to download ", is " execution user program " order for differentiating the PC sort command receiving;
Execution module two, while ordering for " execution user program " for the PC sort command when receiving, carries out respective operations, and described respective operations comprises execution user program, until receive software reset's order;
Whether judge module three, while not being " starting to download ", is " verification " order for differentiating the PC sort command receiving;
Execution module three, while ordering for " verification " for the PC sort command when receiving, carries out respective operations, and described respective operations comprises that order reads FlashROM data, with the comparison of PC end HEX file, if inconsistent by check errors flag set.
CN201410320164.2A 2014-07-07 2014-07-07 ATmega single-chip microcomputer program network remote upgrading method and system thereof Pending CN104090794A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410320164.2A CN104090794A (en) 2014-07-07 2014-07-07 ATmega single-chip microcomputer program network remote upgrading method and system thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410320164.2A CN104090794A (en) 2014-07-07 2014-07-07 ATmega single-chip microcomputer program network remote upgrading method and system thereof

Publications (1)

Publication Number Publication Date
CN104090794A true CN104090794A (en) 2014-10-08

Family

ID=51638513

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410320164.2A Pending CN104090794A (en) 2014-07-07 2014-07-07 ATmega single-chip microcomputer program network remote upgrading method and system thereof

Country Status (1)

Country Link
CN (1) CN104090794A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107301067A (en) * 2017-05-26 2017-10-27 安徽四创电子股份有限公司 Beidou subscriber machine remote update system and its upgrade method based on IAP technologies

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN202135171U (en) * 2011-07-14 2012-02-01 邱丽芳 Embedded remote intelligent upgrading device
CN102855151A (en) * 2012-08-21 2013-01-02 武汉电信器件有限公司 Optical module firmware in-application upgrading method capable of not interrupting service

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN202135171U (en) * 2011-07-14 2012-02-01 邱丽芳 Embedded remote intelligent upgrading device
CN102855151A (en) * 2012-08-21 2013-01-02 武汉电信器件有限公司 Optical module firmware in-application upgrading method capable of not interrupting service

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
GLENMOONA: ""AVR ATMega 128自引导IAP(boot load)的应用设计"", 《HTTP://WENKU.BAIDU.COM/VIEW/6342347A1711CC7931B71652.HTML》 *
JEANSONM: ""[LPC] LPC1768 IAP升级"", 《HTTP://BBS.21IC.COM/ICVIEW-744688-1-1.HTML》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107301067A (en) * 2017-05-26 2017-10-27 安徽四创电子股份有限公司 Beidou subscriber machine remote update system and its upgrade method based on IAP technologies
CN107301067B (en) * 2017-05-26 2019-01-29 安徽四创电子股份有限公司 Beidou subscriber machine remote update system and its upgrade method based on IAP technology

Similar Documents

Publication Publication Date Title
CN104149717B (en) A kind of long-range noiseless renewal system and method for car load control
CN101963910A (en) General USB (Universal Serial Bus) based equipment firmware updating method
CN103777972A (en) System based on field-programmable gate array, configuration method and upgrading method
CN104156237A (en) Online single-chip microcomputer upgrading method
CN102722384A (en) On-line upgrading method and upgrading system for optical module firmware
CN103902305A (en) Software long-distance loading and solidifying method based on TI DSP
CN104375855A (en) Device and method for upgrading firmware through storage devices on basis of multiple vehicle-mounted MCUs
CN100461105C (en) Update and repair method of intellectualized equipment and system thereof
CN106547574A (en) The outside download system and method for a kind of DSP programs and FPGA programs
CN102945173A (en) User program on-line upgrading system and method
CN104679559A (en) Single chip microcomputer on-line programming method
CN105259834B (en) A kind of data in mobile phone acquisition controller of firmware restructural
CN110187909B (en) Single-chip microcomputer firmware upgrading method based on android system
CN103997683A (en) System for using set-top-box platform to realize customizable Flash CD-ROM recorder and method thereof
CN101004707A (en) Embedded type software debugging device, and method for implementing debugging
CN106789334A (en) A kind of method and apparatus of firmware upgrade
CN107729040A (en) A kind of IAP method and system of single-chip microcomputer
CN201035568Y (en) USB equipment logical numbering and physical numbering mapping device
CN103761129A (en) Method of implementing SDIO (secure digital input/output) interface drive in Boot loader layer
CN105487890A (en) Firmware downloading method based on C51 series single chip microcomputer kernel
CN102520961A (en) Off-chip online programmable SOC (system on a chip) and control method for same
CN107908417A (en) Firmware upgrade method and electronic equipment
CN102346677A (en) Method for upgrading field programmable gate array (FPGA) program
CN102711095A (en) Method for updating nodes of wireless sensor network in wireless mode
CN103324496B (en) One USB flash disk realizes centralized automatic meter-reading terminal local maintaining method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20141008

WD01 Invention patent application deemed withdrawn after publication