CN107037757A - A kind of BootLoader programme upgrade methods based on photoelectricity transmission - Google Patents

A kind of BootLoader programme upgrade methods based on photoelectricity transmission Download PDF

Info

Publication number
CN107037757A
CN107037757A CN201710250088.6A CN201710250088A CN107037757A CN 107037757 A CN107037757 A CN 107037757A CN 201710250088 A CN201710250088 A CN 201710250088A CN 107037757 A CN107037757 A CN 107037757A
Authority
CN
China
Prior art keywords
main control
module
control mcu
upper computer
mcu module
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
CN201710250088.6A
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.)
Zhejiang Viewshine Intelligent Meter Co Ltd
Original Assignee
Zhejiang Viewshine Intelligent Meter 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 Zhejiang Viewshine Intelligent Meter Co Ltd filed Critical Zhejiang Viewshine Intelligent Meter Co Ltd
Priority to CN201710250088.6A priority Critical patent/CN107037757A/en
Publication of CN107037757A publication Critical patent/CN107037757A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/042Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors
    • G05B19/0423Input/output
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/20Pc systems
    • G05B2219/24Pc safety
    • G05B2219/24005Inhibit update control program if default values has been changed by program during processing

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Communication Control (AREA)

Abstract

The invention discloses a kind of BootLoader programme upgrade methods based on photoelectricity transmission.The present invention is that using BootLoader, this function is communicated main control MCU module by photoelectric transmission module with upper computer module, main control MCU program upgrading data packet in upper computer module is downloaded in main control MCU module with Xmodem Protocol, and main control MCU module needs synchronism switching baud rate to improve update rate with upper computer module, specifically:Upper computer module is sent to main control MCU module after order of shaking hands, and main control MCU module will return to an order of shaking hands to upper computer module;Upper computer module is had correctly received after the order of shaking hands of main control MCU module, and BOOT order can be transmitted into main control MCU module;Subsequent main control MCU module enters BOOT, and an order for confirming to enter BOOT is returned to upper computer module;Upper computer module starts Xmodem Protocol, starts to transmit main control MCU program upgrading data packet and writes with a brush dipped in Chinese ink the ROM of main control MCU module.Present invention, avoiding the triviality and safety issue of dismounting gas meter.

Description

A kind of BootLoader programme upgrade methods based on photoelectricity transmission
Technical field
Photoelectricity transmission is combined by the present invention with BootLoader program functions, is related to a kind of to main control MCU application program A kind of method of upgrading, and in particular to method for ultrasonic wave gas meter master control borad application program without disassembly procedure upgrade.
Background technology
Bootloader is the first paragraph code that embedded system is performed after the power-up, is transported before application program operation Capable.In an operating system, it can with initiating hardware equipment, memory headroom mapping graph is set up, so that by the software and hardware of system Environment takes a proper states to, to get out correct environment for final call operation system kernel.We here with BootLoader functions carry out main control MCU come the Self_Programming_Library function libraries provided using Renesas Application program in line writing.
Gas meter company will certainly will modify when researching and developing intelligent gauge to the main control MCU application program on table tool Upgrading is debugged again, but main control MCU is typically all arranged on inside table tool, and dismounting table has this cumbersome process for research and development It is very inconvenient.And the present invention just solves this problem, the present invention can pass through in the case where not dismantled to table tool Photoelectricity transmission downloads to the ROMPaq of new edition in main control MCU by BootLoader functions, it is achieved thereby that to master control The upgrading of MCU application programs.The present invention also can operate with upgrading and be mounted on intelligent gas meter main control MCU application journey in user family Sequence, substantially increases the security in operative employee's human efficiency and operating process, more facilitates convenience-for-people.
The content of the invention
Dismounting table has when upgrading the invention aims to overcome to the application program of intelligent gas meter main control MCU This complicated processes, improves operating efficiency, also improves security.
The present invention is during the application program updating of intelligent gas meter main control MCU, using BootLoader functions as core The heart.The present invention supports a variety of main control MCUs of multiple product, as long as main control MCU has this function of BootLoader, then production Product can be upgraded in the case of without dismounting by photoelectricity transmission to the application program of main control MCU.
A kind of BootLoader programme upgrade methods based on photoelectricity transmission, the present invention is that main control MCU module is utilized This function of BootLoader is communicated by photoelectric transmission module with upper computer module, the main control MCU in upper computer module Program upgrading data packet is downloaded in main control MCU module with Xmodem Protocol, and main control MCU module needs with upper computer module Synchronism switching baud rate is to improve update rate, specifically:Upper computer module is sent to main control MCU module after order of shaking hands, Main control MCU module will return to an order of shaking hands to upper computer module;Upper computer module has correctly received holding for main control MCU module After hand order, BOOT order can be transmitted into main control MCU module;Subsequent main control MCU module enters BOOT, to host computer Module returns to an order for confirming to enter BOOT;Upper computer module starts Xmodem agreements, starts to transmit main control MCU program Upgrading data packet and the ROM for writing with a brush dipped in Chinese ink main control MCU module.
The technical solution adopted for the present invention to solve the technical problems is as follows:
Implementation process of the present invention includes three modules:Upper computer module, photoelectric transmission module and main control MCU module;And light Electrical transmission module is integrated in main control MCU module, upper computer module by photoelectric transmission module by main control MCU program upgrade data Bag is transferred to main control MCU module, and main control MCU module is upgraded.
Described upper computer module includes data format conversion unit, transmission unit, and upper computer module is supporting is provided with The Integrated Light dateline of USB interface, so that data communication can be carried out between upper computer module and photoelectric transmission module;
Described main control MCU module is corresponding with upper computer module, and main control MCU module is received by photoelectric transmission module After the order of shaking hands that transmission unit is sent in upper computer module, into BOOT wait states, then return to a handshake and give Upper computer module;When receiving order of the upper computer module into BOOT, main control MCU module goes forward side by side BOOT flag bit set Enter BOOT states, return again to one and confirm the order for coming into BOOT to upper computer module;Main control MCU module enters after BOOT (main control MCU has been automatically converted to 9600bps baud rates), main control MCU module sends a string of initial datas into BOOT " BOOTLOAD " gives upper computer module, and main control MCU program upgrading data packet is transferred to main control MCU by upper computer module after receiving Module;The mode that main control MCU module is received using interrupting writes the main control MCU program upgrading data packet received in ROM, and Complete program burn writing.
Described photoelectric transmission module is integrated in main control MCU module, and the Integrated Light dateline of upper computer module USB interface is first The electric signal of main control MCU program upgrading data packet is first converted into optical signal, photoelectric transmission module, photoelectricity transmission is then transferred to The optical signal of reception is converted into electric signal by module, is then transferred to main control MCU module;
The circuit description of described photoelectric transmission module:
Photoelectric transmission module is divided into two units of infrared emission and infrared receiver:
Infrared emission unit is by three resistance (resistance R1, resistance R2, resistance R3), a triode (Q1) and one Infrared transmitting tube (D1) is constituted;Resistance R1 one end is connected with resistance R2 one end, and this terminates to main control MCU module The transmission mouthful Tx of microcontroller serial port;Resistance R1 another termination infrared transmitting tube D1 positive pole, and this termination power is just Pole;Infrared transmitting tube D1 negative pole connecting resistance R3 one end, resistance R3 another termination PNP triode Q1 emitter stage, PNP tri- The pole pipe Q1 ground level connecting resistance R2 other end, PNP triode Q1 grounded collector;Described infrared emission cast is D1AT205。
Infrared receiver by three resistance (resistance R4, resistance R5, resistance R6), two electric capacity (C1, C2), one three Pole pipe (Q2) and a photosensitive receiving tube (D2) are constituted;Resistance R5 one end is connected to ground, at the same with electric capacity C1 one end and NPN triode Q2 transmitting tube is connected;The resistance R5 other end is connected with the electric capacity C1 other end, at the same with NPN triode Q2 Base stage be connected with resistance R4 one end;The resistance R4 other end is connected with photosensitive receiving tube D2 positive pole;Photodiode Negative pole is connected with positive source, while being connected with resistance R6 one end;The resistance R6 other end is connected with electric capacity C2 one end, It is connected simultaneously with the serial ports receiving terminal Rx and NPN triode Q2 of the single-chip microcomputer of main control MCU module colelctor electrode;Electric capacity C2's is another One end is connected to the ground.
Described Xmodem Protocol:
Xmodem Protocol is proposed and realized in 1970s by Ward Christensen earliest, transmits data unit For packet, the form of packet is as follows:
| Byte1 | Byte2 | Byte3 | Byte4~Byte131 | Byte132 | | Start Of Header | PacketNumber |~(PacketNumber) | Packet Data | Check Sum |
Start Of Header are defined as 0x01;PacketNumber is the numbering of packet;~(PacketNumber) Negated for the numbering of packet;Check Sum are and verified, and verification computational methods are the tired of Packet Data (128 byte) Plus and, a byte is accounted for due to verification and only, if cumulative and more than 255, the continuation that will start from scratch is cumulative, disregards carry.
Described data format conversion unit:
Download program file format is .hxf file formats, it is necessary to which being converted into binary code could be entered by photoelectricity burning In single-chip microcomputer ROM, this upper computer module realizes that this is changed using I/O Stream, and specific data conversion format is as follows:
.hxf file reads rule:
Example ":ABCDEFGHIJKLMNOPQRXTUVWXYZabcdefghijklmnop " can be counted as " 0xAB 0xCD 0xEF 0xGH 0xIJ 0xKL 0xMN 0xOP 0xQR 0xST 0xUV 0xWX 0xYZ 0xab 0xcd 0xef 0xgh 0xij 0xkl 0xmn 0xop”
First character section 0xAB represents the length of one's own profession data;
Second and third byte 0xCD 0xEF represent the initial address of one's own profession data;
Nybble 0xGH represents data type, and data type has:0x00、0x01、0x02、0x03、 0x04、0x05.With It is respectively each data type down:
'00'Data Rrecord:For record data, most of record of HEX files is all data record
'01'End of File Record:For identifying the end of file, the last of file is placed on, mark HEX files Ending
'02'Extended Segment Address Record:For identifying the record of extension sector address
'03'Start Segment Address Record:Start sector address record
'04'Extended Linear Address Record:For identifying the record of extension linear address
'05'Start Linear Address Record:Start linear address record
After data type for data, last byte 0xop for verification and.If data address is discontinuous, use 0xFF is filled up.
The agreement interacted between described main control MCU module and upper computer module:
First have to determine the baud rate that main control MCU module is communicated with upper computer module.Enter in main control MCU module Before BootLoader, only simple handshake between main control MCU module and upper computer module, so the baud of communication Calibration is 2400bps.After main control MCU module enters BootLoader, start the biography of main control MCU program upgrading data packet Defeated, then the baud rate of main control MCU module and upper computer module is promoted to 9600bps, to improve main control MCU program upgrading data packet Transmit the speed write with a brush dipped in Chinese ink.
Main control MCU module is with the mechanism that upper computer module is shaken hands:
Upper computer module is sent after an order of shaking hands, into wait timeout mode;If main control MCU module is returned and shaken hands Signal, the then order that upper computer module continues to be transmitted into BOOT, if waiting time-out, resends and held to main control MCU module Hand signal.Upper computer module is transmitted into after BOOT order, waits main control MCU module to return to the life for confirming to enter BOOT Order, if upper computer module receives the order for confirming to enter BOOT, upper computer module, which enters, prepares data transmission state.Once Upper computer module receives " start " signal (i.e. " BOOTLOAD " signal) of main control MCU module, is switched on Xmodem Protocol biography It is defeated.When main control MCU module returns to " end " signal, represent that main control MCU program upgrading data packet is correctly sent completely, on Position machine will move out Xmodem Protocol, stop transmission.
The course of work of the present invention is as follows:
The inventive method is take into account when upgrading to main control MCU application program using this channel radio of photoelectricity transmission News mode, and combine the BootLoader functions that main control MCU has in itself, it is to avoid the triviality of dismounting gas meter with Safety issue, is also one kind innovation to main control MCU application program updating.
Meanwhile, the photoelectric transmission module in main control MCU module is a kind of hardware circuit based on photosensitive T-R tube, is this hair The underlying hardware circuit of bright all communications, includes transmission, Xmodem Protocol transmission and the main control MCU module upgrading for order of shaking hands All rely on the circuit.The hardware circuit can apply to a variety of data transfers, and maximum communication baud rate is up to 1Mbps or so.
Brief description of the drawings
Fig. 1 illustrates for Xmodem Protocol.
Fig. 2 is flowchart illustrations of the present invention.
Fig. 3 is photoelectric transmission module circuit diagram.
Embodiment
The invention will be further described below in conjunction with the accompanying drawings.
As Figure 1-3, a kind of BootLoader programme upgrade methods based on photoelectricity transmission, the present invention is main control MCU Using BootLoader, this function is communicated module by photoelectric transmission module with upper computer module, in upper computer module Main control MCU program upgrading data packet is downloaded in main control MCU module with Xmodem Protocol, and main control MCU module and host computer Module needs synchronism switching baud rate to improve update rate, specifically:Upper computer module sends life of shaking hands to main control MCU module After order, main control MCU module will return to an order of shaking hands to upper computer module;Upper computer module has correctly received main control MCU After the order of shaking hands of module, BOOT order can be transmitted into main control MCU module;Subsequent main control MCU module enters BOOT, An order for confirming to enter BOOT is returned to upper computer module;Upper computer module starts Xmodem Protocol, starts to transmit master control MCU programs upgrading data packet and the ROM for writing with a brush dipped in Chinese ink main control MCU module.
Implementation process of the present invention includes three modules:Upper computer module, photoelectric transmission module and main control MCU module;And light Electrical transmission module is integrated in main control MCU module, upper computer module by photoelectric transmission module by main control MCU program upgrade data Bag is transferred to main control MCU module, and main control MCU module is upgraded.
Described upper computer module includes data format conversion unit, transmission unit, and upper computer module is supporting is provided with The Integrated Light dateline of USB interface, so that data communication can be carried out between upper computer module and photoelectric transmission module;
Described main control MCU module is corresponding with upper computer module, and main control MCU module is received by photoelectric transmission module After the order of shaking hands that transmission unit is sent in upper computer module, into BOOT wait states, then return to a handshake and give Upper computer module;When receiving order of the upper computer module into BOOT, main control MCU module goes forward side by side BOOT flag bit set Enter BOOT states, return again to one and confirm the order for coming into BOOT to upper computer module;Main control MCU module enters after BOOT (main control MCU has been automatically converted to 9600bps baud rates), main control MCU module sends a string of initial datas into BOOT " BOOTLOAD " gives upper computer module, and main control MCU program upgrading data packet is transferred to main control MCU by upper computer module after receiving Module;The mode that main control MCU module is received using interrupting writes the main control MCU program upgrading data packet received in ROM, and Complete program burn writing.
Described photoelectric transmission module is integrated in main control MCU module, and the Integrated Light dateline of upper computer module USB interface is first The electric signal of main control MCU program upgrading data packet is first converted into optical signal, photoelectric transmission module, photoelectricity transmission is then transferred to The optical signal of reception is converted into electric signal by module, is then transferred to main control MCU module;
As shown in figure 3, described photoelectric transmission module is divided into two units of infrared emission and infrared receiver:
Infrared emission unit is by three resistance (resistance R1, resistance R2, resistance R3), a triode (Q1) and one Infrared transmitting tube (D1) is constituted;Resistance R1 one end is connected with resistance R2 one end, and this terminates to main control MCU module The transmission mouthful Tx of microcontroller serial port;Resistance R1 another termination infrared transmitting tube D1 positive pole, and this termination power is just Pole;Infrared transmitting tube D1 negative pole connecting resistance R3 one end, resistance R3 another termination PNP triode Q1 emitter stage, PNP tri- The pole pipe Q1 ground level connecting resistance R2 other end, PNP triode Q1 grounded collector;Described infrared emission cast is D1AT205。
Infrared receiver by three resistance (resistance R4, resistance R5, resistance R6), two electric capacity (C1, C2), one three Pole pipe (Q2) and a photosensitive receiving tube (D2) are constituted;Resistance R5 one end is connected to ground, at the same with electric capacity C1 one end and NPN triode Q2 transmitting tube is connected;The resistance R5 other end is connected with the electric capacity C1 other end, at the same with NPN triode Q2 Base stage be connected with resistance R4 one end;The resistance R4 other end is connected with photosensitive receiving tube D2 positive pole;Photodiode Negative pole is connected with positive source, while being connected with resistance R6 one end;The resistance R6 other end is connected with electric capacity C2 one end, It is connected simultaneously with the serial ports receiving terminal Rx and NPN triode Q2 of the single-chip microcomputer of main control MCU module colelctor electrode;Electric capacity C2's is another One end is connected to the ground.
Described Xmodem Protocol:
Xmodem Protocol is proposed and realized in 1970s by Ward Christensen earliest, transmits data unit For packet, the form of packet is as follows:
| Byte1 | Byte2 | Byte3 | Byte4~Byte131 | Byte132 | | Start Of Header | PacketNumber |~(PacketNumber) | Packet Data | Check Sum |
Start Of Header are defined as 0x01;PacketNumber is the numbering of packet;~(PacketNumber) Negated for the numbering of packet;Check Sum are and verified, and verification computational methods are the tired of Packet Data (128 byte) Plus and, a byte is accounted for due to verification and only, if cumulative and more than 255, the continuation that will start from scratch is cumulative, disregards carry.
Described data format conversion unit:
Download program file format is .hxf file formats, it is necessary to which being converted into binary code could be entered by photoelectricity burning In single-chip microcomputer ROM, this upper computer module realizes that this is changed using I/O Stream, and specific data conversion format is as follows:
.hxf file reads rule:
Example ":ABCDEFGHIJKLMNOPQRXTUVWXYZabcdefghijklmnop " can be counted as " 0xAB 0xCD 0xEF 0xGH 0xIJ 0xKL 0xMN 0xOP 0xQR 0xST 0xUV 0xWX 0xYZ 0xab 0xcd 0xef 0xgh 0xij 0xkl 0xmn 0xop”
First character section 0xAB represents the length of one's own profession data;
Second and third byte 0xCD 0xEF represent the initial address of one's own profession data;
Nybble 0xGH represents data type, and data type has:0x00、0x01、0x02、0x03、 0x04、0x05.With It is respectively each data type down:
'00'Data Rrecord:For record data, most of record of HEX files is all data record
'01'End of File Record:For identifying the end of file, the last of file is placed on, mark HEX files Ending
'02'Extended Segment Address Record:For identifying the record of extension sector address
'03'Start Segment Address Record:Start sector address record
'04'Extended Linear Address Record:For identifying the record of extension linear address
'05'Start Linear Address Record:Start linear address record
After data type for data, last byte 0xop for verification and.If data address is discontinuous, use 0xFF is filled up.
The agreement interacted between described main control MCU module and upper computer module:
First have to determine the baud rate that main control MCU module is communicated with upper computer module.Enter in main control MCU module Before BootLoader, only simple handshake between main control MCU module and upper computer module, so the baud of communication Calibration is 2400bps.After main control MCU module enters BootLoader, start the biography of main control MCU program upgrading data packet Defeated, then the baud rate of main control MCU module and upper computer module is promoted to 9600bps, to improve main control MCU program upgrading data packet Transmit the speed write with a brush dipped in Chinese ink.
Main control MCU module is with the mechanism that upper computer module is shaken hands:
Upper computer module is sent after an order of shaking hands, into wait timeout mode;If main control MCU module is returned and shaken hands Signal, the then order that upper computer module continues to be transmitted into BOOT, if waiting time-out, resends and held to main control MCU module Hand signal.Upper computer module is transmitted into after BOOT order, waits main control MCU module to return to the life for confirming to enter BOOT Order, if upper computer module receives the order for confirming to enter BOOT, upper computer module, which enters, prepares data transmission state.Once Upper computer module receives " start " signal (i.e. " BOOTLOAD " signal) of main control MCU module, is switched on Xmodem Protocol biography It is defeated.When main control MCU module returns to " end " signal, represent that main control MCU program upgrading data packet is correctly sent completely, on Position machine will move out Xmodem Protocol, stop transmission.
Embodiment:
Program upgrading object, a collection with USB interfaces are used as by a ultrasonic intelligent gas meter, flow meter in this embodiment Into photometer head and computer host computer connecting communication, Integrated Light dateline can magnetic suck above ultrasonic intelligent gas meter, flow meter photoelectric circuit Transparent watchcase on, as long as actual carry out host computer operation on computers.
Fig. 1 is Xmodem Protocol transfer process, and sender only supports the transmission means with verification sum, and recipient is first Send NAK signals and initiate transmission, if sender does not have data to return, it is necessary to which recipient is after the waiting-timeout time NAK signals are initiated again to carry out data transmission.If the data transfer that sender sends is correct, recipient needs to send ACK letters Number confirmed;If data transfer is wrong, recipient sends NAK signals.Sender needs after NAK signals are received Again this data transfer is initiated, until this data are correctly transmitted.If all data transfers are completed, sender needs EOT signal is sent to recipient, the end signal of this data transfer is used as.And when recipient sends CAN signal, sender Receive after CAN signal, then directly unconditionally terminate this transmitting procedure, without retransmiting EOT to recipient.
Fig. 2 is the basic procedure diagram of the present invention, and the flowchart illustrations are above-mentioned upper computer module and main control MCU module The summary of program function.Host computer is sent after an order of shaking hands, into wait timeout mode.If main control MCU receives this Individual handshake, then return to a handshake to host computer;If main control MCU is not received by this handshake or reception To other signals of mistake, then handshake is not returned to, then host computer will wait time-out.If host computer waits time-out, Handshake will be resend;If host computer receives the handshake of main control MCU return, host computer is transmitted into BOOT Order, wait main control MCU return confirm enter BOOT order.Main control MCU receives the order into BOOT, then set BOOT Flag bit, and enter BOOT, return to an order for confirming to enter BOOT to host computer.Host computer, which is received, to be confirmed to enter BOOT's After order, host computer, which enters, prepares data transmission state.Once host computer receives " start " signal of main control MCU, it is switched on Xmodem Protocol is transmitted, and baud rate is switched into 9600bps.After the completion of being write with a brush dipped in Chinese ink to the program of main control MCU, main control MCU meeting When returning to " end " signal, representation program correctly sends and writes with a brush dipped in Chinese ink completion, and host computer will move out Xmodem Protocol after receiving, stop Only transmit.

Claims (5)

1. a kind of BootLoader programme upgrade methods based on photoelectricity transmission, it is characterised in that including three modules:Host computer Module, photoelectric transmission module and main control MCU module;And photoelectric transmission module is integrated in main control MCU module, upper computer module is led to Cross photoelectric transmission module and main control MCU program upgrading data packet is transferred to main control MCU module, main control MCU module is upgraded;
Described upper computer module includes data format conversion unit, transmission unit, and the supporting USB that is provided with of upper computer module connects The Integrated Light dateline of mouth, so that data communication can be carried out between upper computer module and photoelectric transmission module;
Described main control MCU module is corresponding with upper computer module, and main control MCU module is received upper by photoelectric transmission module After the order of shaking hands that transmission unit is sent in machine module, into BOOT wait states, a handshake is then returned to upper Machine module;When receiving order of the upper computer module into BOOT, main control MCU module enters BOOT flag bit set BOOT states, return again to one and confirm the order for coming into BOOT to upper computer module;Main control MCU module enters after BOOT certainly Dynamic to be converted into 9600bps baud rates, main control MCU module sends a string and enters BOOT initial data " BOOTLOAD " to host computer Main control MCU program upgrading data packet is transferred to main control MCU module by module, upper computer module after receiving;Main control MCU module profit The mode received with interrupting writes the main control MCU program upgrading data packet received in ROM, and completes program burn writing;
Described photoelectric transmission module is integrated in main control MCU module, and the Integrated Light dateline of upper computer module USB interface first will The electric signal of main control MCU program upgrading data packet is converted into optical signal, is then transferred to photoelectric transmission module, photoelectric transmission module The optical signal of reception is converted into electric signal, main control MCU module is then transferred to.
2. a kind of BootLoader programme upgrade methods based on photoelectricity transmission according to claim 1, it is characterised in that Described photoelectric transmission module is divided into two units of infrared emission and infrared receiver:
Infrared emission unit is made up of three resistance, a triode and an infrared transmitting tube;Resistance R1 one end and electricity The one end for hindering R2 is connected, and the transmission mouthful Tx of this microcontroller serial port for terminating to main control MCU module;The resistance R1 other end Connect infrared transmitting tube D1 positive pole, and the positive pole of this termination power;Infrared transmitting tube D1 negative pole connecting resistance R3 one end, Resistance R3 another termination PNP triode Q1 emitter stage, the PNP triode Q1 ground level connecting resistance R2 other end, the poles of PNP tri- Pipe Q1 grounded collector;
Infrared receiver is made up of three resistance, two electric capacity, a triode and a photosensitive receiving tube;Resistance R5's One end is connected to ground, while being connected with electric capacity C1 one end and NPN triode Q2 transmitting tube;The resistance R5 other end and electric capacity The C1 other end is connected, while being connected with NPN triode Q2 base stage and resistance R4 one end;The resistance R4 other end with it is photosensitive Reception pipe D2 positive pole connection;The negative pole of photodiode is connected with positive source, while being connected with resistance R6 one end;Resistance The R6 other end is connected with electric capacity C2 one end, while serial ports the receiving terminal Rx and NPN tri- with the single-chip microcomputer of main control MCU module Pole pipe Q2 colelctor electrode is connected;The electric capacity C2 other end is connected to the ground.
3. a kind of BootLoader programme upgrade methods based on photoelectricity transmission according to claim 1, it is characterised in that Main control MCU program upgrading data packet in upper computer module is downloaded in main control MCU module with Xmodem Protocol, described Xmodem Protocol:
Xmodem Protocol is proposed and realized in 1970s by Ward Christensen earliest, transmits data unit to believe Breath bag, the form of packet is as follows:
| Byte1 | Byte2 | Byte3 | Byte4~Byte131 | Byte132 | | Start Of Header | PacketNumber | ~(PacketNumber) | Packet Data | Check Sum | Start Of Header are defined as 0x01;PacketNumber For the numbering of packet;~(PacketNumber) negates for the numbering of packet;Check Sum are and verified, and master gage Calculation method for the cumulative of Packet Data and, account for due to verification and only a byte, will be from zero if cumulative and more than 255 Start to continue cumulative, disregard carry.
4. a kind of BootLoader programme upgrade methods based on photoelectricity transmission according to claim 1, it is characterised in that The agreement interacted between described main control MCU module and upper computer module:
First have to determine the baud rate that main control MCU module is communicated with upper computer module;Enter BootLoader in main control MCU module Before, only simple handshake between main control MCU module and upper computer module, so the baud rate of communication is set to 2400bps;After main control MCU module enters BootLoader, start the transmission of main control MCU program upgrading data packet, then lead The baud rate of control MCU module and upper computer module is promoted to 9600bps, to improve main control MCU program upgrading data packet transmission brush The speed write.
5. a kind of BootLoader programme upgrade methods based on photoelectricity transmission according to claim 1, it is characterised in that Main control MCU module is with the mechanism that upper computer module is shaken hands:
Upper computer module is sent after an order of shaking hands, into wait timeout mode;If main control MCU module returns to letter of shaking hands Number, then upper computer module continues to be transmitted into BOOT order to main control MCU module, if waiting time-out, resends and shakes hands Signal;Upper computer module is transmitted into after BOOT order, waits main control MCU module to return to the order for confirming to enter BOOT, If upper computer module receives the order for confirming to enter BOOT, upper computer module, which enters, prepares data transmission state;Once it is upper Machine module receives " start " signal of main control MCU module, is switched on Xmodem Protocol transmission;When main control MCU module returns to one During individual " end " signal, represent that main control MCU program upgrading data packet is correctly sent completely, host computer will move out Xmodem Protocol, stop Only transmit.
CN201710250088.6A 2017-04-17 2017-04-17 A kind of BootLoader programme upgrade methods based on photoelectricity transmission Pending CN107037757A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710250088.6A CN107037757A (en) 2017-04-17 2017-04-17 A kind of BootLoader programme upgrade methods based on photoelectricity transmission

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710250088.6A CN107037757A (en) 2017-04-17 2017-04-17 A kind of BootLoader programme upgrade methods based on photoelectricity transmission

Publications (1)

Publication Number Publication Date
CN107037757A true CN107037757A (en) 2017-08-11

Family

ID=59535384

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710250088.6A Pending CN107037757A (en) 2017-04-17 2017-04-17 A kind of BootLoader programme upgrade methods based on photoelectricity transmission

Country Status (1)

Country Link
CN (1) CN107037757A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110794804A (en) * 2019-09-25 2020-02-14 潍柴动力股份有限公司 System, ECU, motor vehicle and method for flashing ECU
CN111818513A (en) * 2020-06-11 2020-10-23 深圳硕日新能源科技有限公司 Remote upgrading method and remote upgrading system for solar controller
CN111856241A (en) * 2020-06-12 2020-10-30 广芯微电子(广州)股份有限公司 Chip mass production platform system and implementation method thereof
CN112347019A (en) * 2019-08-07 2021-02-09 新唐科技股份有限公司 Operating device

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1545363A (en) * 2003-11-14 2004-11-10 中兴通讯股份有限公司 A method for downloading software from server side on client side in distributed system
CN101699398A (en) * 2009-10-27 2010-04-28 中兴通讯股份有限公司 RFID active tag, method for upgrading software thereof and system for upgrading software thereof
CN102063318A (en) * 2010-12-22 2011-05-18 Tcl通力电子(惠州)有限公司 Upgrading method of power supply MCU (Micro Control Unit)
CN102075564A (en) * 2010-12-23 2011-05-25 李华嵩 Remote software upgrading technique
CN201918993U (en) * 2010-09-03 2011-08-03 上海仪华仪器有限公司 Photoelectric conversion interface for connecting clip-on ammeter with computer
CN102280086A (en) * 2011-08-22 2011-12-14 青岛四方车辆研究所有限公司 Railway vehicle display
CN102353457A (en) * 2011-06-27 2012-02-15 北京理工大学 Distributed spectrum temperature measuring device for cloud and mist explosion field
CN103116056A (en) * 2012-08-07 2013-05-22 中国电力科学研究院 High-voltage direct current broadband domain corona current measurement system
CN103595476A (en) * 2012-08-13 2014-02-19 成都思迈科技发展有限责任公司 A USB power supply fiber transmit-receive apparatus
CN203675084U (en) * 2013-12-23 2014-06-25 深圳市思达仪表有限公司 Converter for USB light conversion electrical interface
CN104363274A (en) * 2014-11-03 2015-02-18 九阳股份有限公司 Network household appliance with updating function
CN105117253A (en) * 2015-08-27 2015-12-02 常州大学 BootLoader based remote upgrade method for UV LED (Ultraviolet Light Emitting Diode) curing system
CN105147199A (en) * 2015-08-25 2015-12-16 广东雷洋电子科技有限公司 Smart robot cleaner capable of cognizing environments

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1545363A (en) * 2003-11-14 2004-11-10 中兴通讯股份有限公司 A method for downloading software from server side on client side in distributed system
CN101699398A (en) * 2009-10-27 2010-04-28 中兴通讯股份有限公司 RFID active tag, method for upgrading software thereof and system for upgrading software thereof
CN201918993U (en) * 2010-09-03 2011-08-03 上海仪华仪器有限公司 Photoelectric conversion interface for connecting clip-on ammeter with computer
CN102063318A (en) * 2010-12-22 2011-05-18 Tcl通力电子(惠州)有限公司 Upgrading method of power supply MCU (Micro Control Unit)
CN102075564A (en) * 2010-12-23 2011-05-25 李华嵩 Remote software upgrading technique
CN102353457A (en) * 2011-06-27 2012-02-15 北京理工大学 Distributed spectrum temperature measuring device for cloud and mist explosion field
CN102280086A (en) * 2011-08-22 2011-12-14 青岛四方车辆研究所有限公司 Railway vehicle display
CN103116056A (en) * 2012-08-07 2013-05-22 中国电力科学研究院 High-voltage direct current broadband domain corona current measurement system
CN103595476A (en) * 2012-08-13 2014-02-19 成都思迈科技发展有限责任公司 A USB power supply fiber transmit-receive apparatus
CN203675084U (en) * 2013-12-23 2014-06-25 深圳市思达仪表有限公司 Converter for USB light conversion electrical interface
CN104363274A (en) * 2014-11-03 2015-02-18 九阳股份有限公司 Network household appliance with updating function
CN105147199A (en) * 2015-08-25 2015-12-16 广东雷洋电子科技有限公司 Smart robot cleaner capable of cognizing environments
CN105117253A (en) * 2015-08-27 2015-12-02 常州大学 BootLoader based remote upgrade method for UV LED (Ultraviolet Light Emitting Diode) curing system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
周天兵等: "单片机程序远程升级技术", 《仪表技术》 *
方冲等: "基于MCU的嵌入式在线升级***的设计与实现", 《电视技术》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112347019A (en) * 2019-08-07 2021-02-09 新唐科技股份有限公司 Operating device
CN110794804A (en) * 2019-09-25 2020-02-14 潍柴动力股份有限公司 System, ECU, motor vehicle and method for flashing ECU
CN111818513A (en) * 2020-06-11 2020-10-23 深圳硕日新能源科技有限公司 Remote upgrading method and remote upgrading system for solar controller
CN111856241A (en) * 2020-06-12 2020-10-30 广芯微电子(广州)股份有限公司 Chip mass production platform system and implementation method thereof

Similar Documents

Publication Publication Date Title
CN107037757A (en) A kind of BootLoader programme upgrade methods based on photoelectricity transmission
CN102376153B (en) The method of collector and carrier wave meter remote upgrade in automatic meter reading system
CN110417649A (en) A kind of multiplex roles Intelligent internet of things data gateway
WO2017049548A1 (en) Mobile terminal, power supply adapter, and upgrading method thereof
WO2017049553A1 (en) Mobile terminal, power supply adapter, and upgrading method thereof
CN104376711B (en) A kind of method and device of rapid configuration mobile terminal IR remote controller
CN113242534B (en) General type multi-protocol digital instrument thing allies oneself with module based on WI-FI
CN109471667A (en) Computer and mobile phones integrated intelligent interactive method
CN108958781B (en) Remote embedded firmware online upgrading method
Eady Networking and internetworking with microcontrollers
CN103838587A (en) Control system remote upgrading method and device based on GPRS
JP3092680U (en) Wireless keyboard for portable information terminals
CN109033010A (en) A kind of wireless downloading development board and wireless downloading method based on Arduino
CN105550621B (en) Laser barcode scanning system and method based on mobile intelligent terminal
CN204790445U (en) Multichannel synchronizing data collection system based on android system
CN102902551A (en) System and method for upgrading programs of talkback equipment based on single-chip microcomputer
CN106681778A (en) Multi-single-chip-microcomputer one-time flash system based on network and implementation method
KR20160011090A (en) Apparatus and Method for Updating Application Program of Internet of Things
CN103426287A (en) Novel communication control method and device based on mobile device and embedded device
CN203416258U (en) Cell-phone data storage system
CN112866313A (en) Massage chair software online upgrading method, upgrading system, control system and massage chair
CN212322246U (en) Program upgrading system based on NB-IoT module
CN204695025U (en) A kind of wireless bus connector based on bluetooth
CN211128204U (en) Wireless firmware upgrading system based on RDM protocol
CN214101376U (en) High-speed wireless data transceiver

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

RJ01 Rejection of invention patent application after publication