Utility model content
The purpose of this utility model is to provide a kind of embedded system, to solve the technical matters of MCU upgrading inconvenience.
The utility model provides a kind of embedded system, and this embedded system comprises:
Host computer, described host computer is provided with USB (universal serial bus) and serial communication interface;
Slave computer, each slave computer connects serial commu-nication interface, by serial communication interface and described upper machine communication.
Wherein, when described upper computer detection has memory device to access to described USB (universal serial bus), whether the memory device inside detecting access exists ROMPaq; If detect to there is ROMPaq, according to the rule pre-seted, determine the corresponding objects of this ROMPaq, and after determining this corresponding objects, stop the master routine being used for controlling each slave computer, judge whether to utilize this ROMPaq to carry out upgrade maintenance for its corresponding objects; If so, this ROMPaq is then utilized to carry out upgrade maintenance for its corresponding objects.
Wherein, this embedded system also comprises:
Display device, described display device connects described host computer by display device interface, the state of display host computer and slave computer thereof.
Wherein, whether current host computer and/or the slave computer carrying out upgrade maintenance of described display device display, also show host computer and transmits the speed of ROMPaq from the speed of the memory device acquisition ROMPaq of access, host computer and slave computer and successfully obtain and/or Successful transmissions.
Wherein, slave computer is the micro-control unit with application programming function.
Wherein, described host computer is the industrial control computer being provided with USB (universal serial bus), serial communication interface and display device interface.
Wherein, described host computer is also provided with power interface, audio interface and network interface.
The utility model brings following beneficial effect: the utility model embodiment provides a kind of embedded system, the host computer of this embedded system is provided with USB interface, the cooperation of the memory device accessed by host computer and USB interface thereof, for the upgrade maintenance of slave computer is provided convenience, solve the technical matters of slave computer updating operation inconvenience.
Other features and advantages of the utility model will be set forth in the following description, and, partly become apparent from instructions, or understand by implementing the utility model.The purpose of this utility model and other advantages realize by structure specifically noted in instructions, claims and accompanying drawing and obtain.
Embodiment
Describe embodiment of the present utility model in detail below with reference to drawings and Examples, to the utility model, how application technology means solve technical matters whereby, and the implementation procedure reaching technique effect can fully understand and implement according to this.It should be noted that, only otherwise form conflict, each embodiment in the utility model and each feature in each embodiment can be combined with each other, and the technical scheme formed is all within protection domain of the present utility model.
As shown in Figure 1, in the utility model embodiment, provide a kind of embedded system, this embedded system comprise host computer and one or more can with the slave computer of this upper machine communication (such as slave computer 1 to 4).In general, conceptually, effector and service provider are host computers, are slave computers by effector and attendee.In the utility model embodiment, host computer adopts band serial communication interface (abbreviation serial ports), USB interface, display device (such as liquid crystal indicator (Liquid Crystal Display, be called for short LCD)) industrial control computer of the interface such as interface, the serial ports of host computer is used to each slave computer communication, in order to monitor upgrade maintenance process in real time, be convenient to the operation of staff, this host computer is also connected with display device.In addition, the slave computer of the utility model embodiment adopts the MCU microcontroller with application programming (In Application Programming is called for short IAP) function.
Below, by describe in detail how to utilize this embedded system carry out upgrade maintenance for slave computer, this upgrade maintaining method is conducive to solving the technical matters that in prior art, slave computer (such as MCU) upgrading is inconvenient.
After the memory device (such as USB flash disk) being applicable to USB (universal serial bus) is inserted the corresponding interface of host computer by staff, host computer can scan the memory device of this access, whether there is ROMPaq in the memory device detecting this access.
Concrete, when specific filename being detected, there is ROMPaq in the memory device can knowing this access in each filename of the memory device inside of host computer scanning access.
In general, engineering staff, for the ease of differentiating each ROMPaq, can give each ROMPaq a unique filename, and filename is generally that the host computer corresponding with it or slave computer match.The title of this filename with host computer itself and each slave computer according to the filename of ROMPaq, can be mated, to determine the corresponding objects of this ROMPaq by host computer.
Or, also can store a form or one group of upgrading catalogue in advance in host computer, in form or catalogue, record the corresponding relation of the filename of ROMPaq and host computer, slave computer.In the utility model embodiment, host computer, after getting the filename of ROMPaq, can learn the corresponding objects of this upgrade file by inquiring about this upgrading catalogue.
When after the corresponding objects determining ROMPaq, whether host computer needs to detect this ROMPaq to its corresponding objects is higher version.And now no matter the corresponding objects of ROMPaq be host computer itself or one of them slave computer, all must ensure that the corresponding objects of ROMPaq is in off position, otherwise not only possibly normally cannot upgrade, itself cause irreversible damage also likely to this corresponding objects.Therefore, host computer terminates the master routine controlling each slave computer, and this makes host computer itself also enter off position.
Host computer accesses the corresponding objects of this ROMPaq, obtains the version number of the present procedure of the corresponding objects of this ROMPaq, contrasts with the version number of ROMPaq.If the version number of ROMPaq is comparatively new, then host computer is learnt and this ROMPaq can be utilized to carry out upgrade maintenance operation to its corresponding objects; Otherwise the current state of this corresponding objects is constant by keeping.
After upgrade maintenance operation terminates, host computer reopens its master routine, to realize control to slave computer, driving, recovers normal operating conditions.
Wherein, if the corresponding objects of determined ROMPaq is host computer, and during the version of the version of this ROMPaq higher than the current master routine of host computer, host computer obtains ROMPaq by the memory device of access USB interface, be buffered in internal memory (such as random access memory (Random-Access Memory is called for short RAM)).Obtain successfully, host computer will transfer this ROMPaq to cover current master routine, carries out the upgrade maintenance operation of host computer.
In addition, if the corresponding objects of determined ROMPaq is one of them slave computer, and when the version of this ROMPaq is higher, host computer needs in the memory device of access USB interface, obtain ROMPaq and be buffered in internal memory equally.Obtain successfully, this ROMPaq is sent to corresponding slave computer by host computer, carries out upgrade maintenance operation for slave computer.
Application master routine in slave computer, when the ROMPaq from host computer being detected, is transferred to after carrying out serial ports handshake communication in slave computer default " boot boot ", now can receives this binary ROMPaq with host computer.Due to ROMPaq transmit time, be partitioned into multiple packet, this multiple packet sends in order successively, and slave computer receives these packets successively and is restored to ROMPaq according to the sequencing of each packet.In order to prevent transmitting procedure from makeing mistakes, causing the failure of slave computer upgrade maintenance, in transmitting procedure, cyclic redundancy check (CRC) code (Cyclic Redundancy Check is called for short CRC) need be carried out.This is a kind of error check code the most frequently used in data communication field, it is characterized in that the length of information field and check field can be selected arbitrarily.CRC is a kind of data transmission error-detecting function, and transmitting terminal carries out polynomial computation to data, and is attached to after frame by the result obtained, and receiving end also performs similar algorithm, to ensure the correctness that data are transmitted and integrality.
In addition, in transmitting procedure, slave computer also needs to set up retransmission mechanism.If retransmission mechanism means wherein a certain data packets failure, then will retransfer this packet, until success, just then can transmit other packets according to the order preset afterwards.Can ensure that slave computer can be received sequentially each packet according to what preset like this, ensure that slave computer can restore this ROMPaq smoothly.
Similar, received ROMPaq is put in the middle of the flash memory (FLASH) of the application master routine of self by slave computer, utilizes this ROMPaq to cover current program, to realize the upgrade maintenance to slave computer.
Host computer can process ROMPaq simultaneously, also according to actual conditions, can sequentially process each ROMPaq.In the utility model embodiment, adopt sequentially to the mode that each slave computer is upgraded.
For the ease of operation, the management of engineering staff, display device can show the state of host computer and each slave computer thereof, therefore in whole upgrade maintenance process, whether the host computer that display device also can carry out upgrade maintenance to current or slave computer show, and can show host computer and obtain the speed of ROMPaq from the memory device of access and successfully obtain.Similar, display device also can show speed and the whether Successful transmissions that host computer and slave computer transmit ROMPaq.Whether display device also can show upgrade maintenance operation successful.
Concrete, as shown in Figure 2, for host computer, after it starts startup, will system initialization process be carried out, comprise some necessary parameters of configuration, the process such as each interface are set.Afterwards, host computer enters normal operating conditions.
Now, after the memory device access host computer that the USB interface such as USB flash disk are suitable for by staff, host computer can detect USB flash disk insert action, and whether the USB flash disk of host computer scanning afterwards judges in USB flash disk containing ROMPaq.If host computer does not detect USB flash disk insert action, whether duplicate detection there is USB flash disk insert action.
Then, the upgrading catalogue that host computer inquiry stores learns the corresponding objects of the upgrade file in USB flash disk, and what specifically correspond to host computer itself still corresponds to a certain slave computer.
If determine this ROMPaq corresponding to host computer itself, host computer will stop the master routine of self, and which version number is newer between the two to judge this current master routine and ROMPaq.If the version number of the ROMPaq in USB flash disk is comparatively new, known this ROMPaq that should utilize of host computer carries out upgrade maintenance operation to the master routine of host computer itself; Otherwise host computer can exit the process to this ROMPaq.If also have other ROMPaq in USB flash disk, host computer will go the process performing another ROMPaq.After all ROMPaq in USB flash disk are disposed, upgrade the upgrading catalogue stored, restart host computer master routine, exit the operation of whole upgrade maintenance, enter normal operating conditions.
In order to carry out upgrade maintenance operation to host computer, the ROMPaq (as .app file) in USB flash disk downloads by host computer, stored in internal memory, and this ROMPaq is covered current master routine, completes the upgrade maintenance operation of host computer.Meanwhile, display device demonstrates host computer, represent that current host computer carries out updating operation, also show the downloading process of whole ROMPaq and whether complete upgrade maintenance action.
If determine this ROMPaq corresponding to a certain slave computer, host computer needs the master routine stopping host computer equally, and access this slave computer, the version number of ROMPaq in the version number of the current program of this slave computer and USB flash disk is compared, if the version number of the ROMPaq in USB flash disk is comparatively new, the known master routine of this ROMPaq to this slave computer itself that should utilize of host computer carries out upgrade maintenance operation; Otherwise host computer can exit the process to this ROMPaq.If also have other ROMPaq in USB flash disk, host computer will go the process performing another ROMPaq.After all ROMPaq in USB flash disk are disposed, upgrade the upgrading catalogue stored, restart host computer master routine, exit the operation of whole upgrade maintenance, enter normal operating conditions.
In order to carry out upgrade maintenance operation to this slave computer, this ROMPaq is downloaded and stored in the internal memory of host computer, by serial ports, this ROMPaq is transferred to slave computer by host computer equally.Meanwhile, display device demonstrates this slave computer, represent that current slave computer carries out updating operation, also show the transmitting procedure of whole ROMPaq.
For slave computer, its " application master routine " when the ROMPaq from host computer being detected, is transferred in " boot boot ", now can receive this binary ROMPaq (as .bin file).As shown in Figure 3, open at it and after system initialization, if the ROMPaq that host computer transmits detected, handshake communication will be set up with host computer, starting to receive this binary ROMPaq.Simultaneously in order to ensure the correctness transmitted, in the process of transmission, carrying out CRC check and set up retransmission mechanism.Band EEPROM (Electrically Erasable Programmable Read Only Memo) (Electrically Erasable Programmable Read-Only Memory in slave computer, be called for short EEPROM), the state of this upgrading will be stored down, if upgrade successfully, upgrade maintenance operation can be exited, enter program, slave computer starts normal work; Otherwise if fail to upgrade successfully, slave computer will detect host computer again whether to its transmission ROMPaq.
In addition, if slave computer does not detect that host computer transmits ROMPaq to it, will judge that whether front upgrade maintenance operation is successful by EEPROM, if success, slave computer will enter program, start normally to work, otherwise, whether again detect host computer to its transmission ROMPaq.
For the ease of the use to host computer, operation, improve the man-machine interaction degree of host computer and staff, this host computer also can be provided with power interface for accessing power supply, can connect audio devices for staff provides the audio interface of audio-frequency information, also be provided with the network interface that can be connected to network in addition, be convenient to staff and communicated by network at any time.
In sum, the utility model embodiment provides a kind of embedded system, the host computer of this embedded system is provided with USB interface, the cooperation of the memory device accessed by host computer and USB interface thereof, for the upgrade maintenance of slave computer is provided convenience, solve the technical matters of slave computer updating operation inconvenience.
Although embodiment disclosed in the utility model is as above, the embodiment that described content just adopts for the ease of understanding the utility model, and be not used to limit the utility model.Technician in any the utility model art; under the prerequisite not departing from spirit and scope disclosed in the utility model; any amendment and change can be done what implement in form and in details; but scope of patent protection of the present utility model, the scope that still must define with appending claims is as the criterion.