CN112363765B - Circuit and method for automatically switching starting modes of processor - Google Patents

Circuit and method for automatically switching starting modes of processor Download PDF

Info

Publication number
CN112363765B
CN112363765B CN202011216214.4A CN202011216214A CN112363765B CN 112363765 B CN112363765 B CN 112363765B CN 202011216214 A CN202011216214 A CN 202011216214A CN 112363765 B CN112363765 B CN 112363765B
Authority
CN
China
Prior art keywords
usb
cpu
mode
power supply
level
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011216214.4A
Other languages
Chinese (zh)
Other versions
CN112363765A (en
Inventor
彭本坚
戴深亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shibang Communication Co ltd
Original Assignee
Shibang Communication 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 Shibang Communication Co ltd filed Critical Shibang Communication Co ltd
Priority to CN202011216214.4A priority Critical patent/CN112363765B/en
Publication of CN112363765A publication Critical patent/CN112363765A/en
Application granted granted Critical
Publication of CN112363765B publication Critical patent/CN112363765B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4403Processor initialisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/266Arrangements to supply power to external peripherals either directly from the computer or under computer control, e.g. supply of power through the communication port, computer controlled power-strips
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system
    • G06F9/4408Boot device selection
    • HELECTRICITY
    • H02GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
    • H02MAPPARATUS FOR CONVERSION BETWEEN AC AND AC, BETWEEN AC AND DC, OR BETWEEN DC AND DC, AND FOR USE WITH MAINS OR SIMILAR POWER SUPPLY SYSTEMS; CONVERSION OF DC OR AC INPUT POWER INTO SURGE OUTPUT POWER; CONTROL OR REGULATION THEREOF
    • H02M1/00Details of apparatus for conversion
    • H02M1/36Means for starting or stopping converters
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a circuit and a method for automatically switching a starting mode of a processor.A USB power supply direction detection module is connected to a USB interface and monitors the type of equipment connected to the USB interface; the power supply automatic reset module receives a monitoring signal of the USB power supply direction detection module and controls the CPU to supply power so as to power off the CPU and restart the CPU when the device connected on the USB interface is changed from a USB flash disk into a USB downloader; the CPU mode adjusting module receives a monitoring signal of the USB power supply direction detecting module and controls the starting mode of the CPU so as to adjust the starting mode of the CPU when the connected equipment is changed from a USB flash disk into a USB downloader; the reference voltage module provides reference voltages for other modules. The invention has the technical effects that the automatic switching of the CPU mode can be realized through the invention, the manual intervention is not needed, and the cost of the adopted circuit is much lower than that of a device which is arranged outside the shell, so the invention realizes the great efficiency improvement through lower cost and is suitable for large-scale popularization.

Description

Circuit and method for automatically switching starting modes of processor
Technical Field
The invention relates to a circuit and a method for automatically switching a starting mode of a processor.
Background
Currently, a CPU (central processing unit) module applied to industrial devices such as an industrial personal computer and an industrial control mainboard is generally connected with a USB downloader through a USB interface to download corresponding system files or other files to the CPU, so as to install, update or otherwise operate a software system on the CPU. However, the USB interface is also used for connecting the USB flash disk to download files from the industrial personal computer, and the like, so in order to prevent misoperation of system files possibly occurring in daily operation of connecting the USB flash disk, the CPU is provided with a normal operation mode and a serial download mode for downloading files from the USB downloader, the two modes can be switched with each other only by restarting the CPU, and misoperation of the system files in the CPU can not occur in daily operation.
Specifically, in daily operation, when the mode of the CPU needs to be switched from the normal operation mode to the serial download mode, the following steps are performed by using a circuit set in advance: a button, namely a BOOT button, is arranged on a BOOT pin of the CPU, and a code shifting switch is connected to a USB _ ID pin and used for setting the working mode of the CPU and the working mode of the USB. During operation, the code pulling switch of the USB _ ID is pulled to a low level, the BOOT button is pressed, the USB downloader is connected to the USB port for about 1 second, and then the BOOT button is released, so that the CPU enters a serial downloading mode, the CPU can be automatically restarted after downloading is completed, the USB downloader is pulled down, the USB _ ID is pulled to a high level, and the normal operation mode can be recovered. The principle of the above process is that when the CPU is powered on or restarted, the CPU enters a serial download mode as long as the CPU detects that the BOOT pin has a low level pulse, and meanwhile, if the USB _ ID pin is at a low level, the CPU is guided to download from a USB downloader connected to the USB interface, and after the serial download is completed, the CPU automatically restarts to complete the download, and finally, the USB _ ID needs to be pulled to a high level to recover the normal operation mode.
However, the above-described operation for switching the modes has a problem in that it is difficult to efficiently improve efficiency because the operations are manually performed one by one when performing the batch operation. Moreover, after the CPU is installed in the housing of the industrial personal computer, when the system needs to be upgraded, the housing must be disassembled to execute the operation, which causes great inconvenience in operation. If the BOOT button and the tap switch are separately connected with a set of operating device extending to the shell, the additional cost is too high, and the control cost of a manufacturer is not facilitated.
Disclosure of Invention
The invention provides a circuit and a method which can automatically realize switching of a starting mode of a processor and are low in cost, and aims to solve the technical problems that when a CPU device on an industrial personal computer carries out system file operation, mode switching is inconvenient to carry out, so that efficiency is low, and cost is high due to the fact that a single operation device is adopted.
In order to achieve the technical purpose, the technical scheme of the invention is that,
a circuit for automatically switching a starting mode of a processor comprises a USB power supply direction detection module, a power supply automatic reset module, a CPU mode adjustment module and a reference voltage module;
the USB power supply direction detection module is connected to the USB interface and monitors the type of equipment connected to the USB interface;
the power supply automatic reset module receives a monitoring signal of the USB power supply direction detection module and controls the CPU to supply power so as to power off the CPU and restart the CPU when the device connected with the USB interface is changed from a USB flash disk into a USB downloader;
the CPU mode adjusting module receives a monitoring signal of the USB power supply direction detecting module and controls the starting mode of the CPU so as to adjust the starting mode of the CPU when the connected equipment is changed from a USB flash disk into a USB downloader;
the reference voltage module provides reference voltage for other modules.
The circuit for automatically switching the starting mode of the processor is characterized in that the USB power supply direction detection module comprises a power supply direction comparator circuit, and the power supply direction comparator circuit is connected with a main system power supply and a USB interface circuit; when the USB interface is connected with the USB disk, the current direction flows from the main system power supply to the USB interface circuit, and the power supply direction comparator circuit acquires a current signal and outputs a level for representing the connection of the USB disk; when the USB interface is connected with the USB downloader, the current direction flows to the main system power supply from the USB interface circuit, and the power supply direction comparator circuit acquires the current signal and outputs the level representing the connection with the USB downloader.
The circuit for automatically switching the starting mode of the processor comprises a power supply direction comparator circuit and a power supply direction comparator circuit, wherein the non-inverting input end of the first operational amplifier is connected with a main system power supply, and the inverting input end of the first operational amplifier is connected with a USB interface circuit so as to output different levels through the output end when a USB interface is connected with a USB flash disk and a USB downloader.
The circuit for automatically switching the starting mode of the processor comprises a power supply automatic reset module, a power supply automatic reset module and a CPU power supply control terminal, wherein the power supply automatic reset module comprises a reset bit comparator circuit and a reset time delay circuit; when the output level of the USB power supply direction detection module received by the reset comparator circuit is changed into the level when the USB downloader is connected, the CPU is controlled to be powered off by the CPU power supply control end; after the CPU is controlled by the reset comparator circuit to be powered off, the reset delay circuit enables the level received by the reset comparator circuit to be changed into the level when the USB flash disk is connected through a preset time, so that the CPU is controlled by the reset comparator circuit to be powered on and restarted.
The circuit for automatically switching the starting mode of the processor comprises a complex comparator circuit and a complex comparator circuit, wherein the non-inverting input end of the complex comparator circuit is connected with a USB power supply direction detection module, the inverting input end of the complex comparator circuit is connected with a reference voltage module, and the output end of the complex comparator circuit is connected with a CPU power supply enabling control end so as to output a level for interrupting a CPU power supply when the output level of the USB power supply direction detection module is changed from the level when a USB flash disk is connected to the level when a USB downloader is connected to the level when the output level of the USB power supply direction detection module is changed from the level when the USB flash disk is connected to the level when the USB downloader is connected; reset delay circuit including reset delay electric capacity and reset delay resistance, reset delay electric capacity's both ends connect USB power supply direction detection module's output and second operational amplifier's in-phase input end respectively to be connected to main system power through reset delay resistance, when the level when with USB power supply direction detection module output level becomes the level when USB downloader connects from the level of connecting the USB flash disk, charge for reset delay electric capacity by main system power, make the in-phase input of second operational amplifier receive the level when connecting the USB flash disk again after the completion of charging.
The CPU mode adjusting module comprises a USB mode comparator circuit, a guide mode comparator circuit and a mode delay circuit, wherein the USB mode comparator circuit is connected with a USB power supply direction detecting module, a reference voltage module, a USB mode control end and the guide mode comparator circuit, the guide mode comparator circuit is also connected with the reference voltage module and the guide mode control end, and the mode delay circuit is arranged between the USB mode comparator circuit and the guide mode comparator circuit; when the output level of the USB power supply direction detection module received by the USB mode comparator circuit is changed into the level when the USB downloader is connected, an adjusting signal level is sent to adjust the CPU to start from the USB downloader through the USB mode control end; meanwhile, after receiving the adjusting signal level sent by the USB mode comparator circuit, the guide mode comparator circuit outputs a guide change signal level to the guide mode control end to control the CPU to be changed into a download mode after being restarted; after the CPU is restarted and changed into the downloading mode, the mode delay circuit enables the level received by the guide mode comparator circuit to be restored to the original state through a preset time, so that the level output by the guide mode comparator circuit is restored.
The circuit for automatically switching the starting mode of the processor comprises a third operational amplifier, wherein the non-inverting input end of the third operational amplifier is connected to a USB power supply direction detection module, the inverting input end of the third operational amplifier is connected with a reference voltage module, and the output end of the third operational amplifier is connected with a USB mode control end so as to output a level for starting a CPU (central processing unit) from a USB downloader when the output level of the USB power supply direction detection module is changed from the level when a USB flash disk is connected to the level when the USB downloader is connected to the USB downloader; the bootstrap mode comparator circuit comprises a fourth operational amplifier, wherein the non-inverting input end of the fourth operational amplifier is connected to the output end of the third operational amplifier, the inverting input end of the fourth operational amplifier is connected with the reference voltage module, and the output end of the fourth operational amplifier is connected with the bootstrap mode control end, so that when the level which is sent by the third operational amplifier and used for controlling the CPU to start from the USB downloader is received, the level which enables the CPU to be in the download mode after being restarted is sent out; the mode delay circuit comprises a mode delay capacitor and a mode delay resistor, wherein two ends of the mode delay capacitor are respectively connected with the output end of the third operational amplifier and the in-phase input end of the fourth operational amplifier and are connected to the main system power supply through the mode delay resistor, so that after the third operational amplifier outputs a level for starting the CPU from the USB downloader when the CPU is started, the main system power supply charges the mode delay capacitor, and the in-phase input end of the fourth operational amplifier receives the original level again.
A method of automatically switching processor boot modes, comprising the steps of:
monitoring the type of equipment connected to a USB interface through a USB power supply direction detection module;
step two, receiving a monitoring signal of the USB power supply direction detection module through the power supply automatic reset module and controlling the CPU to supply power so as to power off the CPU and restart the CPU when the device connected on the USB interface is changed from a USB flash disk into a USB downloader;
and step three, receiving the monitoring signal of the USB power supply direction detection module through the CPU mode adjustment module and controlling the starting mode of the CPU so as to adjust the starting mode of the CPU when the connected equipment is changed into a USB downloader from a USB flash disk.
In the first step, when a USB interface is connected with a USB flash disk, the current direction flows from a main system power supply to a USB interface circuit, and a USB power supply direction detection module acquires a current signal and outputs a level for representing the connection of the USB flash disk; when the USB interface is connected with the USB downloader, the current direction flows to the main system power supply through the USB interface circuit, and the USB power supply direction detection module acquires a current signal and outputs a level representing the connection with the USB downloader.
In the second step, when the output level of the USB power supply direction detection module received by the power supply automatic reset module is changed into the level when the USB downloader is connected, the CPU is controlled to be powered off; after the CPU is powered off, the level received by the automatic power supply reset module is changed into the level when the USB flash disk is connected through the time delay circuit after a preset time, so that the CPU is controlled to be powered on and restarted.
In the third step, when the output level of the USB power supply direction detection module received by the CPU mode adjustment module is changed into the level when the USB downloader is connected, an adjustment signal level is sent to adjust the CPU to start from the USB downloader; meanwhile, outputting a guide change signal level to control the CPU to change into a downloading mode after restarting; after the CPU is restarted and changed into a downloading mode, the level received by the CPU mode adjusting module is changed into the level when the USB flash disk is connected through a delay circuit by a preset time, so that the adjusting signal level and the guiding change signal level are restored.
The invention has the technical effects that the automatic switching of the CPU mode can be realized through the invention without manual intervention or contact with a CPU part, and the cost of the adopted circuit is much lower than that of a device which is arranged outside the shell, so the invention realizes great efficiency improvement through lower cost and is suitable for large-scale popularization.
Drawings
FIG. 1 is a circuit diagram of the present invention.
Detailed Description
Referring to fig. 1, the circuit adopted in this embodiment includes a USB power supply direction detection module, a power supply automatic reset module, a CPU mode adjustment module, and a reference voltage module. The USB power supply direction detection module is connected to the USB interface and monitors the type of equipment connected to the USB interface. The power supply automatic reset module receives the monitoring signal of the USB power supply direction detection module and controls the CPU to supply power so as to power off the CPU and restart the CPU when the USB flash disk of the device connected with the USB interface is changed into a USB downloader. The CPU mode adjusting module receives the monitoring signal of the USB power supply direction detecting module and controls the starting mode of the CPU so as to adjust the starting mode of the CPU when the connected equipment is changed from a USB flash disk into a USB downloader. The reference voltage module provides reference voltage for other modules.
Specifically, the USB power supply direction detection module in this embodiment includes a power supply direction comparator circuit, which is connected to the main system power supply VSYS _5V0 and the USB interface circuit VUSB. When the USB interface is connected with a U disk, the current direction flows from a main system power supply VSYS _5V0 to a USB interface circuit VUSB, and the power supply direction comparator circuit acquires a current signal and outputs a level representing the connection of the U disk. When the USB interface is connected to the USB downloader, the current direction flows from the USB interface circuit VUSB to the main system power supply VSYS — 5V0, and the power supply direction comparator circuit takes the current signal and outputs a level representing the connection to the USB downloader. The power supply direction comparator circuit comprises a first operational amplifier U1B, wherein the non-inverting input end of the first operational amplifier U1B is connected with a main system power supply VSYS _5V0, and the inverting input end is connected with a USB interface circuit VUSB so as to output different levels through the output end when a USB interface is connected with a U disk and a USB downloader. Since the U disk has no power supply and needs to be supplied by the main system power supply VSYS _5V0, when the USB interface is connected with the U disk, the current direction flows from the main system power supply VSYS _5V0 to the USB interface circuit VUSB, and at this time, the level of the non-inverting input end of the first operational amplifier U1B is higher than that of the inverting input end, so that the output end outputs high level. When the USB interface is connected to the USB downloader, since the USB downloader has its own power supply, the current flows from the USB interface circuit VUSB to the main system power supply VSYS _5V0, and the non-inverting input terminal of the first operational amplifier U1B has a lower level than the inverting input terminal, so the output terminal outputs a low level.
The power supply automatic reset module in the embodiment comprises a reset comparator circuit and a reset delay circuit, wherein the reset comparator circuit is connected with the USB power supply direction detection module, the reference voltage module and the CPU power supply control end, and the reset delay circuit is arranged between the USB power supply direction detection module and the reset comparator circuit. When the output level of the USB power supply direction detection module received by the reset comparator circuit is changed into the level when the USB downloader is connected, the CPU is controlled to be powered off through the CPU power supply control end. After the CPU is controlled by the reset comparator circuit to be powered off, the reset delay circuit enables the level received by the reset comparator circuit to be changed into the level when the USB flash disk is connected through a preset time, so that the CPU is controlled by the reset comparator circuit to be powered on and restarted.
Specifically, the complex comparator circuit in this embodiment includes the second operational amplifier U1E, the non-inverting input terminal of the second operational amplifier U1E is connected to the output terminal of the USB power supply direction detection module, i.e., the first operational amplifier U1B, the inverting input terminal is connected to the reference voltage module, and the output terminal is connected to the CPU power supply enable control terminal PEN, so as to output a level for causing CPU power supply interruption when the output level of the USB power supply direction detection module changes from the level when the USB flash disk is connected to the level when the USB downloader is connected. In this embodiment, when the output terminal of the first operational amplifier U1B outputs a low level to the non-inverting input terminal of the second operational amplifier U1E, the level of the reference voltage block connected to the inverting input terminal of the second operational amplifier U1E is unchanged, so the second operational amplifier U1E outputs a low level. And the CPU power enable control end PEN maintains normal work when receiving high level, and stops work when receiving low level, so that the CPU power enable control end can control the CPU to be powered off after the USB interface is connected with the USB flash disk. The reset delay circuit comprises a reset delay capacitor C2 and a reset delay resistor R9, two ends of the reset delay capacitor C2 are respectively connected with the output end of the USB power supply direction detection module and the non-inverting input end of the second operational amplifier U1E, and are connected to a main system power supply VSYS _5V0 through the reset delay resistor R9, so that when the output level of the USB power supply direction detection module is changed from the level when the USB flash disk is connected to the level when the USB downloader is connected, the main system power supply charges the reset delay capacitor C2, and the non-inverting input end of the second operational amplifier U1E receives the level when the USB flash disk is connected again after charging is completed. In this embodiment, when the output terminal of the first operational amplifier U1B outputs a low level, the reset delay capacitor C2 is charged by the main system power supply VSYS _5V0 through the reset delay resistor R9, and the level received by the non-inverting input terminal of the second operational amplifier U1E is pulled high again after a preset time, so that the CPU power enable control terminal PEN supplies power to the CPU again, and the CPU is automatically restarted after the USB interface is inserted into the USB disk.
The CPU mode adjusting module of this embodiment includes a USB mode comparator circuit, a boot mode comparator circuit, and a mode delay circuit, where the USB mode comparator circuit is connected to the USB power supply direction detecting module, the reference voltage module, the USB mode control terminal, and the boot mode comparator circuit, the boot mode comparator circuit is further connected to the reference voltage module and the boot mode control terminal, and the mode delay circuit is disposed between the USB mode comparator circuit and the boot mode comparator circuit. When the output level of the USB power supply direction detection module received by the USB mode comparator circuit is changed into the level when the USB downloader is connected, the output level of the USB power supply direction detection module is transmitted to the USB mode comparator circuit, and the level of the adjusting signal is used for adjusting the CPU to be started from the USB downloader through the USB mode control terminal. Meanwhile, after receiving the adjustment signal level sent by the USB mode comparator circuit, the boot mode comparator circuit outputs a boot change signal level to the boot mode control terminal to control the CPU to be changed into a download mode after being restarted. After the CPU is restarted and changed into a downloading mode, the mode delay circuit restores the level received by the guide mode comparator circuit to the original state by preset time so as to restore the level output by the guide mode comparator circuit.
Specifically, the USB mode comparator circuit of this embodiment includes a third operational amplifier U1D, the third operational amplifier U1D has a non-inverting input terminal connected to the output terminal of the first operational amplifier U1B, which is the USB power supply direction detection module, and an inverting input terminal connected to the reference voltage module, and an output terminal connected to the USB mode control terminal USB _ ID, so as to output a level enabling the CPU to start up from the USB downloader at startup when the output level of the USB power supply direction detection module changes from the level at which the USB disk is connected to the level at which the USB downloader is connected. That is, after the USB disk is plugged into the USB interface, the low level output by the first operational amplifier U1B is directly received by the non-inverting input terminal of the third operational amplifier U1D, at this time, the reference voltage connected to the inverting input terminal of the third operational amplifier U1D is not changed, the output terminal of the third operational amplifier U1D changes from high level to low level, the USB mode control terminal USB _ ID controls the USB mode to remain in the HOST mode when receiving the high level, and the USB mode control terminal USB _ ID switches to the OTG mode when receiving the low level, so that the CPU guides the USB downloader and downloads the file. The BOOT mode comparator circuit comprises a fourth operational amplifier U1C, wherein the non-inverting input terminal of the fourth operational amplifier is connected to the output terminal of the third operational amplifier U1D, the inverting input terminal of the fourth operational amplifier is connected to the reference voltage module, and the output terminal of the fourth operational amplifier is connected to the BOOT mode control terminal BOOT, so that when the level which is sent by the third operational amplifier U1D and used for controlling the CPU to start from the USB downloader is received, the level which enables the CPU to be changed into the download mode after being restarted is sent out. The BOOT mode control terminal BOOT detects the received level when the CPU is powered on or restarted, and when receiving a high level, the CPU starts up based on the system stored in the CPU itself, and when receiving a low level, the CPU enters a serial download mode and is booted up by an external BOOT. Therefore, firstly, the CPU power supply enable control terminal PEN is powered off after receiving the low level, then the CPU is restarted after delaying, at the moment, the BOOT mode control terminal BOOT is at the low level, the CPU enters the serial download mode after being restarted, and meanwhile, the USB _ ID of the USB mode control terminal is at the low level, and the CPU is guided by the USB downloader connected to the USB interface entering the OTG mode to download.
Finally, the mode delay circuit of the embodiment includes a mode delay capacitor C4 and a mode delay resistor R12, two ends of the mode delay capacitor C4 are respectively connected to the output terminal of the third operational amplifier U1D and the non-inverting input terminal of the fourth operational amplifier U1C, and are connected to the main system power supply VSYS _5V0 through the mode delay resistor, so that after the third operational amplifier U1D outputs a level enabling the CPU to start from the USB downloader during startup, the main system power supply VSYS _5V0 charges the mode delay capacitor C4, and the non-inverting input terminal of the fourth operational amplifier U1C receives the original level again. That is, after the CPU enters the serial download mode, the fourth operational amplifier U1C resumes outputting high. The CPU can be automatically restarted after downloading the file on the USB downloader, and the BOOT mode control terminal BOOT is at a high level after the CPU is restarted, so the CPU can be directly started by the system of the CPU, at the moment, the USB _ ID of the USB mode control terminal can not influence the normal starting process of the CPU no matter at the high level or the low level, and because the CPU can automatically shield the step of being guided by the external equipment in the normal starting process, the external equipment can be detected and guided only in the serial download mode, which is the general setting of the CPU. Therefore, after the CPU finishes downloading the file from the USB downloader and restarts, the non-inverting input terminal of the second operational amplifier U1E is pulled high by the reset delay capacitor C2, and the non-inverting input terminal of the fourth operational amplifier U1C is also charged high by the mode delay capacitor C4, so that the system can maintain normal operation. At this time, all operations can be completed only by pulling out the USB downloader.
The above embodiment is directed to the execution mode described when the CPU power enable control terminal PEN of the CPU is powered off at a low level, the USB mode control terminal USB _ ID is in the OTG mode at a low level, and the BOOT mode control terminal BOOT enters the serial download mode at a low level. In fact, when the level execution modes of the control terminals are opposite, that is, the CPU power enable control terminal PEN is powered off when the level is high, the USB mode control terminal USB _ ID is in the OTG mode when the level is high, or the BOOT mode control terminal BOOT enters the serial download mode when the level is high, the automatic switching of the processor start mode can be realized according to the principle provided by the present invention, and those skilled in the art can adjust the mode according to the specific details.
The embodiment also provides a method for automatically switching the starting mode of a processor, which comprises the following steps:
monitoring the type of equipment connected to a USB interface through a USB power supply direction detection module;
step two, receiving a monitoring signal of the USB power supply direction detection module through the power supply automatic reset module and controlling the CPU to supply power so as to power off the CPU and restart the CPU when the device connected on the USB interface is changed from a USB flash disk into a USB downloader;
and step three, receiving the monitoring signal of the USB power supply direction detection module through the CPU mode adjustment module and controlling the starting mode of the CPU so as to adjust the starting mode of the CPU when the connected equipment is changed from a USB flash disk into a USB downloader.
In the first step, when the USB interface is connected with the USB flash disk, the current direction flows from a main system power supply to a USB interface circuit, and a USB power supply direction detection module acquires a current signal and outputs a level for representing the connection of the USB flash disk; when the USB interface is connected with the USB downloader, the current direction flows to the main system power supply from the USB interface circuit, and the USB power supply direction detection module acquires a current signal and outputs a level representing the connection with the USB downloader.
In the second step, when the output level of the USB power supply direction detection module received by the power supply automatic reset module is changed into the level when the USB downloader is connected, the CPU is controlled to be powered off; after the CPU is powered off, the level received by the automatic power supply reset module is changed into the level when the USB flash disk is connected through a time delay circuit after preset time, so that the CPU is controlled to be powered on and restarted.
In the third step, when the output level of the USB power supply direction detection module received by the CPU mode adjustment module is changed into the level when the USB downloader is connected, an adjustment signal level is sent to adjust the CPU to start from the USB downloader; meanwhile, outputting a guide change signal level to control the CPU to change into a downloading mode after restarting; after the CPU is restarted and changed into a downloading mode, the level received by the CPU mode adjusting module is changed into the level when the USB flash disk is connected through a delay circuit by a preset time, so that the adjusting signal level and the guiding change signal level are restored.

Claims (9)

1. A circuit for automatically switching a starting mode of a processor is characterized by comprising a USB power supply direction detection module, a power supply automatic reset module, a CPU mode adjustment module and a reference voltage module;
the USB power supply direction detection module is connected to the USB interface and monitors the type of equipment connected to the USB interface;
the power supply automatic reset module receives a monitoring signal of the USB power supply direction detection module and controls the CPU to supply power so as to power off the CPU and restart the CPU when the device connected with the USB interface is changed from a USB flash disk into a USB downloader;
the CPU mode adjusting module receives a monitoring signal of the USB power supply direction detecting module and controls the starting mode of the CPU so as to adjust the starting mode of the CPU when the connected equipment is changed from a USB flash disk into a USB downloader;
the reference voltage module provides reference voltage for other modules;
the power supply automatic reset module comprises a reset bit comparator circuit and a reset time delay circuit, the reset bit comparator circuit is connected with the USB power supply direction detection module, the reference voltage module and the CPU power supply control end, and the reset time delay circuit is arranged between the USB power supply direction detection module and the reset bit comparator circuit; when the output level of the USB power supply direction detection module received by the reset comparator circuit is changed into the level when the USB downloader is connected, the CPU is controlled to be powered off by the CPU power supply control end; after the CPU is controlled by the reset comparator circuit to be powered off, the reset delay circuit enables the level received by the reset comparator circuit to be changed into the level when the USB flash disk is connected through a preset time, so that the CPU is controlled by the reset comparator circuit to be powered on and restarted.
2. The circuit of claim 1, wherein the USB power direction detection module comprises a power direction comparator circuit, the power direction comparator circuit being coupled to a power source of the host system and the USB interface circuit; when the USB interface is connected with the USB flash disk, the current direction flows from the main system power supply to the USB interface circuit, and the power supply direction comparator circuit acquires a current signal and outputs a level representing the connection of the USB flash disk; when the USB interface is connected with the USB downloader, the current direction flows to the main system power supply from the USB interface circuit, and the power supply direction comparator circuit acquires the current signal and outputs the level representing the connection with the USB downloader.
3. The circuit of claim 2, wherein the power direction comparator circuit comprises a first operational amplifier having a non-inverting input connected to a main system power supply and an inverting input connected to the USB interface circuit, such that different levels are output from the output when the USB interface is connected to the USB flash drive and the USB downloader.
4. The circuit according to claim 1, wherein the complex comparator circuit comprises a second operational amplifier, the non-inverting input terminal of the second operational amplifier is connected to the USB power supply direction detection module, the inverting input terminal of the second operational amplifier is connected to the reference voltage module, and the output terminal of the second operational amplifier is connected to the CPU power control terminal, so as to output a level for interrupting the CPU power supply when the output level of the USB power supply direction detection module changes from the level when the USB power supply direction detection module is connected to the USB downloader; reset delay circuit including reset delay electric capacity and reset delay resistance, reset delay electric capacity's both ends connect USB power supply direction detection module's output and second operational amplifier's in-phase input respectively to through reset delay resistance be connected to main system power, with when USB power supply direction detection module output level becomes the level when USB downloader connects from the level when connecting the USB flash disk, charge for reset delay electric capacity by main system power, make second operational amplifier's in-phase input receive the level when connecting the USB flash disk again after the completion of charging.
5. The circuit according to claim 1, wherein the CPU mode adjustment module comprises a USB mode comparator circuit, a boot mode comparator circuit, and a mode delay circuit, the USB mode comparator circuit is connected to the USB power supply direction detection module, the reference voltage module, the USB mode control terminal, and the boot mode comparator circuit, the boot mode comparator circuit is further connected to the reference voltage module and the boot mode control terminal, and the mode delay circuit is disposed between the USB mode comparator circuit and the boot mode comparator circuit; when the output level of the USB power supply direction detection module received by the USB mode comparator circuit is changed into the level when the USB downloader is connected, an adjusting signal level is sent to adjust the CPU to start from the USB downloader through the USB mode control end; meanwhile, after receiving the adjusting signal level sent by the USB mode comparator circuit, the guide mode comparator circuit outputs a guide change signal level to the guide mode control end to control the CPU to be changed into a download mode after being restarted; after the CPU is restarted and changed into a downloading mode, the mode delay circuit restores the level received by the guide mode comparator circuit to the original state by preset time so as to restore the level output by the guide mode comparator circuit.
6. The circuit of claim 5, wherein the USB mode comparator circuit comprises a third operational amplifier having a non-inverting input connected to the USB power direction detection module, an inverting input connected to the reference voltage module, and an output connected to the USB mode control terminal, for outputting a level enabling the CPU to start up from the USB downloader upon start-up when the USB power direction detection module output level changes from a level at which the USB flash drive is connected to a level at which the USB downloader is connected to the USB power direction detection module; the boot mode comparator circuit comprises a fourth operational amplifier, wherein the non-inverting input end of the fourth operational amplifier is connected to the output end of the third operational amplifier, the inverting input end of the fourth operational amplifier is connected with the reference voltage module, and the output end of the fourth operational amplifier is connected with the boot mode control end, so that when the level which is sent by the third operational amplifier and used for controlling the CPU to start from the USB downloader is received, the level which enables the CPU to be changed into the download mode after being restarted is sent out; the mode delay circuit comprises a mode delay capacitor and a mode delay resistor, wherein two ends of the mode delay capacitor are respectively connected with the output end of the third operational amplifier and the in-phase input end of the fourth operational amplifier and are connected to the main system power supply through the mode delay resistor, so that after the third operational amplifier outputs a level for starting the CPU from the USB downloader when the CPU is started, the main system power supply charges the mode delay capacitor, and the in-phase input end of the fourth operational amplifier receives the original level again.
7. A method for automatically switching processor boot modes, comprising the steps of:
monitoring the type of equipment connected to a USB interface through a USB power supply direction detection module;
step two, receiving a monitoring signal of the USB power supply direction detection module through the power supply automatic reset module and controlling the CPU to supply power so as to power off the CPU and restart the CPU when the device connected on the USB interface is changed from a USB flash disk into a USB downloader;
step three, receiving a monitoring signal of the USB power supply direction detection module through a CPU mode adjustment module and controlling the starting mode of the CPU so as to adjust the starting mode of the CPU when the connected equipment is changed from a USB flash disk into a USB downloader;
in the second step, when the output level of the USB power supply direction detection module received by the power supply automatic reset module is changed into the level when the USB downloader is connected, the CPU is controlled to be powered off; after the CPU is powered off, the level received by the automatic power supply reset module is changed into the level when the USB flash disk is connected through the time delay circuit after a preset time, so that the CPU is controlled to be powered on and restarted.
8. The method according to claim 7, wherein in step one, when the USB interface is connected to the USB disk, a current direction flows from a main system power source to the USB interface circuit, and the USB power direction detection module obtains a current signal and outputs a level indicating the connection to the USB disk; when the USB interface is connected with the USB downloader, the current direction flows to the main system power supply from the USB interface circuit, and the USB power supply direction detection module acquires a current signal and outputs a level representing the connection with the USB downloader.
9. The method as claimed in claim 7, wherein in step three, when the output level of the USB power supply direction detection module received by the CPU mode adjustment module changes to the level when the USB downloader is connected, an adjustment signal level is sent to adjust the CPU startup from the USB downloader; meanwhile, outputting a guide change signal level to control the CPU to change into a downloading mode after restarting; after the CPU is restarted and changed into the downloading mode, the level received by the CPU mode adjusting module is changed into the level when the USB flash disk is connected through a delay circuit by preset time, so that the adjusting signal level and the guiding change signal level are restored.
CN202011216214.4A 2020-11-04 2020-11-04 Circuit and method for automatically switching starting modes of processor Active CN112363765B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011216214.4A CN112363765B (en) 2020-11-04 2020-11-04 Circuit and method for automatically switching starting modes of processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011216214.4A CN112363765B (en) 2020-11-04 2020-11-04 Circuit and method for automatically switching starting modes of processor

Publications (2)

Publication Number Publication Date
CN112363765A CN112363765A (en) 2021-02-12
CN112363765B true CN112363765B (en) 2022-08-19

Family

ID=74513002

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011216214.4A Active CN112363765B (en) 2020-11-04 2020-11-04 Circuit and method for automatically switching starting modes of processor

Country Status (1)

Country Link
CN (1) CN112363765B (en)

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103577360A (en) * 2012-07-23 2014-02-12 深圳市中兴移动通信有限公司 Device and method for enabling intelligent terminal to enter downloading and upgrading mode
US9128721B2 (en) * 2012-12-11 2015-09-08 Apple Inc. Closed loop CPU performance control
KR20140128122A (en) * 2013-04-26 2014-11-05 주식회사 코아로직 Automatic entrance device and method for upgrade boot mode
CN103336700B (en) * 2013-06-09 2016-08-10 深圳市汇川技术股份有限公司 The serial ports programming circuitry of a kind of digital signal processor and system
CN106528237B (en) * 2013-10-18 2019-10-18 歌尔科技有限公司 MCU start-up mode selection circuit and MCU code update method based on the circuit
CN104461664B (en) * 2014-12-30 2018-04-27 深圳市辰卓科技有限公司 MCU start-up mode selection circuits
CN107783769A (en) * 2016-08-24 2018-03-09 青岛歌尔声学科技有限公司 A kind of method, apparatus and electronic equipment by USB upgrading electronic equipment
CN107885650A (en) * 2016-09-30 2018-04-06 联芯科技有限公司 A kind of program debugging method and system
CN107885510B (en) * 2017-11-03 2021-04-09 黄骅市交大思诺科技有限公司 Burning tool and burning method capable of simultaneously burning double DSPs
CN111090605B (en) * 2019-10-10 2023-07-28 惠州市德赛西威汽车电子股份有限公司 USB-to-UART circuit for MCU software upgrade

Also Published As

Publication number Publication date
CN112363765A (en) 2021-02-12

Similar Documents

Publication Publication Date Title
US6275949B1 (en) Power controller for a peripheral device that stores the on/off state thereof when power is removed from the device
CN107465227B (en) Electronic equipment and control method thereof
EP2821882B1 (en) Computer device and method for converting working mode of universal serial bus connector of the computer device
EP3982506B1 (en) Terminal device charging method and apparatus, and storage medium
US20120198250A1 (en) Portable terminal equipment, a power supply system, and a power supply method and a power supply program for portable terminal equipment
CN109726059B (en) Server test system
US11641124B2 (en) Electronic device and charging method thereof
CN112363765B (en) Circuit and method for automatically switching starting modes of processor
WO2015143793A1 (en) Current control method and terminal device
JP2002258988A (en) Uninterruptible power system
JP2004159382A (en) Electronic apparatus
TW201239602A (en) Electronic device
JP2016004516A (en) Electronic device
CN111694340A (en) Automatic test fixture and method for PSU BootLoader
CN101751102B (en) Starting-up signal generating device
EP2763273A1 (en) Connecting auxiliary battery charger IC to mobile chipset
CN111045506B (en) Control method and electronic equipment
CN110858165B (en) Chip set, chip set starting method and electronic equipment
US20180267811A1 (en) Electronic apparatus and control method of the same
CN110417086B (en) Battery overdischarge reset control circuit and mobile terminal
JP6364991B2 (en) Electronics
KR20030052769A (en) Apparatus and method for charge of using usb of mobile communication terminal
CN102455955A (en) Dual-processor boot-up system
CN216596229U (en) Control circuit of watchdog chip
CN110262992B (en) Control 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
GR01 Patent grant
GR01 Patent grant