Method and apparatus for measuring the capacitance required for brown-out protection
By detecting the GPIO port signals of the solid-state drive to determine power failure and record the protection operation time, the problem of high cost and complex operation in the existing technology is solved, and the capacitance is easily measured.
Patent Information
- Application Number
- CN202211707576.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-29
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2042-12-29
AI Technical Summary
In existing technologies, using auxiliary tools to measure the capacitor capacity required for power-loss protection of solid-state drives (SSDs) is costly and complex to operate.
Power loss is detected by detecting the digital signals of the GPIO port of the solid-state drive, the time required for the power loss protection operation is recorded, and the capacitor capacity is determined based on the longest time, avoiding the use of auxiliary tools.
It simplifies the operation process, reduces costs, and enables accurate determination of the required capacitor capacity.
Smart Images

Figure CN115798530B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer storage, and in particular to a method and device for measuring the capacity of a capacitor required for power failure protection. BACKGROUND
[0002] With the rapid development of data storage technology, solid state drives (SSDs) are gradually replacing traditional hard disk drives (HDDs). When a solid state drive with double data rate synchronous dynamic random access memory (DDR) is in operation, the DDR will generally cache frequently accessed data, critical data, and small data. Considering the performance of the solid state drive and write amplification, the data cached in the DDR is not flushed in real time, but the data volume is accumulated to a certain threshold before being written into the storage type NAND flash. Therefore, if the solid state drive suddenly loses power, the data that has not been flushed in time will be lost. Based on this, the current solid state drive with DDR generally has a power failure protection function.
[0003] The power failure protection function mainly provides power support for data flushing through a backup power source (generally a capacitor) during power failure. After power failure, the amount of data to be flushed in the DDR cannot be predicted, which may be large or small. Therefore, the larger the capacity of the capacitor, the better the power failure protection function of the solid state drive. However, from the perspective of hardware cost, the smaller the capacity of the capacitor, the better. In order to obtain the required capacity of the capacitor, auxiliary tools are generally used to perform thousands of power failure tests on the solid state drive, and the longest power failure duration is obtained from these tests to determine the required capacity of the capacitor. However, there are certain drawbacks to using auxiliary tools for power failure testing, which not only requires a large investment in the purchase of software and hardware equipment for the auxiliary tools, but also has a complex operation process. SUMMARY
[0004] The present application provides a method and device for measuring the capacity of a capacitor required for power failure protection, to solve the problem of high cost and complex operation of using auxiliary tools to determine the required capacity of the capacitor for power failure protection.
[0005] In a first aspect, the present application provides a method for measuring the capacity of a capacitor required for power failure protection, comprising:
[0006] detecting a digital signal corresponding to a first port in a solid state drive;
[0007] when the digital signal corresponding to the first port is a first preset value, determining that the solid state drive has experienced power failure;
[0008] Perform a power-down protection operation on the solid-state drive and record the time required for the power-down protection operation;
[0009] The capacitance is determined based on the longest time among the K times required for the power-down protection operation, where K is a positive integer.
[0010] Using the above method, when the digital signal corresponding to the first port in the solid-state drive (SSD) is detected to be at a first preset value, it is determined that the SSD has lost power. A power-down protection operation is then executed, and the time required for this operation is recorded. The capacitor capacity is then determined based on the longest time among K power-down protection operations. This method requires no auxiliary tools, is simple to operate, and has low cost.
[0011] Optionally, the capacitance is determined based on the longest time among the K times required for the power-down protection operation, including:
[0012] Construct statistical variables, with the initial statistical value of the statistical variables being 0;
[0013] After each recording of the time required for the power failure protection operation, the statistical value corresponding to the statistical variable is incremented by 1;
[0014] When the statistical value corresponding to the statistical variable is K, the capacity of the capacitor is determined based on the longest time among the K times required for the power failure protection operation.
[0015] Optionally, the power failure protection operation includes:
[0016] Stop receiving input / output commands and parsing allocation tasks;
[0017] Stop receiving read and write commands, and stop sending the already received write commands;
[0018] The data in the solid-state drive is written to the memory.
[0019] Optionally, after recording the time required for the power-down protection operation, a reset operation is performed on the solid-state drive to restore it to a powered-on state, and the digital signal corresponding to the first port is set to a second preset value.
[0020] Optionally, a jitter check is performed before the power-down protection operation is performed on the solid-state drive; the jitter check includes:
[0021] After a preset time, it is checked whether the digital signal corresponding to the first port is still the first preset value.
[0022] By using the above method to perform anti-jitter checks on the solid-state drive (SSD), the problem of unstable voltage in the SSD can be avoided from being mistaken for a power outage.
[0023] Optionally, the time required for the power failure protection operation is the time required to complete the power failure protection operation.
[0024] Secondly, embodiments of the present invention provide a measuring device for the capacitance required for power-off protection, comprising:
[0025] The detection unit is used to detect the digital signal corresponding to the first port in the solid-state drive;
[0026] The processing unit is configured to determine that the solid-state drive has lost power when the digital signal corresponding to the first port is a first preset value;
[0027] A recording unit is used to perform a power-loss protection operation on the solid-state drive and record the time required for the power-loss protection operation.
[0028] The processing unit is further configured to determine the capacitance based on the longest time among the K times required for the power failure protection operation, wherein the capacitor provides power support for performing the power failure protection operation, and K is a positive integer.
[0029] Optionally, the processing unit is specifically configured to construct a statistical variable when determining the capacitance based on the longest time among the K times required for the power failure protection operation, wherein the initial statistical value of the statistical variable is 0; after each recording of the time required for the power failure protection operation, the statistical value of the statistical variable is incremented by 1; and when the statistical value of the statistical variable is K, the capacitance is determined based on the longest time among the K times required for the power failure protection operation.
[0030] Optionally, the power failure protection operation includes:
[0031] The processing unit is used to stop receiving input / output commands and parsing allocation work; stop receiving read commands and write commands, stop sending the received write commands; and write the data in the solid-state drive to the memory.
[0032] Optionally, the processing unit is further configured to perform a reset operation on the solid-state drive after the recording unit records the time required for the power-off protection operation, so as to restore the solid-state drive to the power-on working state and set the digital signal corresponding to the first port to a second preset value.
[0033] Optionally, the processing unit is configured to perform a jitter check before performing a power-down protection operation on the solid-state drive;
[0034] The anti-jitter check includes: after a preset time, detecting whether the digital signal corresponding to the first port is still the first preset value.
[0035] Optionally, the time required for the power failure protection operation is the time required to complete the power failure protection operation.
[0036] Thirdly, this application also provides an apparatus. This apparatus can perform the above-described method design. The apparatus may be a chip or circuit capable of performing the functions corresponding to the above-described method, or a device including the chip or circuit.
[0037] In one possible implementation, the device includes: a memory for storing computer-executable program code; and a processor coupled to the memory. The program code stored in the memory includes instructions that, when executed by the processor, cause the device or a device equipped with the device to perform any of the methods described above.
[0038] The device may also include a communication interface, which may be a transceiver, or, if the device is a chip or circuit, the communication interface may be the chip's input / output interface, such as input / output pins.
[0039] In one possible design, the device includes corresponding functional units, each used to implement the steps in the above method. The functions can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more units corresponding to the functions described above.
[0040] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when run on a device, executes the method described in any of the above possible designs.
[0041] Furthermore, the technical effects of any of the implementation methods in the third to fourth aspects can be found in the technical effects of different implementation methods in the first aspect, and will not be repeated here. Attached Figure Description
[0042] Figure 1 A schematic flowchart illustrating a method for measuring the capacitance required for power-off protection according to an embodiment of the present invention;
[0043] Figure 2 A communication device 200 is provided for an embodiment of the present invention;
[0044] Figure 3 This invention also provides another communication device 300. Detailed Implementation
[0045] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0046] The application scenarios described in the embodiments of this invention are for the purpose of more clearly illustrating the technical solutions of the embodiments of this invention, and do not constitute a limitation on the technical solutions provided by the embodiments of this invention. Those skilled in the art will understand that with the emergence of new application scenarios, the technical solutions provided by the embodiments of this invention are also applicable to similar technical problems. In the description of this invention, unless otherwise stated, "multiple" means two or more.
[0047] For solid-state drives (SSDs) with DDR memory, capacitors are required as backup power for power-loss protection, making the determination of capacitor capacity crucial. Currently, the required capacitor capacity is determined by performing thousands of power-loss tests on the SSD using auxiliary tools. However, using auxiliary tools for power-loss testing is not only costly but also complex to perform.
[0048] Based on this, this application proposes a method for measuring the capacitance required for power failure protection, in order to solve the problems of high cost and complex operation in the current method of using auxiliary tools to confirm the capacitance required for power failure protection.
[0049] like Figure 1 As shown, the specific flow of the method for measuring the capacitance required for power-off protection proposed in this application is as follows:
[0050] Step 100: The processor detects the digital signal corresponding to the first port in the solid-state drive.
[0051] Specifically, the first port in a solid-state drive (SSD) is the General Purpose Input Output (GPIO) port, which can be used to sense whether the SSD has lost power.
[0052] Specifically, the processor detects the digital signals corresponding to the GPIO ports to determine whether the solid-state drive (SSD) has lost power. The processor can perform this detection using computer code, or it can use other methods; this application does not limit the scope of the detection.
[0053] Step 110: When the digital signal corresponding to the first port is the first preset value, the processor determines that the solid-state drive has lost power.
[0054] For example, the digital signal corresponding to the GPIO port includes digital signal 0 and digital signal 1, with the first preset value being digital signal 0. Specifically, when the digital signal corresponding to the GPIO port is digital signal 0, the processor can determine that the solid-state drive has lost power.
[0055] For example, the processor can control the digital signal corresponding to the GPIO port to be a digital signal 0 to simulate a power failure of the solid-state drive.
[0056] Step 120: The processor performs a power-loss protection operation on the solid-state drive and records the time required for the power-loss protection operation.
[0057] For example, after determining in step 110 that the solid-state drive has lost power, a power-loss protection operation is performed on the solid-state drive, and the time required for the power-loss protection operation is recorded. The time required for the power-loss protection operation is the time required to complete the power-loss protection operation.
[0058] For example, before the processor performs a power-down protection operation, a debouncing check needs to be performed on the solid-state drive (SSD). Specifically, after a preset time, the processor checks whether the digital signal corresponding to the GPIO port is still a 0. If the digital signal corresponding to the GPIO port is still a 0, it means that the GPIO port has passed the debouncing check, the SSD has indeed lost power, and a power-down protection operation needs to be performed. If the digital signal corresponding to the GPIO port is not a 0, it means that the GPIO port has failed the debouncing check, the SSD has not lost power, and the voltage instability of the SSD has caused the digital signal corresponding to the GPIO port to be a 0. The preset time is determined based on empirical values.
[0059] For example, a global variable A exists in the processor. The initial value of global variable A is a first value. After the solid-state drive passes the anti-jitter check, the value of global variable A changes to a second value. Specifically, the first value can be FALSE (error), and the second value can be TRUE (correct). The first and second values can be any other two different values, and this application does not impose any limitations on this. Furthermore, global variable A can have any other name, and this application does not impose any limitations on this.
[0060] For example, when the value of global variable A is TRUE, the processor performs a power-down protection operation on the solid-state drive, and a timer starts counting down to record the time required for the power-down protection operation. Specifically, the power-down protection operation includes:
[0061] The front end in the solid-state drive (SSD) ceases receiving input / output commands and parsing / allocation tasks. Specifically, the front end stops receiving input / output commands and parsing / allocation tasks from the host. The device using the SSD is the host corresponding to the SSD; the host can be a computer, a camera, or any other device, and this application does not limit its scope.
[0062] The intermediate layer in the solid-state drive (SSD) stops accepting read and write commands, stops sending received write commands, and stops operations detrimental to performance such as garbage collection and wear leveling. For write commands that have already been sent, it needs to wait for the data to be written to disk before issuing a command to clear the data in the DDR memory. Specifically, clearing the data in the DDR memory means writing frequently accessed data, critical data, and small data from the SSD's DDR memory to the storage memory. The storage memory can be NAND flash memory or any other type of storage memory; this application does not limit it.
[0063] Check whether the backend monitoring in the solid-state drive sends the command to clear data in DDR and the command to clear data in DDR that has been completed are consistent.
[0064] For example, the processor determines whether the power-down protection operation is complete by detecting whether the solid-state drive (SSD) is in an idle state. Specifically, after all data commands in the DDR memory have been cleared, that is, all data in the SSD has been written to disk, the SSD is in an idle state, and the power-down protection operation is complete; if not all data commands in the DDR memory have been cleared, that is, not all data in the SSD has been written to disk, the SSD is in a non-idle state, and the power-down protection operation is not complete.
[0065] For example, after the processor determines that the power-down protection operation has been completed, the timer stops counting to obtain the time required for the power-down protection operation.
[0066] Step 130: The processor determines the capacitor capacity based on the longest time among the K power-down protection operations.
[0067] Specifically, the capacitor provides power support for performing power-down protection operations, where K is a positive integer.
[0068] For example, in step 120, after the processor determines that the power-down protection operation is complete and records the time required for the power-down protection operation, the value of the global variable A changes to the first value FALSE. The processor then performs a reset operation on the solid-state drive (SSD) to restore the SSD to its power-on operating state and sets the digital signal corresponding to the first port to the second preset value. The second preset value is the digital signal 1.
[0069] For example, a statistical variable is constructed in the processor, with an initial statistical value of 0. After each recording of the time required for a power failure protection operation, the statistical value of the statistical variable is incremented by 1. Specifically, in step 120, the processor determines that the power failure protection operation has been completed, and then increments the statistical value of the statistical variable by 1.
[0070] If the statistical value corresponding to the statistical variable is less than K, then proceed to step 100 and perform multiple tests by simulating a power outage of the solid-state drive using the processor.
[0071] When the statistical value corresponding to the statistical variable is K, the capacity of the corresponding capacitor is determined based on the longest time among the K power outage protection operations. Specifically, if the longest time occurs very infrequently in the K power outage protection operations, considering economic factors, the capacity of the corresponding capacitor can be determined based on the second longest time among the K power outage protection operations.
[0072] This application eliminates the need for auxiliary tools by using a processor to simulate power outages of the solid-state drive multiple times. The longest power outage time is obtained from these multiple power outage tests, thus providing the corresponding capacitor capacity of the solid-state drive. This method is not only convenient and quick to operate, but also greatly saves economic costs.
[0073] The division of units in the embodiments of this invention is illustrative and represents only one logical functional division. In actual implementation, other division methods may be used. Furthermore, the functional units in the various embodiments of this invention can be integrated into a single processor, exist as separate physical units, or be integrated into a single unit. The integrated units described above can be implemented in hardware or as software functional units.
[0074] This invention also provides a communication device 200, which may be a terminal device or a chip system within a terminal device. See [link to documentation]. Figure 2 As shown, it includes: a detection module 210, a processing module 220, and a recording module 230.
[0075] Detection module 210 is used to detect the digital signal corresponding to the first port in the solid-state drive;
[0076] Processing module 220 is used to determine that the solid-state drive has lost power when the digital signal corresponding to the first port is a first preset value;
[0077] Recording module 230 is used to perform a power-down protection operation on the solid-state drive and record the time required for the power-down protection operation;
[0078] The processing module 220 is further configured to determine the capacitance based on the longest time among the K times required for the power failure protection operation, wherein the capacitor provides power support for performing the power failure protection operation, and K is a positive integer.
[0079] This invention also provides another communication device 300, which may be a terminal device or a chip system inside a terminal device. See [link to previous document]. Figure 3 As shown, it includes:
[0080] Communication interface 301, memory 302 and processor 303;
[0081] The communication device 300 communicates with other devices through the communication interface 301, such as sending and receiving messages; the memory 302 is used to store program instructions; and the processor 303 is used to call the program instructions stored in the memory 302 and execute them according to the obtained program.
[0082] Processor 303 executes program instructions stored in communication interface 301 and memory 302:
[0083] Detect the digital signal corresponding to the first port in the solid-state drive;
[0084] When the digital signal corresponding to the first port is a first preset value, it is determined that the solid-state drive has lost power;
[0085] Perform a power-down protection operation on the solid-state drive and record the time required for the power-down protection operation;
[0086] The capacitance is determined based on the longest time among the K times required for the power-down protection operation, where K is a positive integer.
[0087] In this embodiment of the invention, the specific connection medium between the communication interface 301, the memory 302 and the processor 303 is not limited, such as a bus. A bus can be divided into an address bus, a data bus, a control bus, etc.
[0088] In this embodiment of the invention, the processor may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in this embodiment of the invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in this embodiment of the invention can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0089] In embodiments of the present invention, the memory can be non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), or it can be volatile memory, such as random-access memory (RAM). The memory can also be any other medium capable of carrying or storing desired program code having an instruction or data structure form and accessible by a computer, but is not limited thereto. The memory in embodiments of the present invention can also be a circuit or any other device capable of implementing a storage function for storing program instructions and / or data.
[0090] This invention also provides a computer-readable storage medium including program code. When the program code is run on a computer, the program code is used to cause the computer to perform the steps of the method provided in the above embodiments of this invention.
[0091] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0092] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0093] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0094] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0095] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
[0096] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A method for measuring the capacitance required for power-off protection, characterized in that, The method includes: Detect the digital signal corresponding to the first port in the solid-state drive; When the digital signal corresponding to the first port is a first preset value, it is determined that the solid-state drive has lost power; Perform a power-down protection operation on the solid-state drive and record the time required for the power-down protection operation; The capacitance is determined based on the longest time among the K times required for the power-down protection operation, where K is a positive integer.
2. The method as described in claim 1, characterized in that, The capacitance is determined based on the longest time among the K times required for the power-down protection operation, including: Construct statistical variables, with the initial statistical value of the statistical variables being 0; After each recording of the time required for the power failure protection operation, the statistical value corresponding to the statistical variable is incremented by 1; When the statistical value corresponding to the statistical variable is K, the capacity of the capacitor is determined based on the longest time among the K times required for the power failure protection operation.
3. The method as described in claim 1, characterized in that, The power failure protection operation includes: Stop receiving input / output commands and parsing allocation tasks; Stop receiving read and write commands, and stop sending the already received write commands; The data in the solid-state drive is written to the memory.
4. The method as described in claim 1, characterized in that, After recording the time required for the power-down protection operation, a reset operation is performed on the solid-state drive to restore it to a powered-on state, and the digital signal corresponding to the first port is set to a second preset value.
5. The method as described in claim 1, characterized in that, Before performing power-loss protection operation on the solid-state drive, a jitter check is performed; the jitter check includes: After a preset time, it is checked whether the digital signal corresponding to the first port is still the first preset value.
6. The method as described in claim 1, characterized in that, The time required for the power failure protection operation is the time required to complete the power failure protection operation.
7. A device for measuring the capacitance required for power-off protection, characterized in that, The device includes: The detection unit is used to detect the digital signal corresponding to the first port in the solid-state drive; The processing unit is configured to determine that the solid-state drive has lost power when the digital signal corresponding to the first port is a first preset value; A recording unit is used to perform a power-loss protection operation on the solid-state drive and record the time required for the power-loss protection operation. The processing unit is further configured to determine the capacitance based on the longest time among the K times required for the power failure protection operation, wherein the capacitor provides power support for performing the power failure protection operation, and K is a positive integer.
8. The apparatus as claimed in claim 7, characterized in that, The processing unit is specifically configured to construct a statistical variable when determining the capacity of the capacitor based on the longest time among the K times required for the power failure protection operation, with the initial statistical value of the statistical variable being 0; after each recording of the time required for the power failure protection operation, the statistical value of the statistical variable is incremented by 1; and when the statistical value of the statistical variable is K, the capacity of the capacitor is determined based on the longest time among the K times required for the power failure protection operation.
9. The apparatus as claimed in claim 7, characterized in that, The power failure protection operation includes: The processing unit is used to stop receiving input / output commands and parsing allocation work; stop receiving read commands and write commands, stop sending the received write commands; and write the data in the solid-state drive to the memory.
10. The apparatus as claimed in claim 7, characterized in that, The processing unit is further configured to perform a reset operation on the solid-state drive after the recording unit records the time required for the power-off protection operation, so as to restore the solid-state drive to the power-on working state and set the digital signal corresponding to the first port to a second preset value.
11. The apparatus as claimed in claim 7, characterized in that, The processing unit is used to perform anti-jitter checks before performing power-down protection operations on the solid-state drive; The anti-jitter check includes: after a preset time, detecting whether the digital signal corresponding to the first port is still the first preset value.
12. The apparatus as claimed in claim 7, characterized in that, The time required for the power failure protection operation is the time required to complete the power failure protection operation.
13. A device for measuring the capacitance required for power-off protection, characterized in that, The device includes a processor and an interface circuit, the interface circuit being used to receive signals from other devices outside the device and transmit them to the processor, or to send signals from the processor to other devices outside the device, the processor being used to implement the method as described in any one of claims 1 to 6 via logic circuits or execution code instructions.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed on a computer, cause the computer to perform the method of any one of claims 1 to 6.
Citation Information
Patent Citations
Method for shortening abnormal power failure processing time of solid state disk
CN108255630A
Power-down protection circuit, data storage device and power-down protection method
CN112259146A