Disclosure of Invention
In view of this, it is desirable to provide a power supply circuit and a method for a nonvolatile memory, which provide voltages required for reading, writing, and erasing data for the nonvolatile memory in an integrated chip through the existing power pins and internal power sources of the integrated chip, thereby simplifying the design and saving the cost.
The technical scheme provided by the invention for achieving the purpose is as follows:
a nonvolatile memory power supply circuit is integrated in an integrated chip with a nonvolatile memory, the nonvolatile memory power supply circuit comprises a power input end and a power output end, the power input end is electrically connected with a power pin of the integrated chip and used for inputting a first voltage, the power output end is electrically connected with the nonvolatile memory and used for supplying power to the nonvolatile memory, the nonvolatile memory power supply circuit further comprises a voltage detection module, a switch control module and a voltage recovery module, one end of the voltage detection module is electrically connected with the power input end, the other end of the voltage detection module is electrically connected with the switch control module and the voltage recovery module, the switch control module is electrically connected between the power input end and the power output end, and the voltage recovery module is also electrically connected with the power output end, the voltage detection module is used for detecting whether the first voltage is within a preset voltage range or not and outputting a control signal to the switch control module and the voltage recovery module according to a detection result;
when the first voltage is within the preset voltage range, the voltage detection module outputs a control signal of a first level to control the switch control module to be switched on, so that the power input end provides the first voltage to the power output end;
when the first voltage is not within the preset voltage range, the voltage detection module outputs a control signal of a second level to control the voltage recovery module to provide a second voltage to the power output end through the internal power supply of the integrated chip.
Further, the voltage detection module includes a nand gate, a first comparator, a second comparator, and first to fourth resistors, one end of the first resistor is electrically connected to the power input terminal, the other end of the first resistor is electrically connected to one end of the second resistor, a first node is formed between the first resistor and the second resistor, the other end of the second resistor is grounded, one end of the third resistor is electrically connected to the power input terminal, the other end of the third resistor is electrically connected to one end of the fourth resistor, a second node is formed between the third resistor and the fourth resistor, the other end of the fourth resistor is grounded, the inverting input terminal of the first comparator is electrically connected to the first node, the inverting input terminal of the second comparator is electrically connected to the second node, and the non-inverting input terminal of the first comparator and the non-inverting input terminal of the second comparator are both electrically connected to a reference voltage, the output end of the first comparator and the output end of the second comparator are respectively and electrically connected with the first input end and the second input end of the NAND gate, and the output end of the NAND gate is electrically connected with the switch control module and the voltage recovery module.
Further, the switch control module includes a fifth resistor, a first current source, and first to fourth electronic switches, a first end of the first electronic switch is electrically connected to the output end of the nand gate, a second end of the first electronic switch is grounded, a third end of the first electronic switch is electrically connected to the first end of the second electronic switch, the first end of the second electronic switch is also electrically connected to the first end of the third electronic switch, the second end of the second electronic switch is grounded, the third end of the second electronic switch is electrically connected to the first end of the second electronic switch, the third end of the second electronic switch is also electrically connected to one end of the first current source, the other end of the first current source is electrically connected to the internal power supply of the integrated chip, the second end of the third electronic switch is grounded, and the third end of the third electronic switch is electrically connected to the power supply input end through the fifth resistor, the third end of the third electronic switch is also electrically connected with the first end of the fourth electronic switch, the second end of the fourth electronic switch is electrically connected with the power input end, and the third end of the fourth electronic switch is electrically connected with the power output end.
Further, the voltage recovery module includes a not gate, a second current source, a diode, and a fifth to seventh electronic switches, an input terminal of the not gate is electrically connected to an output terminal of the nand gate, an output terminal of the not gate is electrically connected to a first terminal of the fifth electronic switch, a second terminal of the fifth electronic switch is grounded, a third terminal of the fifth electronic switch is electrically connected to a first terminal of the sixth electronic switch, a first terminal of the sixth electronic switch is further electrically connected to a first terminal of the seventh electronic switch, a second terminal of the sixth electronic switch is grounded, a third terminal of the sixth electronic switch is electrically connected to a first terminal of the sixth electronic switch, a third terminal of the sixth electronic switch is further electrically connected to a terminal of the second current source, and another terminal of the second current source is electrically connected to the internal power supply of the integrated chip, the second end of the seventh electronic switch is grounded, the third end of the seventh electronic switch is electrically connected with the power output end, the anode of the diode is electrically connected with the internal power supply of the integrated chip, and the cathode of the diode is electrically connected with the power output end.
Furthermore, the first to third electronic switches and the fifth to seventh electronic switches are N-channel field effect transistors, first, second, and third ends of the first to third and fifth to seventh electronic switches respectively correspond to a gate, a source, and a drain of the N-channel field effect transistor, the fourth electronic switch is a P-channel field effect transistor, and first, second, and third ends of the fourth electronic switch respectively correspond to a gate, a source, and a drain of the P-channel field effect transistor.
Further, the control signal of the first level is a control signal of a low level, and the control signal of the second level is a control signal of a high level.
Further, the preset voltage range is a voltage range required by the nonvolatile memory when data is written or erased.
A method of powering a non-volatile memory, comprising the steps of:
providing a first voltage through a power pin of the integrated chip;
detecting whether the first voltage is within a preset voltage range or not, and outputting a control signal according to a detection result;
when the first voltage is within the preset voltage range, outputting a control signal of a first level to control the first voltage to supply power to the nonvolatile memory;
and when the first voltage is not in the preset voltage range, outputting a control signal of a second level to control an internal power supply of the integrated chip to provide a second voltage so as to supply power to the nonvolatile memory.
Further, the preset voltage range is a voltage range required by the nonvolatile memory when data is written or erased.
Further, the control signal of the first level is a control signal of a low level, and the control signal of the second level is a control signal of a high level.
The power supply circuit and the method of the nonvolatile memory detect whether a first voltage provided by a power pin of an integrated chip to a power input end is within a preset voltage range through a voltage detection module, and are conducted through a switch control module when the detection result shows that the first voltage is within the preset voltage range, so as to provide the first voltage to a power output end, and thus, the function of writing or erasing data in the nonvolatile memory is realized. And when the detection result is that the first voltage is not in the preset voltage range, the voltage recovery module provides a second voltage to the power output end by using an internal power supply of the integrated chip so as to realize the data reading function of the nonvolatile memory. Therefore, the voltage required by reading, writing and erasing data can be provided for the nonvolatile memory in the integrated chip through the existing power supply pin of the integrated chip without an additional power supply circuit, the design is greatly simplified, and the cost is saved.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, a power supply circuit 100 for a non-volatile memory is provided. The nonvolatile memory power supply circuit 100 includes a power input terminal 10, a voltage detection module 20, a switch control module 30, a voltage recovery module 40, and a power output terminal 50. In this embodiment, the nonvolatile memory power supply circuit 100 is integrated in an integrated chip to supply power to a nonvolatile memory (not shown) built in the integrated circuit.
In this embodiment, the power input terminal 10 is electrically connected to a power pin (not shown) of the integrated circuit. One end of the voltage detection module 20 is electrically connected to the power input terminal 10, and the other end of the voltage detection module 20 is electrically connected to the switch control module 30 and the voltage recovery module 40. The switch control module 30 is electrically connected between the power input terminal 10 and the power output terminal 50. The voltage recovery module 40 is also electrically connected to the power output 50. The power supply output 50 is electrically connected to the non-volatile memory.
The power input terminal 10 is used for inputting a first voltage. The voltage detection module 20 is configured to detect whether the first voltage is within a preset voltage range, and output a control signal to the switch control module 30 and the voltage recovery module 40 according to a detection result. In this embodiment, the preset voltage range is a voltage range required for writing or erasing data in the nonvolatile memory.
When the first voltage is within the preset voltage range, the voltage detection module 20 outputs a control signal of a first level to control the switch control module 30 to be turned on, so that the power input terminal 10 provides the first voltage to the power output terminal 50. The function of writing or erasing data in the nonvolatile memory can be realized.
When the first voltage is not within the preset voltage range, the voltage detection module 20 outputs a control signal of a second level to control the voltage recovery module 40 to provide a second voltage to the power output terminal 50 through the internal power supply of the integrated chip, where the second voltage output by the power output terminal 50 is unrelated to the first voltage input by the power input terminal 10. The function of reading data of the nonvolatile memory can be realized.
In this embodiment, the first level control signal is a low level control signal, and the second level control signal is a high level control signal.
Therefore, the existing power supply pin of the integrated chip is utilized, and an additional power supply circuit is not needed, so that the voltage required by reading, writing and erasing data can be provided for the nonvolatile memory in the integrated chip, the design is greatly simplified, and the cost is saved.
Referring to fig. 2, fig. 2 is a circuit diagram of a preferred embodiment of the invention. In this embodiment, the power input terminal 10 is connected to a power pin of the integrated circuit, and inputs the first voltage VPP. The voltage detection module 20 comprises four resistors R1-R4, two comparators COMP1-COMP2 and a NAND gate NAND 1. One end of the resistor R1 is electrically connected to the power input terminal 10, the other end of the resistor R1 is electrically connected to one end of the resistor R2, and a node P1 is formed between the resistor R1 and the resistor R2. The other end of the resistor R2 is grounded. One end of the resistor R3 is electrically connected to the power input terminal 10, the other end of the resistor R3 is electrically connected to one end of the resistor R4, and a node P2 is formed between the resistor R3 and the resistor R4. The other end of the resistor R4 is grounded. An inverting input terminal of the comparator COMP1 is electrically connected to the node P1. An inverting input terminal of the comparator COMP2 is electrically connected to the node P2. The non-inverting input terminal of the comparator COMP1 and the non-inverting input terminal of the comparator COMP2 are both electrically connected to a reference voltage VREF, and in the present embodiment, the reference voltage VREF is generated by an internal power supply VDD of an integrated chip. An output end of the comparator COMP1 and an output end of the comparator COMP2 are electrically connected to a first input end and a second input end of the NAND gate NAND1, respectively. The output end of the NAND gate NAND1 is electrically connected to the switch control module 30 and the voltage recovery module 40.
The switch control module 30 includes a resistor R5, a current source IBIAS1, and four electronic switches Q1-Q4. The first end of the electronic switch Q1 is electrically connected with the output end of the NAND gate 1, the second end of the electronic switch Q1 is grounded, and the third end of the electronic switch Q1 is electrically connected with the first end of the electronic switch Q2. The first terminal of the electronic switch Q2 is further electrically connected to the first terminal of the electronic switch Q3, the second terminal of the electronic switch Q2 is grounded, the third terminal of the electronic switch Q2 is electrically connected to the first terminal of the electronic switch Q2, and the third terminal of the electronic switch Q2 is further electrically connected to one terminal of the current source IBIAS 1. The other terminal of the current source IBIAS1 is electrically connected to the internal power supply VDD of the integrated chip. The second terminal of the electronic switch Q3 is grounded, the third terminal of the electronic switch Q3 is electrically connected to the power input terminal 10 through the resistor R5, and the third terminal of the electronic switch Q3 is also electrically connected to the first terminal of the electronic switch Q4. The second terminal of the electronic switch Q4 is electrically connected to the power input terminal 10, and the third terminal of the electronic switch Q4 is electrically connected to the power output terminal 50.
The voltage recovery module 40 includes an inverter INV1, a current source IBIAS2, a diode D1, a capacitor C1, and three electronic switches Q5-Q7. The input end of the not gate INV1 is electrically connected with the output end of the NAND gate 1, and the output end of the not gate INV1 is electrically connected with the first end of the electronic switch Q5. The second terminal of the electronic switch Q5 is grounded, and the third terminal of the electronic switch Q5 is electrically connected to the first terminal of the electronic switch Q6. The first terminal of the electronic switch Q6 is further electrically connected to the first terminal of the electronic switch Q7, the second terminal of the electronic switch Q6 is grounded, the third terminal of the electronic switch Q6 is electrically connected to the first terminal of the electronic switch Q6, and the third terminal of the electronic switch Q6 is further electrically connected to one terminal of the current source IBIAS 2. The other terminal of the current source IBIAS2 is electrically connected to the internal power supply VDD of the integrated chip. The second terminal of the electronic switch Q7 is grounded, and the third terminal of the electronic switch Q7 is electrically connected to the power output terminal 50. The anode of the diode D1 is electrically connected to the internal power supply VDD of the integrated chip, and the cathode of the diode D1 is electrically connected to the power supply output terminal 50. One end of the capacitor C1 is electrically connected to the power output terminal 50, and the other end of the capacitor C1 is grounded.
When the circuit works, the resistor R1 and the resistor R2 divide the first voltage APP input by the
power output terminal 10, so that the voltage at the inverting input terminal of the comparator COMP1 is V _ R1, wherein,
similarly, the resistor R3 and the resistor R4 divide the first voltage APP inputted from the
power output terminal 10, so that the voltage at the inverting input terminal of the comparator COMP2 is V _ R2, wherein,
when the first voltage VPP inputted from the
power output terminal 10 satisfies the formula:
when the NAND gate NAND1 outputs a low level control signal. At this time, the electronic switch Q1 is turned off, the reference current Iref generated by the current source IBIAS1 generates the bias voltages of the electronic switch Q2 and the electronic switch Q3 through the electronic switch Q2, and specifically, the electronic switch Q2 and the electronic switch Q3 form a current mirror circuit to flow through the electronic switch Q1The current of the Q2 is mirrored to the electronic switch Q3, which generates a bias voltage through R3, thereby controlling the electronic switch Q4 to conduct. In this way, the output voltage of the
output terminal 50 is equal to the first voltage VPP input from the
power input terminal 10, thereby implementing the function of writing or erasing data in the nonvolatile memory.
When the first voltage VPP inputted from the power supply output terminal 10 does not satisfy the formula (1), the NAND gate NAND1 outputs a control signal of high level. At this time, the electronic switch Q1 is turned on, the current generated by the current source IBIAS1 passes through the electronic switch Q2 and is pulled down to the ground by the electronic switch Q1, the electronic switch Q3 cannot mirror the current of the electronic switch Q2, no current flows through the resistor R3, the voltage required by the electronic switch Q4 to turn on cannot be generated, the electronic switch Q4 is turned off, and the output voltage of the power output terminal 50 is unrelated to the first voltage VPP input by the power input terminal 10. At the same time, the electronic switch Q5 is turned off, and the reference current generated by the current source IBIAS2 generates the bias voltages of the electronic switch Q6 and the electronic switch Q7 through the electronic switch Q6, and specifically, the electronic switch Q6 and the electronic switch Q7 constitute a current mirror circuit to mirror the current flowing through the electronic switch Q6 onto the electronic switch Q7, so as to provide a pull-down current to the power output 50, and when the voltage of the power output 50 is pulled to a certain value, the diode D1 is turned on in the forward direction, so as to clamp the output voltage of the power output 50 to a second voltage slightly lower than the voltage value of the internal power VDD of the integrated chip. The capacitor C1 is a filter capacitor and is used for stabilizing the output voltage of the power output terminal. In this way, the function of reading data of the nonvolatile memory can be realized.
In this embodiment, the resistor R5 and the reference current Iref generated by the current source IBIAS1 are used to set the on-voltage VON of the electronic switch Q4, where VON — R5 × Iref.
In this embodiment, the electronic switches Q1-Q3 and Q5-Q7 are N-channel fets, and the first, second, and third terminals of the electronic switches Q1-Q3 and Q5-Q7 correspond to the gate, source, and drain of the N-channel fets, respectively. The electronic switch Q4 is a P-channel field effect transistor, and the first end, the second end and the third end of the electronic switch Q4 correspond to the grid electrode, the source electrode and the drain electrode of the P-channel field effect transistor respectively.
Referring to fig. 3, the present invention further provides a power supply method of the power supply circuit of the nonvolatile memory, including the following steps;
s1, the power input terminal 10 provides a first voltage through a power pin of the ic.
S2, the voltage detecting module 20 detects whether the first voltage is within a predetermined voltage range, and outputs a control signal to the switch control module 30 and the voltage recovery module 40 according to the detection result, if yes, step S3 is performed, otherwise, step S4 is performed.
In this embodiment, the preset voltage range is a voltage range required for writing or erasing data in the nonvolatile memory.
S3, the voltage detecting module 20 outputs a control signal with a first level to control the switch control module 30 to be turned on, and the power input terminal 10 provides the first voltage to the power output terminal 50 to supply power to the non-volatile memory.
In this embodiment, the first level control signal is a low level control signal.
S4, the voltage detecting module 20 outputs a control signal of a second level to control the voltage recovering module 40 to provide a second voltage to the power output terminal 50 via the internal power supply of the integrated chip, so as to supply power to the non-volatile memory.
In this embodiment, the second level control signal is a high level control signal.
The nonvolatile memory power supply circuit and the method thereof detect whether the first voltage input by the power pin of the integrated chip is in the voltage range required by the nonvolatile memory when the data is written or erased through the voltage detection module 20, and the switch control module 30 is switched on when the detection result is that the first voltage is in the voltage range required by the nonvolatile memory when the data is written or erased so that the first voltage directly supplies power to the nonvolatile memory, and the voltage recovery module 40 outputs the second voltage by using the internal low-voltage power supply of the integrated chip when the detection result is that the first voltage is not in the voltage range required by the nonvolatile memory when the data is written or erased so as to supply power to the nonvolatile memory. Therefore, the invention can provide the voltage required by reading, writing and erasing data for the nonvolatile memory in the integrated chip through the existing power supply pin of the integrated chip without additional power supply circuits, thereby greatly simplifying the design and saving the cost.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.