Power supply device, controller, and control method for controller

By using internal power switching and monitoring circuits in the multiprocessor control system, the complexity of data retention after power failure in the multiprocessor system is solved, ensuring that data can be correctly restored when the external power is restored, and the reliability of the system is improved .

CN119045637AInactive Publication Date: 2024-11-29ZHEJIANG GUOLI XINAN TECH CO LTD
View PDF 15 Cites 0 Cited by

Patent Information

Application Number
CN202411556693.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-04
Publication Date
2024-11-29
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In a multiprocessor control system, the data holding function after power failure is complicated to perform, making it difficult to take into account data from the processor or other parts of the processor, resulting in data loss or inability to recover correctly.

Method used

Provide power supply devices and control methods, use internal power to switch to backup power, switch power supply when external power supply is powered off, monitor the remaining power and data transmission of internal power supply through controllable switching components and monitoring circuits, ensuring the main processing device and slave processing device data storage.

Benefits of technology

Effectively using internal power to save data from multiprocessor controllers, improves power-down data retention function and system reliability, ensuring that data and operations can be restored correctly when external power is restored.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119045637A_ABST
    Figure CN119045637A_ABST
Patent Text Reader

Abstract

The invention provides a power supply device, a controller and a control method for the controller. The power supply device includes: an internal power source; a power switching circuit; the first monitoring circuit is configured to monitor power failure of the external power supply and provide a monitoring result to the power supply switching circuit and the main processing device; the second monitoring circuit is configured to monitor the residual electric quantity of the internal power supply after the power supply is switched to the internal power supply; and a controllable switch assembly coupled between the power switching circuit and the plurality of slave processing devices, the power supply of the internal power supply to the at least one slave processing device is cut off when at least one of the following is satisfied: a monitoring signal from the second monitoring circuit indicates that the remaining power of the internal power supply is lower than a predetermined threshold; and the master processing device has received the to-be-saved data of the at least one slave processing device. According to the scheme of the invention, the power-down data retention of the controller with a plurality of processing devices is improved, and the reliability of the controller is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a power-off data retention technology for a control system or a controller, and more particularly, to a power supply device, a controller including the power supply device, and a control method for the controller. Background Art

[0002] In industrial fields such as industrial automation, many scenarios require the control system to have the function of retaining data after power failure. In other words, the controller of the control system needs to store the current state variables after power failure, and can continue to work through the stored state variables after power is restored and powered on again. For example, in high-precision position control scenarios such as ship cable retraction and release, rudder plug shaft, etc., high-precision recording of movement position is required, so it is very important to ensure that the last run command at the time of power failure can be executed correctly after power is restored.

[0003] With the rapid development of industrial automation, control systems are becoming more and more complex, and with the increase in control services, control systems have evolved from single processors to multi-processors. Multi-processing makes control and scheduling complicated, making it difficult to perform power-off data retention functions and causing some problems, such as being unable to take into account data from the slave processor or other parts of the processor. Summary of the invention

[0004] In order to at least partially solve the above and other possible problems, embodiments of the present invention provide a power supply device, a controller, and a control method for the controller.

[0005] According to a first aspect of the present invention, there is provided a power supply device, comprising: an internal power supply; a power switching circuit, configured to use an external power supply as a power supply to power a main processing device and a plurality of slave processing devices of a controller, and to switch the power supply to the internal power supply when the external power supply is powered off, so that the plurality of slave processing devices can use the power of the internal power supply to transmit data to the main processing device and the main processing device can use the power of the internal power supply to save data; a first monitoring circuit, configured to monitor power failure of the external power supply and provide the monitoring result to the power switching circuit and the main processing device; a second monitoring circuit, configured to monitor the remaining power of the internal power supply after the power supply is switched to the internal power supply; and a controllable switch component, coupled between the power switching circuit and the plurality of slave processing devices, and configured to cut off the power supply of the internal power supply to at least one slave processing device when at least one of the following items is satisfied: a monitoring signal from the second monitoring circuit indicates that the remaining power of the internal power supply is lower than a predetermined threshold; and the main processing device has received data to be saved from at least one slave processing device.

[0006] In some embodiments of the present invention, the controllable switch component includes a plurality of controllable switches corresponding to the plurality of slave processing devices, the second monitoring circuit includes a plurality of voltage comparison sub-circuits corresponding to the plurality of slave processing devices, and the predetermined threshold includes a plurality of voltage thresholds different from each other corresponding to the plurality of slave processing devices, wherein each voltage comparison sub-circuit is configured to compare the output voltage of the internal power supply with the corresponding voltage threshold, and output a signal to the corresponding controllable switch for cutting off the power supply of the internal power supply to the corresponding slave processing device when the output voltage is lower than the corresponding voltage threshold.

[0007] In some embodiments of the present invention, the controllable switch component also includes: a plurality of logic gates corresponding to a plurality of slave processing devices, each logic gate having a first input terminal coupled to a corresponding voltage comparison subcircuit and a second input terminal suitable for coupling to a master processing device, and an output terminal coupled to a corresponding controllable switch.

[0008] In some embodiments of the present invention, the first monitoring circuit includes: a Zener diode, suitable for coupling to an external power supply; an optocoupler element, including a light-emitting device located on the primary side and a photosensitive device located on the secondary side, the light-emitting device is coupled between the Zener diode and a first reference potential, and the photosensitive device is coupled between a second reference potential and a third reference potential; and an output resistor, coupled between the photosensitive device and the second reference potential or the third reference potential, wherein the node between the output resistor and the photosensitive device is coupled to a power switching circuit and a main processing device.

[0009] In some embodiments of the present invention, the power switching circuit includes: a first conductive path, suitable for coupling an external power supply to a master processing device and multiple slave processing devices; and a second conductive path, including a first switch and a second switch, the first switch is coupled between the internal power supply and the master processing device and the multiple slave processing devices, and the second switch is coupled between the control terminal of the first switch and a fourth reference potential, and is configured to be turned on in response to a monitoring result indicating that a power failure of the external power supply occurs to trigger the first switch to be turned on.

[0010] In some embodiments of the present invention, the power switching circuit further includes a power converter coupled between the first conductive path and the second conductive path and the master processing device and the plurality of slave processing devices.

[0011] In some embodiments of the present invention, the internal power source comprises a supercapacitor adapted to be charged by an external power source.

[0012] According to a second aspect of the present invention, there is provided a controller, the controller comprising: a master processing device and a plurality of slave processing devices, and the power supply device according to the first aspect.

[0013] In some embodiments of the present invention, the main processing device is configured to: in response to a monitoring result received from a first monitoring circuit indicating that an external power supply has lost power, receive a monitoring signal from a second monitoring circuit indicating the remaining power of an internal power supply; and perform the following operations based on the monitoring signal: if the monitoring signal indicates that there is a slave processing device that is powered by the internal power supply, receive the data to be saved from the slave processing device that is powered, and store the main processing device's own data to be saved and the received data to be saved in a non-volatile memory; and if the monitoring signal indicates that there is no slave processing device that is powered by the internal power supply, store the main processing device's own data to be saved in a non-volatile memory.

[0014] In some embodiments of the present invention, the master processing device is further configured to: if data to be saved from one of the slave processing devices maintaining power has been received, send a signal to the controllable switch component to cut off the internal power supply to one of the slave processing devices.

[0015] In some embodiments of the present invention, the main processing device is configured to store the to-be-saved data in the non-volatile memory in sequence based on priorities corresponding to the data addresses.

[0016] In some embodiments of the present invention, the main processing device is further configured to: store the to-be-saved data in the non-volatile memory in sequence based on the size of the storage space used in real time at the data address.

[0017] According to a third aspect of the present invention, there is provided a control method for a controller according to the second aspect, comprising: in response to a monitoring result received from a first monitoring circuit indicating that a power failure has occurred in an external power supply, receiving a monitoring signal indicating the remaining power of an internal power supply from a second monitoring circuit; and performing the following operations based on the monitoring signal: if the monitoring signal indicates that there is a slave processing device that is powered by an internal power supply, receiving data to be saved from the slave processing device that is powered, and storing the data to be saved of the main processing device itself and the received data to be saved in a non-volatile memory; and if the monitoring signal indicates that there is no slave processing device that is powered by an internal power supply, storing the data to be saved of the main processing device itself in a non-volatile memory.

[0018] In some embodiments of the present invention, the control method further comprises: if data to be saved from one of the slave processing devices maintaining power has been received, sending a signal to the controllable switch component for cutting off the internal power supply to the one slave processing device.

[0019] In some embodiments of the present invention, storing the data to be saved of the main processing device itself and the received data to be saved in a non-volatile memory or storing the data to be saved of the main processing device itself in a non-volatile memory includes: storing the data to be saved in the non-volatile memory in sequence based on the priority corresponding to the data address.

[0020] In some embodiments of the present invention, storing the data to be saved in the non-volatile memory in sequence based on the priority corresponding to the data address includes: storing the data to be saved in the non-volatile memory in sequence based on the real-time used storage space size at the data address.

[0021] This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the invention, nor is it intended to limit the scope of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The above and other objects, features and advantages of the present invention will become more apparent through a more detailed description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, wherein like reference numerals generally represent like components throughout the exemplary embodiments of the present invention.

[0023] Figure 1 A schematic circuit block diagram of a controller according to an embodiment of the present invention is shown.

[0024] Figure 2 A schematic circuit diagram of a controller according to another embodiment of the present invention is shown.

[0025] Figure 3 FIG. 4 is a schematic circuit diagram of a first monitoring circuit according to an embodiment of the present invention.

[0026] Figure 4 A schematic circuit diagram of a path switching portion of a power switching circuit according to an embodiment of the present invention is shown.

[0027] Figure 5 A schematic flow chart of a control method for a controller according to an embodiment of the present invention is shown.

[0028] Figure 6 A schematic diagram showing data addresses of a memory of a main processing device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0029] Embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to make the present invention more thorough and complete, and to fully convey the scope of the present invention to those skilled in the art. Those skilled in the art can select alternative technical solutions from the following description without departing from the spirit and scope of the present invention.

[0030] As used herein, the term "including" and its variations mean open inclusion, i.e., "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "based at least in part on". The terms "an example embodiment" and "an embodiment" mean "at least one example embodiment". Other explicit and implicit definitions may also be included below.

[0031] In an embodiment of the present invention, an improved power supply scheme for a controller is provided. In the improved scheme, for a controller including a main processing device and multiple slave processing devices, a first monitoring circuit and a second monitoring circuit are used to monitor the power failure of an external power supply and the remaining power of an internal power supply, respectively, and a controllable switch component is used to appropriately provide or cut off the power supply to one or more slave processing devices based on the monitoring situation and the data transmission situation. This can efficiently utilize the power of the internal power supply when the external power supply fails and save all or the maximum amount of data of the main processing device and multiple slave processing devices, thereby improving the power failure data retention function of the controller and improving the reliability of the controller. In some embodiments, the scheme of the present invention also provides a simple and reliable power failure monitoring scheme and a remaining power monitoring scheme for the internal power supply, so that high-voltage power failure monitoring and remaining power monitoring can be achieved in a simple and low-cost manner using commonly used components.

[0032] Figure 1 FIG. 1 shows a schematic circuit block diagram of a controller 1000 according to an embodiment of the present invention. Figure 1As shown, the controller 1000 includes a main processing device 110 and a plurality of slave processing devices 120-1, 120-2...120-N. As an example, the main processing device 110 and each of the plurality of slave processing devices may include a central processing unit (CPU), and may also include other appropriate components or units, such as memory or cache. The main processing device 110 may also include a built-in non-volatile memory, such as a flash memory (Flash), which may be used to store data that needs to be maintained when power is off. It is understood that the main processing device 110 may also not have a built-in non-volatile memory, and the non-volatile memory for storing power-off retention data is set outside the main processing device 110. A communication link is set between the main processing device 110 and the plurality of slave processing devices 120-1, 120-2...120-N for data interaction and transmission between the master and slave processing devices. The controller 1000 also includes a power supply device 200. The power supply device 200 is coupled to the master processing device 110 and the plurality of slave processing devices 120 - 1 , 120 - 2 . . . 120 -N to supply power to the master processing device 110 and the plurality of slave processing devices 120 - 1 , 120 - 2 . . . 120 -N.

[0033] According to an embodiment of the present invention, the power supply device 200 includes an internal power supply 210 and a power switching circuit 220. The power switching circuit 220 uses an external power supply as a power supply to power the master processing device 110 and multiple slave processing devices 120-1, 120-2...120-N, and switches the power supply to the internal power supply 210 when the external power supply is powered off, so that the master processing device 110 can use the power of the internal power supply 210 to save data. Specifically, the external power supply may include any appropriate power supply located outside the controller 1000, such as a public power grid including a power conversion device, a battery pack, etc. Thus, the external power supply can be used to continuously supply power to the master and slave processing devices of the controller 1000 to support the normal operation of the master and slave processing devices. The internal power supply 210 is built into the power supply device 200 and can be charged by an external power supply or pre-stored with electrical energy. Therefore, in the event of a power outage of the external power supply, the power switching circuit 220 can switch the power supply to the internal power supply 210, thereby serving as a backup power supply to support the controller 1000 in saving the power-off data of the main processing device 110 and multiple slave processing devices 120-1, 120-2...120-N, so that after the external power supply is restored, the controller 1000 can resume normal operation through the saved power-off data.

[0034] The power supply device 200 further includes a first monitoring circuit 230 and a second monitoring circuit 240. The first monitoring circuit 230 monitors power failure of the external power supply and provides the monitoring result to the power switching circuit 220 and the main processing device 110. The second monitoring circuit 240 monitors the remaining power of the internal power supply 210 after the power supply is switched to the internal power supply 210. As an example, the first monitoring circuit 230 can be coupled to a port or line of the controller 1000 connected to the external power supply, and the second monitoring circuit 240 can be coupled to a port or line of the internal power supply output, so as to monitor the external power supply and the internal power supply 210 respectively. In the case of detecting that a power failure occurs, the power switching circuit 220 can switch the power supply in time according to the monitoring result to switch the power supply to the internal power supply 210, and the main processing device 110 can notify the multiple slave processing devices 120-1, 120-2...120-N to transmit the data to be saved to the main processing device 110 according to the monitoring result.

[0035] The power supply device 200 further includes a controllable switch component 250, which is coupled between the power switching circuit 220 and the plurality of slave processing devices 120-1, 120-2, ..., 120-N. If the monitoring signal from the second monitoring circuit 240 indicates that the remaining power of the internal power supply 210 is lower than a predetermined threshold, the controllable switch component 250 cuts off the power supply of the internal power supply 210 to at least one of the plurality of slave processing devices 120-1, 120-2, ..., 120-N. For example, the second monitoring circuit 240 may pre-set a certain threshold, which indicates that the remaining power of the internal power supply 210 can support the data transmission operation from the slave processing device 120-1 to the slave processing device 120-N-1 and the data retention operation of the master processing device, but cannot support all N slave processing devices. Thus, if the remaining power of the internal power supply 210 is lower than the preset threshold, the monitoring signal of the second monitoring circuit 240 can cause the controllable switch component 250 to cut off the power supply to the slave processing device 120-N, which ensures that the data to be saved from the slave processing device 120-1 to the slave processing device 120-N-1 can be transmitted to the main processing device 110, and the main processing device 110 can store the received data and its own data in the non-volatile memory for preservation. In addition, if the preset threshold indicates that fewer slave processing devices are supported for data transmission operations and the main processing device supports data storage operations, the controllable switch component 250 can further cut off the power supply of the internal power supply 210 to more slave processing devices. In addition, the number of thresholds of the preset threshold can be multiple, so that when the remaining power of the internal power supply 210 is lower than the corresponding threshold, the power supply of the internal power supply 210 to the corresponding number of slave processing devices can be cut off, so that the power supply of multiple slave processing devices can be gradually cut off.

[0036] If the master processing device 110 has received data to be saved from at least one slave processing device, the controllable switch component 250 cuts off the power supply of the internal power supply 210 to the at least one slave processing device. For example, if the master processing device 110 has received all the data to be saved from the slave processing device 120-N, it means that the slave processing device 120-N has completed the transmission of its own data to be saved, so the master processing device 110 can send a signal to the controllable switch component 250 to make the controllable switch component 250 cut off the power supply of the internal power supply 210 to the slave processing device 120-N to reduce the power consumption of the internal power supply 210 as much as possible, thereby ensuring that other slave processing devices can complete the transmission of the data to be saved.

[0037] Through the above-mentioned operation of the controllable switch component 250, it can be ensured that all or as many slave processing devices as possible can transmit the data to be saved to the main processing device 110, and there is sufficient power to support the main processing device to complete the preservation of its own data and received data. This effectively improves the power-off data retention function of the controller with multiple processing devices and improves the reliability of the controller.

[0038] Figure 2 FIG. 2 shows a schematic circuit diagram of a controller 1000 according to another embodiment of the present invention. Figure 2As shown, in some embodiments of the present invention, the controllable switch component 250 includes a plurality of controllable switches 251-1, 251-2, ... 251-N corresponding to the plurality of slave processing devices 120-1, 120-2, ... 120-N. The second monitoring circuit 240 includes a plurality of voltage comparison subcircuits 241-1, 241-2, ... 241-N corresponding to the plurality of slave processing devices 120-1, 120-2, ... 120-N. A plurality of voltage thresholds VTH1, VTH2, ... VTHN are set in the second monitoring circuit 240 as predetermined thresholds, and these voltage thresholds VTH1, VTH2, ... VTHN are different from each other and correspond to the plurality of slave processing devices 120-1, 120-2, ... 120-N, respectively. Each of the plurality of voltage comparison subcircuits 241-1, 241-2, ... 241-N compares the output voltage of the internal power supply 210 with a corresponding voltage threshold, and outputs a signal for cutting off the power supply of the internal power supply 210 to the corresponding controllable switch when the output voltage of the internal power supply 210 is lower than the corresponding voltage threshold. For example, the voltage comparison subcircuit 241-1 and the controllable switch 251-1 may correspond to the slave processing device 120-1, the voltage comparison subcircuit 241-2 and the controllable switch 251-2 may correspond to the slave processing device 120-2, and the voltage comparison subcircuit 241-N and the controllable switch 251-N may correspond to the slave processing device 120-N. For example, when the output voltage of the internal power supply 210 is lower than VTH1, the voltage comparison subcircuit 241-1 sends a signal to cause the controllable switch 251-1 to cut off the power supply of the internal power supply 210 to the slave processing device 120-1. Other voltage comparison subcircuits and controllable switches may operate in the same manner, and thus will not be described in detail. In one embodiment, the plurality of voltage thresholds VTH1, VTH2, ... VTHN may be a series of voltage values ​​that gradually increase or decrease. Alternatively, the corresponding voltage thresholds may be set according to the importance of the slave processing device to ensure that the slave processing device with a higher importance is powered off later, or the corresponding voltage thresholds may be set according to the amount of data to be saved in the slave processing device to ensure that the slave processing device with a larger amount of data to be saved is powered off later.

[0039] In one embodiment, each voltage comparison subcircuit may include a comparator for performing voltage comparison and a voltage divider circuit for detecting the output voltage of the internal power supply 210. However, other voltage detection means may also be used to detect the output voltage of the internal power supply 210. In addition, one or more communicable voltage detection circuits may be used between all or part of the voltage comparison subcircuits without providing a separate voltage detection circuit for each voltage comparison subcircuit.

[0040] In some embodiments of the present invention, the controllable switch component 250 further includes a plurality of logic gates 252-1, 252-2, ... 252-N corresponding to the plurality of slave processing devices 120-1, 120-2, ... 120-N, each logic gate having a first input terminal, a second input terminal and an output terminal, wherein the first input terminal is coupled to the corresponding voltage comparison subcircuit, the second input terminal is coupled to the master processing device 110, and the output terminal is coupled to the corresponding controllable switch. For example, one input terminal of the logic gate 252-1 is coupled to the voltage comparison subcircuit 241-1 to receive a comparison result between the output voltage of the internal power supply 210 and the voltage threshold VTH1, and the other input terminal of the logic gate 252-1 is coupled to the master processing device 110 to receive an indication of whether the data transmission of the slave processing device 120-1 is completed. Thus, when the output voltage of the internal power supply 210 is lower than VTH1 or when the main processing device 110 determines that the slave processing device 120-1 has transmitted all the data to be saved to the main processing device 110, the logic gate 252-1 can disconnect the controllable switch 251-1 based on the valid signal output by the second monitoring circuit 240 and / or the main processing device 110. The other logic gates 252-2 to 252-N are connected and operated in a similar manner, so they are not repeated. In one example, the logic gates in the plurality of logic gates 252-1, 252-2...252-N can be NOR gates, whereby when at least one of the voltage comparison sub-circuit and the main processing device 110 sends a high-level signal indicating that the output voltage of the internal power supply is lower than the threshold voltage or a high-level signal indicating that the slave processing device has completed the transmission of the data to be saved, the NOR gate will generate a low-level signal to turn off the controllable switch. It can be understood that, depending on the level type of the effective signal of the voltage comparison subcircuit and the main processing device and the level type of the controllable switch turned off, the logic gate can also be other types of logic devices. For example, when the level of the controllable switch turned off is a high level signal, the logic gate can also be an OR gate.

[0041] It can be seen that the operation process of the controllable switch component can be controlled by hardware (i.e., the voltage comparison subcircuit) and software (i.e., the program in the main processing device 110) to determine whether to power the slave processing device and whether the slave processing device stops data transmission. The hardware method takes precedence over the software method, that is, after the controller loses power, the slave processing device transmits data, and the power supply of the slave processing device is controlled according to different voltage thresholds; when the slave processing device loses power to maintain the completion of data transmission, the main processing device actively turns off the power supply of the slave processing device through software.

[0042] In some embodiments of the present invention, the internal power supply 210 includes a charging circuit 211 and a super capacitor 212. The charging circuit 211 can couple the super capacitor 212 to an external power supply, so that the super capacitor 212 can be charged by the external power supply via the charging circuit 211. In this way, while the external power supply supplies power to the main processing device 110 and the multiple slave processing devices 120-1, 120-2...120-N, the internal power supply 210 can be charged by the external power supply, thereby ensuring that the internal power supply 210 stores enough power to support the power-off data retention operation. In one embodiment, a diode D1 can also be provided on the connection line between the power supply device 200 and the external power supply. In this way, the power of the internal power supply 210 and other components of the controller 1000 can be prevented from being reversely output to the external power supply.

[0043] In some embodiments of the present invention, the power switching circuit 220 includes a path switching unit 221 and a power converter 222. The path switching unit 221 can switch the path of the external power supply and the path of the internal power supply 210, so as to use the path of the external power supply when the power is normally supplied, and use the path of the internal power supply 210 when the external power supply is powered off and a data retention operation is required. The power converter 222 is coupled between the path switching unit 221 and the master processing device 110 and the plurality of slave processing devices 120-1, 120-2 ... 120-N to perform power conversion operations (e.g., DC-DC conversion), thereby outputting appropriate voltages and currents to the master and slave processing devices.

[0044] Figure 3 FIG. 2 shows a schematic circuit diagram of a first monitoring circuit 230 of a power supply device 200 according to an embodiment of the present invention. Figure 3As shown, the first monitoring circuit 230 may include a voltage stabilizing diode D2, an optocoupler element U1, and an output resistor R1. The optocoupler element U1 includes a light emitting device (e.g., a light emitting diode) located on the primary side and a photosensitive device (e.g., a phototransistor) located on the secondary side. The light emitting device of the optocoupler element U1 is coupled between the voltage stabilizing diode D2 and the first reference potential REF1, and the photosensitive device of the optocoupler element U1 is coupled between the second reference potential VREF2 and the third reference potential VREF3. As an example, the first reference potential VREF1 may be a ground potential, the second reference potential VREF2 may be a power supply potential, and the third reference potential VREF3 may be another ground potential isolated from the first reference potential VREF1. The output resistor R1 is coupled between the photosensitive device and the second reference potential VREF2, wherein the node GPIO1_INT between the output resistor R1 and the photosensitive device is coupled to the power switching circuit 220 and the main processing device 110, so as to output the level signal at the node GPIO1_INT as a monitoring result to the power switching circuit 220 and the main processing device 110. Alternatively, the output resistor R1 may also be coupled between the photosensitive device and the third reference potential VREF3, and the node between the output resistor R1 and the photosensitive device is coupled to the power switching circuit 220 and the main processing device 110 to output the level signal of the node as the monitoring result. In one embodiment, the first monitoring circuit 230 may also include an input resistor R2 for current limiting.

[0045] When the external power supply is not powered off, the voltage of the external power supply will be at least greater than the breakdown voltage of the Zener diode D2, so that the Zener diode D2 is broken down, and the current will flow through the light-emitting device on the primary side of the optocoupler element U1. The increase in the current flowing through the light-emitting device will cause the light-emitting device to emit light, and trigger the photosensitive device on the secondary side of the optocoupler element U1 to turn on, thereby outputting the third reference potential VREF3 as the ground potential or a lower potential at the node GPIO1_INT. When the external power supply is powered off, the voltage of the external power supply will drop to a level lower than the breakdown voltage of the Zener diode D2, so that the Zener diode D2 is not broken down and no current flows through the light-emitting device on the primary side of the optocoupler element U1, and the photosensitive device on the secondary side of the optocoupler element U1 is not turned on, thereby outputting the second reference potential VREF2 as the power supply potential or a higher potential at the node GPIO1_INT. In the power-off monitoring process, the Zener diode D2 plays the role of stabilizing the voltage and clamping the voltage, while the optocoupler element U1 mainly plays the role of a switch. When the controller 1000 is powered on normally, the external power supply turns on the optocoupler element U1 through the input resistor R2 and the voltage regulator diode D2, so the node GPIO1_INT is a low-level third reference potential; when the controller 1000 is powered off, the optocoupler element U1 is not turned on, and the node GPIO1_INT becomes a high-level second reference potential. In addition, when the output resistor R1 is coupled between the photosensitive device and the third reference potential VREF3 and the node between the output resistor R1 and the photosensitive device is still used as the output, when the controller 1000 is powered on normally, the output node will output a high level, and when the controller 1000 is powered off, the output node will output a low level. This potential change can be quickly and easily recognized by the power switching circuit 220 and the main processing device 110, so that it can be determined that a power failure has occurred and the corresponding power failure operation can be performed. It can be seen that the breakdown voltage of the voltage regulator diode D2 is associated with the monitoring threshold for monitoring the power failure of the controller, so by selecting a suitable type of voltage regulator diode D2, the monitoring threshold for power failure can be selected and determined.

[0046] Traditional power failure detection means usually need to convert the power of the supercapacitor into voltage through a coulomb meter and collect it through an analog-to-digital conversion chip to achieve power failure detection. The power failure monitoring circuit in the embodiment of the present invention can be implemented using simple devices, and has the advantages of low cost and high reliability.

[0047] Figure 4 FIG. 2 shows a schematic circuit diagram of a path switching unit 221 of a power switching circuit 220 according to an embodiment of the present invention. Figure 4As shown, the path switching section 221 of the power switching circuit 220 includes a first conductive path 2211 and a second conductive path 2212. The first conductive path 2211 couples the external power supply between the master processing device 110 and the slave processing devices 120-1, 120-2, ... 120-N. The first conductive path can be formed by an electrical conductor or other conductive elements. In one embodiment, the first conductive path may include a diode D3 for preventing reverse voltage.

[0048] The second conductive path 2212 includes a first switch Q1 and a second switch Q2. The first switch Q1 is coupled between the internal power supply 210 and the master processing device 110 and the plurality of slave processing devices 120-1, 120-2...120-N. The second switch Q2 is coupled between the control terminal of the first switch Q1 and the fourth reference potential VREF4, and is turned on in response to a monitoring result indicating that the external power supply is powered off to trigger the first switch Q1 to be turned on. As an example, the first switch Q1 and the second switch Q2 may be semiconductor switching devices such as metal-oxide-semiconductor field effect transistors (MOSFETs). For example, the first switch Q1 is a P-type MOSFET, the second switch Q2 is an N-type MOSFET, and the fourth reference potential VREF4 may be a ground potential or other lower potential.

[0049] When the external power supply is not powered off, the node GPIO1_INT of the first monitoring circuit 230 is at a low level, so the gate of the second switch Q2 connected to the node GPIO1_INT is also at a low level, causing the second switch Q2 of the N-type MOSFET to be turned off. Further, since the second switch Q2 is in the off state, the gate of the first switch Q1 of the P-type MOSFET is at a high level, so that the first switch Q1 is turned off. As a result, the second conductive path 2212 from the internal power supply 210 to the master-slave processing device is cut off, and the external power supply supplies power to the master-slave processing device through the first conductive path 2211.

[0050] In the case of power failure of the external power supply, the node GPIO1_INT of the first monitoring circuit 230 becomes a high level, so the gate of the second switch Q2 connected to the node GPIO1_INT is also a high level, resulting in the second switch Q2 of the N-type MOSFET being turned on. Further, since the second switch Q2 is in the on state, the gate of the first switch Q1 of the P-type MOSFET is connected to the fourth reference potential of the low level, so that the first switch Q1 is turned on. As a result, the second conductive path 2212 from the internal power supply 210 to the master-slave processing device is turned on, and the internal power supply 210 supplies power to the master-slave processing device to support the master-slave processing device to perform power-off data retention operations.

[0051] In this way, the power switching circuit 220 can switch the two power supplies in a fast, simple and low-cost manner to support normal power supply and power-off data retention. In one embodiment, the second conductive path 2212 can also include a diode D4 to prevent reverse voltage. In addition, the second conductive path 2212 can also include other elements or components. For example, the second conductive path 2212 can also include a capacitor C1 connected between the source and gate of the first switch Q1, a resistor R3 and a voltage-stabilizing diode D5, a capacitor R4 connected between the gate of the first switch Q1 and the drain of the second switch Q2, and capacitors C2 and C3 connected at the output. It is understood that the first conductive path 2211 and the second conductive path 2212 can also add other elements and components as needed, or omit or replace some elements and components.

[0052] Figure 5 FIG. 5 is a schematic flow chart of a control method 500 for a controller according to an embodiment of the present invention. The method 500 may be Figure 1 and Figure 2 , and is executed by the main processing device 110. For the purpose of discussion, reference will be made to Figure 1 , Figure 2 , Figure 3 and Figure 4 Method 500 is described.

[0053] At block 501, the main processing device 110 receives a monitoring result indicating a power failure of an external power supply from the first monitoring circuit 230. For example, the main processing device 110 may obtain Figure 3 The level state of the node GPIO_INT of the first monitoring circuit 230 is used as the monitoring result of power failure, and whether the external power supply is powered off is determined according to the change of the level state.

[0054] At block 502 , in response to receiving a monitoring result indicating that the external power supply is powered off, the main processing device 110 receives a monitoring signal indicating the remaining power of the internal power supply 210 from the second monitoring circuit 240 .

[0055] At block 503, the master processing device 110 determines whether there are slave processing devices that are powered by the internal power supply 210 based on the received monitoring signal. For example, the master processing device 110 may obtain monitoring signals indicating comparison results from output terminals of the respective voltage comparison subcircuits 241-1 to 241-N of the second monitoring circuit 240, thereby determining which slave processing devices will be powered off.

[0056] At block 504 , in response to the absence of a slave processing device that maintains power, the master processing device 110 stores its own data to be saved in a non-volatile memory.

[0057] At block 505 , in response to the existence of the slave processing device that maintains power, the master processing device 110 receives data to be saved from the slave processing device that maintains power.

[0058] At block 506 , the host processing device 110 stores its own data to be saved and the received data to be saved in the non-volatile memory.

[0059] Thus, when the remaining power of the internal power supply 210 is insufficient, the main processing device 110 can only save its own data to ensure that its own data can be restored when the power is restored, and when the remaining power of the internal power supply 210 is sufficient, the main processing device 110 can notify the slave processing device and receive data from the slave processing device to ensure that the data and operation of the slave processing device can be restored when the power is restored.

[0060] In some embodiments of the present invention, the method 500 further includes: if the data to be saved of one of the at least one slave processing device has been received, the master processing device 110 sends a signal to the controllable switch component 250 to cut off the power supply of the internal power supply 210 to the slave processing device. For example, if the master processing device 110 determines that all the data to be saved of the slave processing device 120-1 has been received, the master processing device 110 may send an indication signal to the controllable switch component 250 to turn off the controllable switch 251-1 to cut off the power supply of the internal power supply 210 to the slave processing device 120-1. In this way, the consumption of the internal power supply can be saved to the greatest extent in the power-off data retention operation, thereby ensuring that more data of the slave processing devices are transmitted and saved as much as possible.

[0061] Figure 6 A schematic diagram of data addresses of the memory of the main processing device 110 according to an embodiment of the present invention is shown. In some embodiments of the present invention, the main processing device 110 stores the data to be saved in a non-volatile memory (e.g., built-in Flash) in sequence based on the priority corresponding to the data address. Specifically, the data in the memory can be pre-stored according to importance, for example, Figure 6As shown, the pre-stored data in address 0 of the memory has a high priority, the pre-stored data in address 1 of the memory has a medium priority, and the pre-stored data in address 2 of the memory has a low priority. In one example, each address may correspond to a memory of different storage space sizes. Thus, in the event of a power failure and the main processing device 110 needs to transfer the memory data to a non-volatile memory, the main processing device 110 may first transfer the data at address 0, then transfer the data at address 1, and finally transfer the data at address 2 according to the priority. In this way, it is possible to ensure that the most important data is stored first, thereby minimizing the loss of important data. In one example, the data to be saved received by the main processing device 110 from the slave processing device may be temporarily stored in the memory of the main processing device according to the priority in a similar manner, and then transferred to a non-volatile memory (e.g., a built-in Flash of the main processing device 110). Alternatively, the data to be saved from the slave processing device may also be directly transferred to the non-volatile memory.

[0062] Understandably, Figure 6 The number of data addresses and the number of priorities shown in are merely illustrative, and priorities may be set for any number of data addresses as required, and the number of priority levels may be more or less.

[0063] In some embodiments of the present invention, the main processing device 110 stores the to-be-saved data in the non-volatile memory in sequence based on the real-time used storage space size at the data address. Specifically, the main processing device 110 can record the actual used space size when storing at the data address, so that in the process of transferring data when power is off, the data can be transferred according to the actual recorded storage space size without transferring the entire storage space, thereby improving the efficiency of the transfer.

[0064] Through the teachings given in the above description and the related drawings, many modifications and other embodiments of the present invention given here will be recognized by those skilled in the art of the present invention. Therefore, it is to be understood that the embodiments of the present invention are not limited to the disclosed specific embodiments, and modifications and other embodiments are intended to be included within the scope of the present invention. In addition, although the above description and the related drawings describe the example embodiments in the context of some example combinations of parts and / or functions, it should be appreciated that different combinations of parts and / or functions can be provided by alternative embodiments without departing from the scope of the present invention. In this regard, for example, other combinations of parts and / or functions that are different from those clearly described above are also expected to be within the scope of the present invention. Although specific terms are used here, they are only used in a general and descriptive sense and are not intended to be limited.

Claims

1. A power supply device, characterized in that: include: Internal power supply; a power switching circuit configured to use an external power supply as a power supply to power a master processing device and a plurality of slave processing devices of the controller, and to switch the power supply to the internal power supply when the external power supply is powered off, so that the plurality of slave processing devices can use the power of the internal power supply to transmit data to the master processing device and the master processing device can use the power of the internal power supply to save data; a first monitoring circuit configured to monitor power failure of the external power supply and provide monitoring results to the power switching circuit and the main processing device; a second monitoring circuit configured to monitor the remaining power of the internal power supply after the power supply is switched to the internal power supply; and A controllable switch component is coupled between the power switching circuit and the plurality of slave processing devices, and is configured to cut off the power supply of the internal power supply to at least one slave processing device when at least one of the following items is satisfied: a monitoring signal from the second monitoring circuit indicates that the remaining power of the internal power supply is lower than a predetermined threshold; and the master processing device has received data to be saved from the at least one slave processing device.

2. The power supply device according to claim 1, characterized in that: The controllable switch assembly includes a plurality of controllable switches corresponding to the plurality of slave processing devices, the second monitoring circuit includes a plurality of voltage comparison subcircuits corresponding to the plurality of slave processing devices, the predetermined threshold includes a plurality of voltage thresholds different from each other corresponding to the plurality of slave processing devices, Each voltage comparison subcircuit is configured to compare the output voltage of the internal power supply with a corresponding voltage threshold, and output a signal to a corresponding controllable switch for cutting off the power supply of the internal power supply to the corresponding slave processing device when the output voltage is lower than the corresponding voltage threshold.

3. The power supply device according to claim 2, characterized in that: The controllable switch assembly also includes: A plurality of logic gates, corresponding to the plurality of slave processing devices, each logic gate having a first input terminal coupled to a corresponding voltage comparison subcircuit and a second input terminal adapted to be coupled to the master processing device, and an output terminal coupled to a corresponding controllable switch.

4. The power supply device according to claim 1, characterized in that: The first monitoring circuit comprises: a Zener diode adapted to be coupled to the external power source; an optical coupling element, comprising a light emitting device located at a primary side and a photosensitive device located at a secondary side, wherein the light emitting device is coupled between the voltage stabilizing diode and a first reference potential, and the photosensitive device is coupled between a second reference potential and a third reference potential; and An output resistor is coupled between the photosensitive device and the second reference potential or the third reference potential, wherein a node between the output resistor and the photosensitive device is coupled to the power switching circuit and the main processing device.

5. The power supply device according to claim 1, characterized in that: The power switching circuit comprises: a first conductive path adapted to couple the external power source to the master processing device and the plurality of slave processing devices; and The second conductive path includes a first switch and a second switch, wherein the first switch is coupled between the internal power supply and the master processing device and the plurality of slave processing devices, and the second switch is coupled between a control terminal of the first switch and a fourth reference potential, and is configured to be turned on in response to the monitoring result indicating that the external power supply is powered off to trigger the first switch to be turned on.

6. The power supply device according to claim 5, characterized in that: The power switching circuit also includes a power converter coupled between the first conductive path and the second conductive path and the master processing device and the plurality of slave processing devices.

7. The power supply device according to claim 1, characterized in that: The internal power source comprises a supercapacitor adapted to be charged by the external power source.

8. A controller, comprising: a master processing device and a plurality of slave processing devices, and A power supply device according to any one of claims 1 to 7.

9. The controller according to claim 8, characterized in that The main processing device is configured to: In response to a monitoring result received from the first monitoring circuit indicating that the external power supply has lost power, receiving a monitoring signal from the second monitoring circuit indicating a remaining amount of power of the internal power supply; as well as Based on the monitoring signal, the following operations are performed: If the monitoring signal indicates that there is a slave processing device that is powered by the internal power supply, receiving the data to be saved from the slave processing device that is powered, and storing the data to be saved of the master processing device and the received data to be saved in a non-volatile memory; as well as If the monitoring signal indicates that there is no slave processing device powered by the internal power supply, the data to be saved of the master processing device itself is stored in a non-volatile memory.

10. The controller according to claim 9, characterized in that: The main processing device is also configured to: If data to be saved from one of the slave processing devices that maintain power is received, a signal for cutting off power supplied by the internal power supply to the one slave processing device is sent to the controllable switch component.

11. The controller according to claim 9, characterized in that: The main processing device is configured to: The data to be saved are sequentially stored in the non-volatile memory based on the priorities corresponding to the data addresses.

12. The controller according to claim 11, characterized in that: The main processing device is also configured to: The data to be saved are sequentially stored in the non-volatile memory based on the size of the storage space used in real time at the data address.

13. A control method for a controller according to claim 8, characterized in that: include: In response to a monitoring result received from the first monitoring circuit indicating that the external power supply has lost power, receiving a monitoring signal from the second monitoring circuit indicating a remaining amount of power of the internal power supply; as well as Based on the monitoring signal, the following operations are performed: If the monitoring signal indicates that there is a slave processing device that is powered by the internal power supply, receiving the data to be saved from the slave processing device that is powered, and storing the data to be saved of the master processing device and the received data to be saved in a non-volatile memory; as well as If the monitoring signal indicates that there is no slave processing device powered by the internal power supply, the data to be saved of the master processing device itself is stored in a non-volatile memory.

14. The control method according to claim 13, characterized in that: Also includes: If the data to be saved of one of the slave processing devices that maintain power supply has been received, a signal is sent to the controllable switch component for cutting off the power supply of the internal power supply to the one slave processing device.

15. The control method according to claim 13, characterized in that: Storing the to-be-saved data of the main processing device and the received to-be-saved data in a non-volatile memory or storing the to-be-saved data of the main processing device in a non-volatile memory includes: The data to be saved are sequentially stored in the non-volatile memory based on the priorities corresponding to the data addresses.

16. The control method according to claim 15, characterized in that: Storing the to-be-saved data in the non-volatile memory in sequence based on the priorities corresponding to the data addresses includes: The data to be saved are sequentially stored in the non-volatile memory based on the size of the storage space used in real time at the data address.

Citation Information

Patent Citations

  • Power failure data protection device and method for internal memory

    CN102033826A

  • Data storage device with preloaded content

    CN103026330A

  • Processor and electronic equipment

    CN110221677A

  • Power supply switching system and method, electrical equipment and vehicle accident alarm method

    CN112311080A

  • Standby power device, standby power method thereof and medium

    CN114020219A