TECHNICAL FIELD
[0002] This application relates to the field of communications technologies, and in particular,
to a method and an apparatus for detecting margins of a data signal and a storage
device.
BACKGROUND
[0003] A storage device generally includes a storage controller and a non-volatile flash
memory (nand flash) medium. The storage controller is connected to the nand flash
medium by using a non-volatile flash memory interface (nand flash Interface, NFI),
and can write data to the nand flash medium or read data from the nand flash medium
by using the NFI bus. When the storage controller writes data to the nand flash medium,
the storage controller is a transmit end of the data, and the nand flash medium is
a receive end of the data. When the storage controller reads data from the nand flash
medium, the nand flash medium is a transmit end of the data, and the storage controller
is a receive end of the data.
[0004] In a process of reading and writing data, a transmit end of the data transmits a
data signal (data signal, DQ) and a data strobe signal (data strobe signal, DQS) to
a receive end by using the NFI bus. The receive end of the data may sample the DQ
at an edge of the DQS, and decide, based on a reference voltage (also referred to
as a decision level) provided by a reference power source, a voltage obtained by sampling
the DQ, to obtain the data by decoding. To ensure that the receive end can correctly
sample the DQ, the edge of the DQS transmitted by the transmit end needs to be aligned
with an edge or a central position of the DQ. However, as a data transmission rate
of the NFI bus is continuously increased, a DQS cycle and a DQ cycle are shortened.
After the DQS and the DQ are transmitted to the receive end by using the NFI bus,
a deviation of the edge of the DQS has relatively great impact on DQ sampling accuracy.
[0005] Consequently, when the storage controller reads or writes the data, a bit error easily
occurs.
[0006] In the related art, a signal eye pattern of the DQ received by the receive end is
generally tested by using an afterglow test function of an oscilloscope, and then
a timing margin of the DQ is measured based on the eye pattern, where the timing margin
is a time range within which the DQ remains valid at the receive end in each cycle.
To be specific, when a moment of the edge of the DQS is within the range of the timing
margin, it may be ensured that the DQ can be correctly decoded. Then a developer may
calibrate a related parameter of the storage device (for example, a timing of the
DQS or a reference voltage) based on the timing margin of the DQ obtained through
measurement, to ensure reliability of data reading or writing of the storage controller.
However, efficiency of the manner of measuring the timing margin of the DQ based on
the signal eye pattern obtained through the test by using the oscilloscope is relatively
low.
SUMMARY
[0007] This application provides a method and an apparatus for detecting margins of a DQ
and a storage device, to resolve a problem in the related art that efficiency of detecting
a timing margin by using an oscilloscope is relatively low. The technical solutions
are as follows:
According to one aspect, a method for detecting margins of a DQ is provided and applied
to a receive end of the DQ. The method may include the following steps:
adjusting a voltage of the reference power source based on a plurality of reference
voltages included in a reference voltage set; adjusting, based on a plurality of reference
moments included in a reference moment set, a moment of an edge of a DQS transmitted
by a transmit end of the DQ; and in an adjustment process, for each reference voltage
and each reference moment, determining whether a bit error exists in data obtained
by decoding the DQ when the voltage of the reference power source is the reference
voltage and the moment of the edge of the DQS is the reference moment, to obtain a
timing margin of the DQ at each reference voltage and a voltage margin of the DQ at
each reference moment, where the timing margin is a range of reference moments that
enable the data obtained by decoding to be free of bit errors, in the plurality of
reference moments, and the voltage margin is a range of reference voltages that enable
the data obtained by decoding to be free of bit errors, in the plurality of reference
voltages.
[0008] In the method provided by this application, the receive end of the DQ may automatically
detect the timing margin and voltage margin of the DQ by adjusting the voltage of
the reference power source and a timing of the DQS. Because no other external detection
device needs to be connected in the detection process, detection efficiency is effectively
improved.
[0009] Optionally, the receive end may include a register and a bleeder circuit, a control
end of the bleeder circuit is connected to the register, and an output end of the
bleeder circuit is connected to the reference power source; and the receive end may
adjust a value of the register, to adjust an output voltage of the bleeder circuit.
[0010] Because the bleeder circuit connected to the reference power source is disposed at
the receive end of the DQ, the voltage of the reference power source can be flexibly
adjusted, and timing margins of the DQ at different reference voltages can be detected
conveniently.
[0011] Optionally, the receive end may further include a delay line, and the delay line
is connected to a latch used for latching the data strobe signal and to an input/output
interface of the receive end separately; and the receive end may adjust a parameter
of the delay line, to adjust the moment of the edge of the DQS transmitted by the
transmit end of the DQ. Because the delay line is disposed at the receive end of the
DQ, the timing of the DQS can be flexibly adjusted. Optionally, the process of detecting
a timing margin of the DQ at each reference voltage and a voltage margin of the DQ
at each reference moment may include:
adjusting the voltage of the reference power source to one reference voltage in the
reference voltage set; within a range of the plurality of reference moments included
in the reference moment set, adjusting the moment of the edge of the DQS transmitted
by the transmit end, and detecting whether a bit error exists in data obtained by
decoding the DQ based on the current reference voltage and the DQS after the adjustment,
to determine a start boundary moment and an end boundary moment of the timing margin
of the DQ separately from the plurality of reference moments; and repeating the operations
of adjusting the voltage and determining the timing margin, until the voltage of the
reference power source traverses the reference voltage set, where the start boundary
moment is an earliest reference moment that enables the data obtained by decoding
to be free of bit errors, in the plurality of reference moments, and the end boundary
moment is a latest reference moment that enables the data obtained by decoding to
be free of bit errors, in the plurality of reference moments.
[0012] In this embodiment of this application, the voltage of the reference power source
may be first fixed to a reference voltage, and the timing of the DQS is adjusted,
so that the timing margin at each reference voltage is obtained. Optionally, the plurality
of reference moments may be arranged in ascending order, and the process of determining
a start boundary moment of the timing margin of the DQ may include:
adjusting the moment of the edge of the DQS transmitted by the transmit end, to a
first target reference moment in the plurality of reference moments, where the first
target reference moment is an X
th reference moment in the plurality of reference moments, X is a positive integer less
than M/2, and M is a total quantity of reference moments included in the reference
moment set; detecting whether a bit error exists in data obtained by decoding the
DQ based on the current reference voltage and the DQS after the adjustment; if any
bit error exists, setting forward the moment of the edge of the DQS by a first step
length, until no bit error exists in data obtained by decoding based on the current
reference voltage and the DQS after the adjustment; setting back the moment of the
edge of the DQS by a second step length, until a bit error exists in data obtained
by decoding based on the current reference voltage and the DQS after the adjustment;
and determining a reference moment next to the moment of the edge of the DQS after
the adjustment as the start boundary moment of the timing margin of the DQ, where
the second step length is equal to a time difference between two adjacent reference
moments, and the first step length is greater than the second step length and is an
integer multiple of the second step length.
[0013] In the process of determining the start boundary moment, the timing of the DQS is
first coarsely adjusted by using the relatively great first step length, and then
the timing of the DQS is finely adjusted by using the relatively small second step
length. This can effectively improve efficiency of determining the start boundary
moment.
[0014] Optionally, the process of determining an end boundary moment of the timing margin
of the DQ may include:
adjusting the moment of the edge of the DQS transmitted by the transmit end, to a
second target reference moment in the plurality of reference moments, where the second
target reference moment is a Y
th reference moment in the plurality of reference moments, Y is a positive integer greater
than M/2, and M is a total quantity of reference moments included in the reference
moment set; detecting whether a bit error exists in data obtained by decoding the
DQ based on the current reference voltage and the DQS after the adjustment; if any
bit error exists, setting back the moment of the edge of the DQS by a first step length,
until no bit error exists in data obtained by decoding based on the current reference
voltage and the DQS after the adjustment; setting forward the moment of the edge of
the DQS by a second step length, until a bit error exists in data obtained by decoding
based on the current reference voltage and the DQS after the adjustment; and determining
a reference moment previous to the moment of the edge of the DQS after the adjustment
as the end boundary moment of the timing margin of the DQ, where the second step length
is equal to a time difference between two adjacent reference moments, and the first
step length is greater than the second step length and is an integer multiple of the
second step length.
[0015] In the process of determining the end boundary moment, the timing of the DQS is first
coarsely adjusted by using the relatively great first step length, and then the timing
of the DQS is finely adjusted by using the relatively small second step length. This
can effectively improve efficiency of determining the end boundary moment.
[0016] Optionally, the process of detecting a timing margin of the DQ at each reference
voltage and a voltage margin of the DQ at each reference moment may include:
adjusting the moment of the edge of the DQS transmitted by the transmit end of the
DQ, to one reference moment in the plurality of reference moments; within a range
of the plurality of reference voltages included in the reference voltage set, adjusting
the voltage of the reference power source, and detecting whether a bit error exists
in data obtained by decoding the DQ based on the current reference moment and the
voltage of the reference power source after the adjustment, to determine a start boundary
voltage and an end boundary voltage of the voltage margin of the DQ separately from
the plurality of reference voltages; and repeating the operations of adjusting the
moment and determining the voltage margin, until the moment of the edge of the DQS
traverses the reference moment set, where the start boundary voltage is a lowest reference
voltage that enables the data obtained by decoding to be free of bit errors, in the
plurality of reference voltages, and the end boundary voltage is a highest reference
voltage that enables the data obtained by decoding to be free of bit errors, in the
plurality of reference voltages.
[0017] In this embodiment of this application, the moment of the edge of the DQS may be
first fixed to a reference moment, and the voltage of the reference power source is
adjusted, so that the voltage margin at each reference moment is obtained.
[0018] Optionally, the receive end may be a storage controller, the transmit end may be
a storage medium, and the storage controller may be connected to the storage medium
by using an interface bus; and before the adjusting a moment of an edge of a DQS transmitted
by a transmit end of the DQ, the method may further include:
writing test data to the storage medium at a target rate; transmitting, to the storage
medium, an instruction for reading the test data; and receiving the DQ carrying the
test data, and the DQS that are transmitted by the storage medium, where the target
rate is a working rate of the interface bus or is a lower limit rate within a bus
rate range corresponding to a working mode of the interface bus.
[0019] In this embodiment of this application, if the storage controller needs to detect
margins of a read DQ, the target rate may be the lower limit rate within the bus rate
range corresponding to the working mode of the interface bus. Writing test data at
the lower limit rate can ensure that the test data can be correctly written to the
storage medium, and can further ensure reliability of a detection result obtained
by detecting the margins of the read DQ. If the storage controller needs to detect
margins of a DQ written to the storage medium, the storage controller may write test
data at a normal working rate, to ensure that a detection result can reflect an actual
running status of a storage device.
[0020] Optionally, the process of adjusting a voltage of the reference power source based
on a plurality of reference voltages included in a reference voltage set may include:
adjusting the voltage of the reference power source in response to a detection instruction
based on the plurality of reference voltages included in the reference voltage set;
or if detecting that a physical parameter of a storage device meets a detection trigger
condition, adjusting the voltage of the reference power source based on the plurality
of reference voltages included in the reference voltage set.
[0021] In this embodiment of this application, when instructed by the detection instruction,
the receive end of the DQ may trigger the procedure for detecting the margins of the
DQ, or when detecting that the physical parameter meets the detection trigger condition,
the receive end of the DQ may automatically trigger the procedure for detecting the
margins of the DQ.
[0022] According to another aspect, an apparatus for detecting margins of a data signal
is provided. The apparatus includes one or more modules, and the one or more modules
may be configured to implement the method for detecting margins of a DQ according
to the foregoing aspect.
[0023] According to still another aspect, an apparatus for detecting margins of a data signal
is provided. The apparatus includes a memory, a processor, and a computer program
stored in the memory and capable of running on the processor, and when the processor
executes the computer program, the method for detecting margins of a DQ according
to the foregoing aspect is implemented.
[0024] According to yet another aspect, a non-volatile storage medium is provided. The non-volatile
storage medium stores an instruction, and when the non-volatile storage medium runs
on a processor, the processor is enabled to perform the method for detecting margins
of a DQ according to the foregoing aspect.
[0025] According to yet another aspect, a chip is provided. The chip includes a programmable
logic circuit and/or a program instruction, and when the chip runs, the chip is configured
to implement the method for detecting margins of a DQ according to the foregoing aspect.
[0026] According to yet another aspect, a computer program product including an instruction
is provided. When the computer program product runs on a processor, the processor
is enabled to perform the method for detecting margins of a DQ according to the foregoing
aspect.
[0027] According to yet another aspect, a storage device is provided. The storage device
includes a storage controller and a storage medium, and the storage controller is
connected to the storage medium by using an interface bus; and the storage controller
and/or the storage medium include/includes the apparatus for detecting margins of
a data signal or the chip according to the foregoing aspect.
[0028] According to the method and apparatus for detecting margins of a data signal and
the storage device that are provided by the embodiments of this application, the receive
end of the data signal may automatically detect the timing margin and voltage margin
of the DQ by adjusting the voltage of the reference power source and the timing of
the DQS. Because no other external detection device needs to be connected in the detection
process, detection efficiency is effectively improved. In addition, because the timing
margin and the voltage margin are determined by the receive end of the data signal
based on whether a bit error exists in data actually obtained by decoding, reliability
of the detection result can be ensured.
BRIEF DESCRIPTION OF DRAWINGS
[0029]
FIG. 1 is a schematic structural diagram of a storage device according to an embodiment
of this application;
FIG. 2 is a timing diagram of a DQS and a DQ according to an embodiment of this application;
FIG. 3 is a schematic structural diagram of a storage controller according to an embodiment
of this application;
FIG. 4 is a schematic structural diagram of another storage controller according to
an embodiment of this application;
FIG. 5 is a flowchart of a method for detecting margins of a DQ according to an embodiment
of this application;
FIG. 6 is a flowchart of another method for detecting margins of a DQ according to
an embodiment of this application;
FIG. 7 is a schematic diagram of two-dimensional margins of a DQ according to an embodiment
of this application;
FIG. 8 is a flowchart of still another method for detecting margins of a DQ according
to an embodiment of this application;
FIG. 9A and FIG. 9B are a flowchart of yet another method for detecting margins of
a DQ according to an embodiment of this application;
FIG. 10 is a schematic structural diagram of a storage medium according to an embodiment
of this application;
FIG. 11 is a flowchart of a method for determining a start boundary moment of a timing
margin of a first DQ according to an embodiment of this application;
FIG. 12 is a schematic diagram for adjusting a timing of a DQS according to an embodiment
of this application;
FIG. 13 is a flowchart of a method for determining an end boundary moment of a timing
margin of a first DQ according to an embodiment of this application;
FIG. 14 is another schematic diagram for adjusting a timing of a DQS according to
an embodiment of this application;
FIG. 15 is a flowchart of an algorithm for determining a start boundary moment of
a timing margin of a first DQ according to an embodiment of this application;
FIG. 16 is a flowchart of an algorithm for determining an end boundary moment of a
timing margin of a first DQ according to an embodiment of this application;
FIG. 17 is another schematic diagram of two-dimensional margins of a DQ according
to an embodiment of this application;
FIG. 18 is a structural block diagram of an apparatus for detecting margins of a data
signal according to an embodiment of this application;
FIG. 19 is a schematic structural diagram of a detection module according to an embodiment
of this application;
FIG. 20 is a schematic structural diagram of another detection module according to
an embodiment of this application; and
FIG. 21 is a structural block diagram of another apparatus for detecting margins of
a data signal according to an embodiment of this application.
DESCRIPTION OF EMBODIMENTS
[0030] With reference to the accompanying drawings, the following describes in detail a
method and an apparatus for detecting margins of a data signal and a storage device
provided by embodiments of this application.
[0031] FIG. 1 is a schematic structural diagram of a storage device according to an embodiment
of this application. As shown in FIG. 1, the storage device may include a storage
controller 01 and one or more storage media 02. For example, FIG. 1 shows only one
storage medium 02. Each storage medium 02 may be a nand flash medium, which may also
be referred to as a nand flash chip or a nand flash memory chip. The nand flash medium
has advantages such as a large capacity and a high rewriting speed, and is applicable
to mass data storage. A plurality of input/output (Input/Output, IO) interfaces 011
may be disposed in the storage controller 01. One IO interface 021 is also disposed
in each storage medium 02. The IO interface 021 of each storage medium 02 may be connected
to one IO interface 011 of the storage controller 01 by using an NFI bus 03.
[0032] Optionally, the storage device may be solid state drives (solid state drive, SSD)
of different sizes, an add-in card (add in card, AIC) device, a mini serial advanced
technology attachment (mini serial advanced technology attachment, mSATA) interface
solid state drive, a next generation form factor (next generation form factor, NGFF),
another customized card, or the like.
[0033] In this embodiment of this application, the NFI interface bus 03 may include a plurality
of data lines, where each data line may be configured to transmit one DQ, and the
plurality of data lines may transmit a plurality of DQs in parallel. For example,
the NFI interface bus 03 may include eight data lines, where the eight data lines
may transmit eight DQs in parallel: a DQ 0 to a DQ 7.
[0034] FIG. 2 is a timing diagram of a DQS and a DQ according to an embodiment of this application.
As can be seen with reference to FIG. 2, the DQS is a differential signal, and the
DQS includes two signals: a DQS P and a DQS N. After a receive end receives a DQS
and a DQ carrying data that are transmitted by a transmit end, the receive end may
sample the DQ at an edge of the DQS, and may compare a voltage obtained by decoding
with a reference voltage Vref provided by a reference power source VREF. If the sampled
voltage is higher than the reference voltage Vref, it may be determined that the received
data is 1; or if the sampled voltage is lower than the reference voltage Vref, it
may be determined that the received data is 0. In this way, the DQ is decoded. The
edge of the DQS may be a rising edge or a falling edge of the DQS.
[0035] To ensure that the receive end can correctly sample the DQ based on the DQS, as shown
in FIG. 2, it needs to be ensured that the DQ arrives at the receive end before the
edge of the DQS arrives, and remains stable at the receive end for a period of time
after the edge of the DQS arrives. Duration tds within which the DQ remains valid
at the receive end before the edge of the DQS arrives may be referred to as setup
time (setup time). Duration tdh within which the DQ is held valid at the receive end
after the edge of the DQS arrives may be referred to as hold time (hold time). For
a low-level DQ, when a voltage of the DQ received by the receive end is less than
or equal to VIL(ac)max, it may be determined that the DQ is valid, or when a voltage
of the DQ is greater than VIL(dc)max, it may be determined that the DQ is invalid.
For a high-level DQ, when a voltage of the DQ received by the receive end is greater
than or equal to VIH(ac)min, it may be determined that the DQ is valid, or when a
voltage of the DQ is less than VIH(ac)min, it may be determined that the DQ is invalid.
VIL(ac)max, VIL(dc)max, VIH(dc)min, and VIH(ac)min are all threshold voltages specified
by a protocol.
[0036] In this embodiment of this application, a time range within which the DQ is held
valid at the receive end after arriving at the receive end is referred to as a timing
margin (margin) of the DQ, and the timing margin may also be referred to as a valid
width of the DQ or a length of a valid window. When a moment of the edge of the DQS
changes within the timing margin, correct decoding of the DQ can be ensured. As can
be seen with reference to FIG. 2, the timing margin may be a sum of the setup time
and the hold time. In addition, in this embodiment of this application, a change range
of a reference voltage that can ensure correct decoding of the DQ is referred to as
a voltage margin of the DQ. To be specific, adjusting the voltage of the reference
power source VREF within the voltage margin can ensure correct decoding of the DQ.
[0037] When the storage controller 01 reads data from the storage medium 02, that is, when
the storage controller 01 serves as a receive end, the DQS is generated by the storage
medium 02, and an edge of the DQS is aligned with an edge of a DQ, to ensure that
the storage controller 01 can effectively read the data transmitted by the storage
medium 02. When the storage controller 01 writes data to the storage medium 02, that
is, when the storage medium 02 serves as a receive end, a DQS is generated by the
storage controller 01, and an edge of the DQS is aligned with a central position of
a DQ, to ensure that the storage medium 02 can effectively store the data written
by the storage controller 01. An operation of writing data by the storage controller
01 to the storage medium 02 may also be referred to as a write operation or an operation
in a write direction. An operation of reading data by the storage controller 01 from
the storage medium 02 may also be referred to as a read operation or an operation
in a read direction.
[0038] However, after a DQ and a DQS arrive at a receive end through a transmission link,
their phases generally change greatly. For example, due to impact of environmental
factors such as a process corner, voltage, and temperature (Process corner, voltage,
temperature, PVT), valid widths of DQs received by the receive end may be different,
edges of the DQs are not aligned either, and an edge of the DQS is no longer aligned
with an edge or a central position of the DQ. Consequently, the storage controller
01 cannot read or write data correctly. In addition, with continuous development of
an information and communications technologies (information and communications technology,
ICT) industry, a customer has a higher requirement on read/write operations per second
(Input/Output operations per second, IOPS) of the storage device. Because a data transmission
rate of the NFI bus 03 between the storage controller 01 and the storage medium is
a key factor affecting the IOPS, the data transmission rate of the NFI bus 03 is also
continuously increased. As a result, the valid width of the DQ is further reduced,
and a bit error occurs more easily when the storage controller 01 reads or writes
data. Therefore, how to accurately test a timing margin and a voltage margin of the
DQ transmitted by the NFI bus 03 and further ensure sufficient design margins of a
whole link becomes a key to reliable application of the storage device.
[0039] In the related art, on one hand, signal eye patterns of the DQS and DQ received by
the receive end are generally tested by using an afterglow test function of an oscilloscope,
and then a timing margin and a voltage margin of the DQ are measured and determined.
However, the test process requires plenty of time, human resources, and material resources,
and test efficiency is relatively low. Therefore, project development costs are increased,
and a project cycle is prolonged. Moreover, the test method can test only a signal
waveform at a pin (pin) of the receive end, and cannot test a waveform of a signal
actually received by a die (die) of the receive end. Therefore, test accuracy is relatively
low. In addition, in a scenario in which one storage medium 02 is attached to a front
side of a card and one storage medium 02 is attached to a rear side of the card, when
a test is performed by using the storage medium 02 as a receive end, one storage medium
02 on the card needs to be welded off. Consequently, load of a link under test is
reduced, and a test result is inaccurate. In addition, usually, the test can be performed
only on a single sample, and cannot cover samples having different process corners.
It is possible that a nonconformity risk remains in subsequent thorough and qualification
tests on a large quantity of samples, causing a problem such as lagging of risk interception
or wasting of test resources.
[0040] On the other hand, values of the timing margin and the voltage margin of the DQ may
be further determined by means of a bias test about whether uncorrectable (uncorrectable,
UNC) data error occurs. For example, parameters such as frequency, timing, temperature,
and voltage may be biased for testing. However, in this method, the timing margin
and the voltage margin are roughly estimated by using an indirect test method, and
accurate quantization of the timing margin and the voltage margin cannot be implemented.
Therefore, test accuracy is relatively low. In addition, in this method, test personnel
are required to manually adjust test parameters, and plenty of time, human resources,
and material resources are required in the test process. Therefore, test efficiency
is relatively low, the project development costs are increased, and the project cycle
is prolonged.
[0041] Embodiments of this application provide a method and an apparatus for detecting margins
of a DQ and a storage device. A receive end of a data signal in the storage device
may automatically detect margins of the DQ, and detection efficiency and accuracy
are both relatively high. The receive end may be a storage controller 01, or may be
a storage medium 02. Assuming that the receive end is the storage controller 01, as
shown in FIG. 3, a bleeder circuit 0111 may be disposed in an IO interface 011 of
the storage controller 01, and a register 012 may be further disposed in a physical
layer of the storage controller 01. The bleeder circuit 0111 is connected to the register
012 and a reference power source VREF respectively, and the reference power source
VREF is further connected to an IO interface 021 of the storage medium 02. A reference
voltage provided by the reference power source VREF may be used as a decision level
when the storage controller 01 and the storage medium 02 decode received DQs.
[0042] A processing circuit (not shown in FIG. 3) in the storage controller 01 may configure
a parameter of the register 012, to adjust a value of the register 012 and further
adjust an output voltage of the bleeder circuit 0111. For example, referring to FIG.
3, the processing circuit may configure parameters such as REFSEL0, REFSEL1, REFRANGE0,
REFRANGE1, REFRANGE2, and REFRANGE3 of the register 012, to adjust the value of the
register 012. Because the bleeder circuit 0111 is added to the storage controller
01, the bleeder circuit 0111 may be used to flexibly adjust the voltage of the reference
power source VREF, to detect a voltage margin of the DQ.
[0043] FIG. 4 is a schematic structural diagram of a physical layer (physical, PHY) of a
storage controller according to an embodiment of this application. As shown in FIG.
4, a latch 013 used for latching a DQ and a DQS, a delay-locked loop (delay-locked
loop, DLL), a delay line (delay Line), and a DLL controller (DLL CTRL) may be further
disposed in the storage controller 01. The DLL is connected to the latch 013, the
DL, and the DLL CTRL respectively, and the DL is further connected to the IO interface
011 of the storage controller. The DLL is configured to detect a cycle of the DQS
under control of the DLL CTRL. The processing circuit in the storage controller 01
may determine, based on the cycle of the DQS detected by the DLL, a quantity of reference
moments included in a reference moment set, and may divide the cycle of the DQS into
a plurality of reference moments, that is, the processing circuit may determine the
reference moment set based on the cycle of the DQS. The processing circuit may further
adjust a timing of the DQS by adjusting a parameter of the DL, that is, adjust a moment
of an edge of the DQS, to detect a timing margin of the DQ conveniently.
[0044] Referring to FIG. 4, the physical layer of the storage controller may be connected
to the processing circuit by using a nand flash control (nand flash control, NFC)
interface. A control link (command lane, CMDLANE) 014 may be further disposed in the
storage controller 01. The control link 014 is configured to provide an address latch
enable (address latch enable, ALE) signal, a command latch enable (command latch enable,
CLE) signal, a read enable (read enable, REN) signal, a write enable (write enable,
WEN) signal, and the like. The DLL may be connected to the latch 013 by using a clock
reset generator (clock reset generator, CRG). As shown in FIG. 4, a ZQ resistor is
further disposed in the physical layer. After power-up (power up) or reset, the storage
controller needs to perform a calibration operation on the ZQ resistor.
[0045] FIG. 5 is a flowchart of a method for detecting margins of a DQ according to an embodiment
of this application. This method may be applied to a receive end of a data signal
in a storage device, for example, may be applied to a storage controller. In the following
description, it is assumed that the method is applied to the storage controller. Referring
to FIG. 5, the method may include the following steps.
[0046] Step 101: Adjust a voltage of a reference power source based on a plurality of reference
voltages included in a reference voltage set.
[0047] In this embodiment of this application, the storage controller may prestore a reference
voltage set including a plurality of reference voltages, and the plurality of reference
voltages may be to-be-detected voltages preconfigured by a developer.
[0048] Optionally, as shown in FIG. 3, the storage controller 01 may adjust a value of a
register 012 by using a processing circuit, to adjust an output voltage of a bleeder
circuit 0111, thereby adjusting a voltage of the reference power source VREF. For
example, referring to FIG. 3, the bleeder circuit 0111 may be a resistor bleeder circuit,
and the bleeder circuit 0111 may be equivalent to two resistors R1 and R2 that are
connected in series between a first power source VDD and a second power source VSS,
and the reference power source VREF may be connected to a connection point between
the two resistors R1 and R2. The processing circuit may adjust the value of the register
012, to adjust a value of at least one of the two resistors R1 and R2. In this way,
the output voltage output by the bleeder circuit 0111 to the reference power source
VREF can be changed.
[0049] Step 102: Adjust a moment of an edge of a DQS based on a plurality of reference moments
included in a reference moment set.
[0050] The DQS is transmitted synchronously when a storage medium transmits a DQ to the
storage controller. The storage controller may prestore a reference moment set including
a plurality of reference moments, and the plurality of reference moments may be determined
by the storage controller based on a cycle of a detected DQS or may be to-be-detected
moments preconfigured by the developer. As shown in FIG. 4, the storage controller
01 may adjust, by using a DL, a timing of the DQS transmitted by the storage medium,
so that the moment of the edge of the DQS is aligned with different reference moments.
Optionally, the plurality of reference moments may be determined by dividing the cycle
of the DQS into equal parts, where the cycle of the DQS is determined based on a data
transmission rate of an NFI bus, and may be obtained through detection by using a
DLL. For example, the storage controller may divide the cycle of the DQS into 1023
equal parts, thereby determining 1024 reference moments. Each reference moment may
be indicated by using a scale value. For example, 1 to 1024 may be used to indicate
the 1024 reference moments. Step 103: For each reference voltage and each reference
moment, determine whether a bit error exists in data obtained by decoding the DQ when
the voltage of the reference power source is the reference voltage and the moment
of the edge of the DQS is the reference moment, to obtain a timing margin of the DQ
at each reference voltage and a voltage margin of the DQ at each reference moment.
[0051] The timing margin is a range of reference moments that enable the data obtained by
decoding to be free of bit errors, in the plurality of reference moments, and the
voltage margin is a range of reference voltages that enable the data obtained by decoding
to be free of bit errors, in the plurality of reference voltages. In this embodiment
of this application, because the storage controller 01 can not only perform an operation
in a read direction but also perform an operation in a write direction, the storage
controller 01 can detect margins of a DQ in the read direction and margins of a DQ
in the write direction separately. Certainly, if the storage medium 02 in the storage
device also has a margin detection function, the storage medium 02 can also detect
the margins of the DQ in the write direction.
[0052] When detecting the margins of the DQ in the read direction, the storage controller
01 may first write test data to the storage medium 02 at a relatively low data transmission
rate, to ensure accuracy of the test data that is written. Then the storage controller
01 may transmit, to the storage medium, an instruction for reading the test data.
Then the storage medium 02 may transmit, in response to the read instruction, the
DQ carrying the test data, and the DQS to the storage controller 01. Then the storage
controller 01 may detect the margins of the DQ in the read direction based on the
DQS. Before the storage controller 01 detects the margins of the DQ in the write direction,
the storage controller 01 or the developer may first calibrate a related parameter
(for example, a parameter of the DL or a voltage of the reference power source VREF)
of the storage device based on a detection result of the margins of the DQ in the
read direction, to ensure that the margins of the DQ in the read direction can ensure
correct decoding of data, that is, ensure that the storage controller 01 can correctly
read data. Then the storage controller 01 may write test data to the storage medium
02 at a normal data transmission rate, and transmit, to the storage medium 02, an
instruction for reading the test data. The storage medium 02 may transmit, in response
to the read instruction, the DQ carrying the test data, and the DQS to the storage
controller 01. Then the storage controller 01 may detect the margins of the DQ based
on the received DQS. Because it can be ensured that the test data read by the storage
controller 01 is accurate, that is, the test data read by the storage controller 01
is the test data actually written to the storage medium 02, the storage controller
01 can detect, based on the DQ transmitted by the storage medium 02, the margins of
the DQ (that is, the DQ in the write direction) transmitted by the storage controller
01 to the storage medium 02.
[0053] As described above, this embodiment of this application provides a method for detecting
margins of a data signal. The receive end of the DQ may automatically detect the timing
margin and voltage margin of the DQ by adjusting the voltage of the reference power
source and the timing of the DQS. In the detection process, no other external detection
device needs to be connected, and no parameter needs to be manually adjusted. Therefore,
detection efficiency is effectively improved, and detection costs are reduced. In
addition, because the timing margin and the voltage margin are determined by the storage
controller based on whether a bit error exists in data actually obtained by decoding,
reliability of the detection result can be ensured.
[0054] In addition, in the method provided by this embodiment of this application, whether
margins of a currently tested sample of the storage device meet a requirement may
be directly determined based on a detection result, and dependence on a sample quantity
and sample types is weakened. The method resolves a problem that samples and data
are insufficient because a current test procedure cannot cover samples having different
process corners, effectively improves margin detection accuracy and efficiency, ensures
that the storage device can work reliably in different PVT states, and can support
a higher data transmission rate.
[0055] In an optional implementation, as shown in FIG. 6, the method for detecting margins
of a DQ may include the following procedure.
[0056] Step 201: A storage controller sets a voltage of a reference power source VREF to
a first reference voltage in a reference voltage set, and marks A = 1. A may be used
to indicate a quantity of reference voltages currently already swept by the voltage
of the reference power source VREF, in the reference voltage set.
[0057] Step 202: The storage controller detects whether A is less than or equal to N. If
A is less than or equal to N, step 203 is performed; or if A is not less than N, step
208 is performed.
[0058] N is a total quantity of reference voltages included in the reference voltage set,
and N is an integer greater than 1. When A ≤ N, the storage controller may determine
that the voltage of the reference power source VREF has not traversed the reference
voltage set, and therefore may perform step 203; or when A > N, the storage controller
may determine that the voltage of the reference power source VREF has traversed the
reference voltage set, and therefore may perform step 207.
[0059] Step 203: The storage controller writes training data at a low data transmission
rate.
[0060] In this embodiment of this application, the storage controller may write the training
data to a storage medium at the relatively low data transmission rate, to ensure correct
writing of the training data. The training data may be data prestored in the storage
controller, for example, may be data customized by a developer.
[0061] Step 204: The storage controller detects a timing margin of a DQ in a read direction.
[0062] The storage controller may transmit, to the storage medium, an instruction for reading
the training data, and receive, by using an NFI bus, the DQ carrying the training
data, and a DQS that are transmitted by the storage medium. The storage controller
may adjust a moment of an edge of the DQS within a range of a plurality of reference
moments included in the reference moment set (that is, adjust a timing of the DQS),
and detect whether a bit error exists in data obtained by decoding the DQ based on
the current reference voltage and the DQS after the timing is adjusted, to obtain
a timing margin of the DQ in the read direction at the current reference voltage.
[0063] After the foregoing step 204, the storage controller or the developer may first calibrate
a related parameter of a storage device based on a detection result of the timing
margin of the DQ in the read direction, to ensure that the timing margin of the DQ
in the read direction can ensure correct decoding of the data, that is, ensure that
the storage controller can correctly read the data.
[0064] Step 205: The storage controller writes the training data at a normal data transmission
rate.
[0065] The storage controller may write the training data to the storage medium again at
the normal data transmission rate. The normal data transmission rate is a data transmission
rate at which the storage controller writes the data to the storage medium when the
storage controller works normally.
[0066] Step 206: The storage controller detects a timing margin of a DQ in a write direction.
[0067] The storage controller may read the training data from the storage medium again.
Because after the foregoing step 204, a parameter-based adjustment operation can ensure
reliability of the training data read by the storage controller, the storage controller
can detect, by using the read training data, whether a bit error exists in the written
training data, that is, implement detection of the timing margin of the DQ in the
write direction.
[0068] Step 207: The storage controller sets the voltage of the reference power source VREF
to a next reference voltage in the reference voltage set, and updates A to A + 1.
Then step 202 is performed.
[0069] The storage controller may perform the foregoing step 202 to step 207 cyclically
until A > N.
[0070] Step 208: The storage controller generates a schematic diagram of two-dimensional
margins.
[0071] If the storage controller detects that A is greater than N in the foregoing step
202, it may be determined that the reference voltage set has been traversed. Therefore,
the storage controller may generate a schematic diagram of two-dimensional margins
of the DQ in the read direction and a schematic diagram of two-dimensional margins
of the DQ in the write direction separately based on the timing margins of the DQ
in the read direction and the timing margins of the DQ in the write direction that
are obtained through detection at different reference voltages.
[0072] A horizontal axis of the schematic diagram of the two-dimensional margins may be
used to indicate the moment of the edge of the DQS, a vertical axis may be used to
indicate the voltage of the reference power source VREF, and different graphical symbols
may be used at each coordinate point in the schematic diagram to indicate whether
a bit error exists in data obtained by decoding based on parameters at the coordinate
point.
[0073] For example, assuming that the margins of the DQ in the read direction are detected,
the reference voltage set includes a reference voltage V1 to a reference voltage V10,
10 reference voltages in total, and the reference moment set includes T1 to T15, 15
reference moments in total, a schematic diagram of two-dimensional margins of the
DQ in the read direction that is finally generated by the storage controller may be
shown in FIG. 7. In the schematic diagram, a white circle indicates that a bit error
exists, and a black circle indicates that no bit error exists. Referring to FIG. 7,
if the voltage of the reference power source VREF is a reference voltage V3, when
the moment of the edge of the DQS is a reference moment T7 to a reference moment T11,
no bit error exists in data obtained by decoding the DQ, that is, a timing margin
of the DQ at the reference voltage V3 is T7 to T11. As can be seen from FIG. 7, when
the voltage of the reference power source VREF is a reference voltage V6, a timing
margin of the DQ is the largest. If the moment of the edge of the DQS is a reference
moment T6, when the voltage of the reference power source VREF is a reference voltage
V4 to a reference voltage V8, no bit error exists in data obtained by decoding the
DQ, that is, a voltage margin of the DQ at the reference moment T6 is V4 to V8. As
can be seen from FIG. 7, when the moment of the edge of the DQS is a reference moment
T9, a voltage margin of the DQ is the largest. The schematic diagram of the two-dimensional
margins generated by the storage controller can visually reflect timing margins of
the DQ at different reference voltages, so that an operator can adjust a related parameter
of the storage device conveniently based on the schematic diagram.
[0074] As can be learned from the foregoing descriptions, in this implementation, the storage
controller may adjust the voltage of the reference power source VREF to each reference
voltage in the reference voltage set in sequence, so that the voltage of the reference
power source VREF traverses the reference voltage set. In addition, after each adjustment,
both the timing margin of the DQ in the read direction and the timing margin of the
DQ in the write direction at the reference voltage may be detected. Finally, a schematic
diagram of two-dimensional margins may be generated based on the timing margin obtained
through detection at each reference voltage.
[0075] In the method procedure shown in FIG. 6, step 205 and step 206 may be deleted, that
is, the storage controller may detect only the timing margin of the DQ in the read
direction. Correspondingly, step 203 may also be performed before step 201. To be
specific, the storage controller may first write the training data, and then adjust
the voltage of the reference voltage end and the timing of the DQS, to detect the
timing margin of the DQ in the read direction. Likewise, step 203 and step 204 may
also be deleted, that is, the storage controller may detect only the timing margin
of the DQ in the write direction. Correspondingly, step 205 may also be performed
before step 201. To be specific, the storage controller may first write the training
data, and then adjust the voltage of the reference voltage end and the timing of the
DQS, to detect the timing margin of the DQ in the write direction.
[0076] In another optional implementation, as shown in FIG. 8, the method for detecting
margins of a DQ may further include the following procedure.
[0077] Step 301: A storage controller writes training data at a low data transmission rate.
[0078] In this embodiment of this application, the storage controller may write the training
data to a storage medium at the relatively low data transmission rate.
[0079] Step 302: The storage controller adjusts an edge of a DQS in a read direction to
a first reference moment in a reference moment set, and marks B = 1.
[0080] B may be used to indicate a quantity of reference moments currently swept by the
edge of the DQS, in the reference moment set. Optionally, the storage controller may
transmit, to the storage medium, an instruction for reading the training data written
in step 301, and receive, by using an NFI bus, a DQ carrying the training data, and
the DQS that are transmitted by the storage medium. Then the storage controller may
adjust a timing of the DQS, so that a moment of the edge of the DQS is the first reference
moment in the reference moment set, that is, the edge of the DQS is aligned with the
first reference moment.
[0081] Step 303: The storage controller detects whether B is less than or equal to M. If
B is less than or equal to M, step 304 is performed; or if B is not less than M, step
306 is performed.
[0082] M is a total quantity of reference moments included in the reference moment set,
and M is an integer greater than 1. When B ≤ M, the storage controller may determine
that the moment of the edge of the DQS has not traversed the reference moment set,
and therefore may perform step 304; or if B > M, the storage controller may determine
that the moment of the edge of the DQS has traversed the reference moment set, and
therefore may perform step 306.
[0083] Step 304: The storage controller detects a voltage margin of the DQ in the read direction.
[0084] Within a range of a plurality of reference voltages included in a reference voltage
set, the storage controller may adjust a voltage of a reference power source VREF,
and detect whether a bit error exists in data obtained by decoding the DQ based on
the current reference moment and the voltage after the adjustment, to obtain a start
boundary voltage and an end boundary voltage of the DQ in the read direction at the
current reference moment. The start boundary voltage is a lowest reference voltage
that enables the data obtained by decoding to be free of bit errors, in the plurality
of reference voltages, and the end boundary voltage is a highest reference voltage
that enables the data obtained by decoding to be free of bit errors, in the plurality
of reference voltages.
[0085] Step 305: The storage controller adjusts the edge of the DQS to a next reference
moment in the reference moment set, and updates B to B + 1. Then step 303 is performed.
The storage controller may perform the foregoing step 303 to step 305 cyclically until
B > M.
[0086] Step 306: The storage controller generates a schematic diagram of two-dimensional
margins of the DQ in the read direction.
[0087] If the storage controller detects that B is greater than M in the foregoing step
303, it may be determined that the reference moment set has been traversed. Therefore,
the storage controller may generate a schematic diagram of two-dimensional margins
of the DQ in the read direction based on the voltage margins of the DQ in the read
direction that are obtained through detection at different reference moments.
[0088] In this embodiment of this application, after the voltage margin of the DQ in the
read direction is detected, the storage controller or a developer may first calibrate
a related parameter of a storage device based on a detection result of the timing
margin of the DQ in the read direction, to ensure that the timing margin of the DQ
in the read direction can ensure correct decoding of data, that is, ensure that the
storage controller can correctly read data.
[0089] Step 307: The storage controller writes the training data at a normal data transmission
rate.
[0090] The storage controller may write the training data to the storage medium again at
the normal data transmission rate, and transmit, to the storage medium, a command
for reading the training data, to instruct the storage medium to transmit a DQ carrying
the training data, and a DQS in the read direction. Because after the foregoing step
306, a parameter-based adjustment operation can ensure reliability of the training
data read by the storage controller, the storage controller can detect, by using the
read training data, whether a bit error exists in the written training data, that
is, implement detection of a voltage margin of a DQ in a write direction.
[0091] Step 308: The storage controller adjusts an edge of a DQS in the write direction
to the first reference moment in the reference moment set, and marks B = 1.
[0092] The storage controller may use the DQS transmitted by the storage medium in the read
direction as the DQS in the write direction, and perform a timing adjustment.
[0093] Step 309: The storage controller detects whether B is less than or equal to M. If
B is less than or equal to M, step 310 is performed; or if B is not less than M, step
312 is performed.
[0094] Step 310: The storage controller detects the voltage margin of the DQ in the write
direction.
[0095] Step 311: The storage controller adjusts the edge of the DQS to a next reference
moment in the reference moment set, and updates B to B + 1. Then step 309 is performed.
[0096] Step 312: The storage controller generates a schematic diagram of two-dimensional
margins of the DQ in the write direction.
[0097] For an implementation process of the foregoing step 308 to step 312, refer to related
descriptions in step 302 to step 306. Details are not described again herein. As can
be learned from the foregoing descriptions, in this implementation, the storage controller
may adjust the moment of the edge of the DQS to each reference moment in the reference
moment set in sequence, so that the moment of the edge of the DQS traverses the reference
moment set. In addition, after each adjustment, both the voltage margin of the DQ
in the read direction and the voltage margin of the DQ in the write direction at the
reference moment may be detected. Finally, a schematic diagram of two-dimensional
margins may be generated based on the voltage margin obtained through detection at
each reference moment.
[0098] The method for detecting margins of a DQ is hereinafter described by using an example
in which the method is applied to a storage controller, a timing margin at each reference
voltage in a reference voltage set is first determined, and then two-dimensional margins
of the DQ are determined. As shown in FIG. 9A and FIG. 9B, the method may include
the following steps.
[0099] Step 401: Detect whether a physical parameter of a storage device meets a detection
trigger condition.
[0100] In this embodiment of this application, after power-up, a storage controller may
obtain the physical parameter of the storage device in real time, and detect whether
the physical parameter meets a detection trigger condition. For example, the storage
controller may obtain the physical parameter of the storage device in a plurality
of different scenarios such as a test phase, a service running process, or a service
idle phase, and detect whether the physical parameter meets the detection trigger
condition. If the physical parameter meets the detection trigger condition, step 402
may be performed, that is, margin detection continues to be performed. If the physical
parameter does not meet the detection trigger condition, service running may be continued,
but there is no need to continue to perform the following step. Optionally, the physical
parameter may include one or more of a physical parameter of the storage controller
and a physical parameter of the storage medium. For example, the physical parameter
may include a PVT parameter, for example, may include one or more of temperature,
humidity, working voltage, data transmission rate, and data transmission amount. Correspondingly,
the detection trigger condition may include one or more of the following conditions:
A temperature variation is greater than a temperature threshold; a humidity variation
is greater than a humidity threshold; a working voltage variation is greater than
a voltage threshold; a data transmission rate is greater than a rate threshold; and
a data transmission amount is greater than a service traffic threshold. The temperature
threshold, the humidity threshold, the voltage threshold, the rate threshold, and
the service traffic threshold may all be preconfigured in the storage controller,
and may be configured by a developer based on an application requirement of the storage
device.
[0101] In this embodiment of this application, alternatively, the procedure for detecting
margins of a DQ may be manually triggered by test personnel. For example, a test device
in which debugging software is installed may be connected to the storage controller
by using a serial port. The test personnel may transmit a detection instruction to
the storage controller by using the debugging software, and then the storage controller
can perform the following step 402 in response to the detection instruction. Alternatively,
after power-up and startup each time, the storage controller may perform the procedure
for detecting margins of a DQ, that is, the storage controller may automatically trigger
a detection instruction after power-up each time.
[0102] Step 402: Adjust a voltage of a reference power source to one reference voltage in
a reference voltage set.
[0103] The reference voltage set may include a plurality of different reference voltages,
and the plurality of different reference voltages may be to-be-detected voltages preconfigured
by the developer. In this embodiment of this application, referring to FIG. 3, the
storage controller may adjust a value of a register 012 by using a processing circuit,
to adjust an output voltage of a bleeder circuit 0111. In this way, the voltage of
the reference power source VREF is adjusted. In a process of designing and developing
the storage controller 01, an adjustable quantity of values of the register 012 may
be determined based on a quantity of bits of the register 012. Then a quantity N of
reference voltages included in the reference voltage set may be determined based on
the adjustable quantity. The quantity N of the reference voltages may be greater than
1, and is less than or equal to the adjustable quantity. For example, N may be equal
to the adjustable quantity. Then voltage values of the N reference voltages may be
determined based on a voltage change range of the reference power source VREF, that
is, the voltage change range of the reference power source VREF may be divided into
N different positions. Finally, the processing circuit, the register 012, and the
bleeder circuit 0111 may be configured, so that the processing circuit stores N values
of the register 012 that correspond to the N reference voltages on a one-to-one basis.
When the processing circuit adjusts the value of the register 012 to one of the N
values, a voltage output by the bleeder circuit 0111 to the reference power source
VREF may be a reference voltage corresponding to the value.
[0104] For example, assuming that the register 012 is an n-bit register, where n is an integer
greater than 1, an adjustable range of values of the register may be 1 to 2n, and
the quantity N of the reference voltages included in the reference voltage set may
also be 2n.
[0105] Step 403: Detect whether the voltage of the reference power source traverses the
reference voltage set.
[0106] If the reference voltage set is not traversed, step 404 is performed; or if the reference
voltage set is traversed, step 412 may be performed. Optionally, to improve detection
efficiency, the storage controller may adjust the voltage of the reference power source
in sequence from a first reference voltage in the reference voltage set, until a last
reference voltage. For example, the storage controller may adjust the voltage of the
reference power source in sequence in descending or ascending order of reference voltages.
[0107] In addition, for ease of collecting statistics, the storage controller may record
a marker bit A, where an initial value of the marker bit A may be 0. Every time the
storage controller adjusts the voltage of the reference power source, the marker bit
A may be updated to A + 1. Correspondingly, when detecting whether the voltage of
the reference power source traverses the reference voltage set, the storage controller
may directly detect whether the marker bit A is less than or equal to N. If A is less
than or equal to N, it may be determined that traversal is not completed; or if A
is greater than N, it may be determined that traversal is completed.
[0108] Step 404: Write first test data to the storage medium at a first target rate.
[0109] In this embodiment of this application, the storage controller may first detect a
timing margin of a DQ in a read direction. Because the DQ in the read direction is
generated by the storage medium based on the data written by the storage controller,
to ensure reliability of detection, it needs to be ensured that the data written by
the storage controller to the storage medium is accurate. Therefore, in this embodiment
of this application, the storage controller may write the first test data to the storage
medium at a relatively low data transmission rate. The first test data may be data
prestored in the storage controller, and may be data customized by the developer.
[0110] Optionally, the storage controller may first determine a working mode of an interface
bus between the storage controller and the storage medium, and then determine, based
on a prestored correspondence between a working mode and a bus rate range, a bus rate
range corresponding to the working mode of the interface bus. Then a lower limit rate
within the determined bus rate range may be used as the first target rate for writing
the first test data. For example, assuming that the interface bus is an NFI bus, and
as shown in Table 1, working modes of the NFI bus may include a single rate (single
data rate, SDR) mode, a non-volatile dual data rate (non-volatile dual data rate,
NV-DDR) mode, an NV-DDR2 (second-generation NV-DDR) mode, and an NV-DDR3 (third-generation
NV-DDR) mode. A bus rate range corresponding to the SDR mode is 10 to 50 million bits
per second (million bits per second, Mbps), and a bus rate range corresponding to
the NV-DDR mode is 40 to 200 Mbps.
Table 1
| Working mode |
Bus rate range (Mbps) |
| SDR |
10 to 50 |
| NV-DDR |
40 to 200 |
| NV-DDR2 |
66 to 800 |
| NV-DDR3 |
66 to 1200 |
[0111] If the storage controller determines that the current working mode of the NFI bus
is the NV-DDR mode, the storage controller may determine that the first target rate
is 40 Mbps, and may write the first test data to the storage medium at the data transmission
rate of 40 Mbps.
[0112] It is assumed that the NFI bus includes eight lines, and the eight lines can transmit
data of eight bits (that is, one byte) in parallel each time. As shown in Table 2,
the first test data may include four bytes: a BYTE0 to a BYTE3, and the four bytes
may be represented by 0x5AA55AA5 in hexadecimal (hexadecimal, Hex) notation. The first
byte BYTE0 and the third byte BYTE2 are both 5A, and the second byte BYTE1 and the
fourth byte BYTE3 are both A5. When the first byte BYTE0 is transmitted in parallel,
binary (binary, Bin) data carried in eight DQs, that is, a DQ0 to a DQ7, transmitted
by the eight lines in parallel may be 0, 1, 0, 1, 1, 0, 1, and 0 respectively. When
the first byte BYTE1 is transmitted in parallel, binary data carried in eight DQs,
that is, the DQ0 to the DQ7, transmitted by the eight lines in parallel may be 1,
0, 1, 0, 0, 1, 0, and 1 respectively.
Table 2
| Data |
BYTE0 |
BYTE1 |
BYTE2 |
BYTE3 |
| Hex |
Bin |
Hex |
Bin |
Hex |
Bin |
Hex |
Bin |
| DQ0 |
5 |
0 |
A |
1 |
5 |
0 |
A |
1 |
| DQ1 |
1 |
0 |
1 |
0 |
| DQ2 |
0 |
1 |
0 |
1 |
| DQ3 |
1 |
0 |
1 |
0 |
| DQ4 |
A |
1 |
5 |
0 |
A |
1 |
5 |
0 |
| DQ5 |
0 |
1 |
0 |
1 |
| DQ6 |
1 |
0 |
1 |
0 |
| DQ7 |
0 |
1 |
0 |
1 |
[0113] FIG. 10 is a schematic structural diagram of a storage medium according to an embodiment
of this application. As shown in FIG. 10, the storage medium may further include a
control logic (control logic) circuit 022, an address register (address register)
023, a status register (status register) 024, a command register (command register)
025, a flash array (flash array) 026, a data register (data register) 027, and a cache
register (cache register) 028. The storage controller 01 may write the first test
data to the cache register 028. In addition, a length of the written first test data
may not be greater than a length of a flash page (page).
[0114] Step 405: Transmit, to the storage medium, an instruction for reading the first test
data.
[0115] The read instruction may be used to instruct the storage medium to transmit the first
test data to the storage controller.
[0116] Step 406: Receive a first DQ carrying the first test data, and a first DQS that are
transmitted by the storage medium. In this embodiment of this application, the storage
medium may generate, in response to the read instruction, the first DQ carrying the
first test data, and the first DQS. The first DQ may include a plurality of DQs, for
example, may include eight DQs, where edges of the plurality of DQs are aligned, and
an edge of the first DQS is also aligned with the edges of the plurality of the DQs.
[0117] Step 407: Within a range of a plurality of reference moments included in a reference
moment set, adjust a moment of the edge of the first DQS, and detect whether a bit
error exists in data obtained by decoding the first DQ based on the current reference
voltage and the first DQS after the timing adjustment, to determine a start boundary
moment and an end boundary moment of a timing margin of the first DQ separately from
the plurality of reference moments.
[0118] The start boundary moment is an earliest reference moment that enables the data obtained
by decoding to be free of bit errors, in the plurality of reference moments, and the
end boundary moment is a latest reference moment that enables the data obtained by
decoding to be free of bit errors, in the plurality of reference moments.
[0119] FIG. 11 is a flowchart of a method for determining a start boundary moment of a timing
margin of a first DQ according to an embodiment of this application. Referring to
FIG. 11, the method may include the following steps.
[0120] Step 4071a: Adjust the moment of the edge of the first DQS to a first target reference
moment in the plurality of reference moments.
[0121] Optionally, the plurality of reference moments included in the reference moment set
may be arranged in ascending order, the first target reference moment may be an X
th reference moment in the plurality of reference moments, X is a positive integer less
than M/2, and M is a total quantity of reference moments included in the reference
moment set. To be specific, the first target reference moment may be a relatively
early reference moment in the plurality of reference moments, for example, may be
the earliest reference moment, that is, X may be equal to 1. The first target reference
moment may be used as an initial start boundary moment. In this embodiment of this
application, the plurality of reference moments may be obtained by dividing a cycle
of the DQS. If a time difference between two adjacent reference moments is fixed,
that is, a time scale unit is fixed, when the data transmission rate of the interface
bus is higher, the cycle of the DQS is shorter, and fewer reference moments are included
in the reference moment set. For example, assuming that the data transmission rate
of the NFI bus is 400 Mbps, the cycle of the DQS is 2.5 nanoseconds (ns). The cycle
of 2.5 ns may be divided into 320 reference moments, and the first target reference
moment may be a 24
th reference moment, that is, a reference moment 24. Certainly, the first target reference
moment may also be a first reference moment, that is, a reference moment 1.
[0122] Step 4072a: Detect whether a bit error exists in data obtained by decoding the first
DQ based on the current reference voltage and the first DQS after the adjustment.
[0123] In this embodiment of this application, based on the current reference voltage provided
by the reference power source VREF and the first DQS after the timing adjustment,
the storage controller may decode the plurality of DQs included in the first DQ, and
detect whether a bit error exists in data obtained by decoding the plurality of DQs
included in the first DQ. If a bit error exists in data obtained by decoding any DQ
in the first DQ, the storage controller may perform step 4073a. If no bit error exists
in data obtained by decoding each DQ in the first DQ, the storage controller may perform
step 4074a.
[0124] For example, it is assumed that the first test data written by the storage controller
to the storage medium is "01011010", and data obtained by the storage controller by
decoding eight DQs included in the first DQ, that is, the DQ0 to the DQ7, is "11011010".
In this case, because a bit error exists in the data obtained by decoding, the storage
controller may perform step 4073a.
[0125] Step 4073a: Set forward the moment of the edge of the first DQS by a first step length.
Then step 4072a is performed. In this embodiment of this application, if a bit error
exists in the data obtained by decoding the first DQ based on the current reference
voltage and the first DQS after the adjustment, the storage controller may determine
that the moment of the edge of the first DQS is beyond the range of the timing margin
of the first DQ, and therefore may set forward the moment of the edge of the first
DQS by using the first step length as a unit, that is, may adjust a timing of the
first DQS rightward. Then the storage controller may continue to perform step 4072a.
To be specific, the storage controller may adjust the timing of the first DQS rightward
gradually by using the first step length as a unit, until no bit error exists in data
obtained by decoding the first DQ based on the current reference voltage and the first
DQS after the adjustment.
[0126] Step 4074a: Set back the moment of the edge of the first DQS by a second step length,
until a bit error exists in data obtained by decoding based on the current reference
voltage and the first DQS after the adjustment.
[0127] If no bit error exists in the data obtained by decoding the first DQ based on the
current reference voltage and the first DQS after the adjustment, the storage controller
may determine that the moment of the edge of the first DQS is within the range of
the timing margin of the first DQ, and therefore may set back the moment of the edge
of the first DQS gradually by using the second step length as a unit, that is, may
adjust the timing of the first DQS leftward. The second step length may be equal to
a time difference between two adjacent reference moments. The first step length may
be greater than the second step length and may be an integer multiple of the second
step length. To be specific, the second step length may be equal to a scale unit in
division of the reference moments, and the first step length may be several times
the scale unit. For example, the first step length may be 8 times the second step
length.
[0128] Step 4075a: Determine a reference moment next to the moment of the edge of the first
DQS after the adjustment as the start boundary moment of the timing margin of the
first DQ.
[0129] When detecting that a bit error exists in the data obtained by decoding based on
the current reference voltage and the first DQS after the adjustment, the storage
controller may determine that the reference moment (that is, the moment of the edge
of the first DQS before the adjustment) next to the current moment of the edge of
the first DQS is the earliest reference moment that enables the data obtained by decoding
to be free of bit errors, in the plurality of reference moments, that is, the next
reference moment is the start boundary moment of the timing margin of the first DQ.
[0130] For example, referring to FIG. 12, the storage controller may first coarsely adjust
the moment of the edge of the first DQS rightward by using the first step length K
as a unit, and then finely adjust the moment of the edge of the first DQS leftward
by using the second step length 1 as a unit, until the storage controller determines
the earliest reference moment that enables all data obtained by decoding the DQ0 to
the DQ7 to be free of bit errors.
[0131] FIG. 13 is a flowchart of a method for determining an end boundary moment of a timing
margin of a first DQ according to an embodiment of this application. Referring to
FIG. 13, the method may include the following steps.
[0132] Step 4071b: Adjust the moment of the edge of the first DQS to a second target reference
moment in the plurality of reference moments.
[0133] Optionally, the second target reference moment may be a Y
th reference moment in the plurality of reference moments, and Y is a positive integer
greater than M/2. To be specific, the second target reference moment may be a relatively
late reference moment in the plurality of reference moments, for example, may be the
latest reference moment. The second target reference moment is an initial end boundary
moment.
[0134] For example, assuming that the data transmission rate of the NFI bus is 400 Mbps,
a cycle of the DQS is 2.5 ns. The cycle of 2.5 ns may be divided into 320 reference
moments. The first target reference moment may be a 24
th reference moment, and the second target reference moment may be a 320
th reference moment, that is, a reference moment 320. Step 4072b: Detect whether a bit
error exists in data obtained by decoding the first DQ based on the current reference
voltage and the first DQS after the adjustment.
[0135] If a bit error exists, the storage controller may perform step 4073b. If no bit error
exists, the storage controller may perform step 4074b.
[0136] Step 4073b: Set back the moment of the edge of the first DQS by a first step length.
Then step 4072b is performed.
[0137] If a bit error exists in the data obtained by decoding the first DQ based on the
current reference voltage and the first DQS after the adjustment, the storage controller
may determine that the moment of the edge of the first DQS is beyond the range of
the timing margin of the first DQ, and therefore may set back the moment of the edge
of the first DQS gradually by using the first step length as a unit, that is, may
adjust a timing of the first DQS leftward. Then the storage controller may continue
to perform step 4072b. To be specific, the storage controller may adjust the timing
of the first DQS leftward gradually by using the first step length as a unit, until
no bit error exists in data obtained by decoding based on the current reference voltage
and the first DQS after the adjustment.
[0138] Step 4074b: Set forward the moment of the edge of the first DQS by a second step
length, until a bit error exists in data obtained by decoding based on the current
reference voltage and the first DQS after the adjustment.
[0139] If no bit error exists in the data obtained by decoding the first DQ based on the
current reference voltage and the first DQS after the adjustment, the storage controller
may determine that the moment of the edge of the first DQS is within the range of
the timing margin of the first DQ, and therefore may set forward the moment of the
edge of the first DQS gradually by using the second step length as a unit, that is,
may adjust the timing of the first DQS rightward.
[0140] Step 4075b: Determine a reference moment previous to the moment of the edge of the
first DQS after the adjustment as the end boundary moment of the first DQ.
[0141] The second step length may be equal to a time difference between two adjacent reference
moments. The first step length may be greater than the second step length and may
be an integer multiple of the second step length. For example, referring to FIG. 14,
the storage controller may first coarsely adjust the moment of the edge of the first
DQS leftward by using the first step length K as a unit, so that the moment of the
edge of the first DQS is within the range of the timing margin of the first DQ, and
then finely adjust the moment of the edge of the first DQS rightward by using the
second step length 1 as a unit, until the storage controller determines the latest
reference moment that enables all data obtained by decoding the DQ0 to the DQ7 to
be free of bit errors.
[0142] As can be learned from the foregoing procedure for determining the start boundary
moment and the end boundary moment, if a bit error exists in the data obtained by
decoding the first DQ based on the current reference voltage and the first DQS after
the adjustment, the storage controller may coarsely adjust the timing of the first
DQS by using the first step length, until the moment of the edge of the first DQS
is within the range of the timing margin of the first DQ. Then the storage controller
may finely adjust the timing of the first DQS by using the second step length, and
therefore accurately determine the start boundary moment and the end boundary moment
of the timing margin of the first DQ.
[0143] The foregoing adjustment manner can effectively improve efficiency of determining
the boundary moment of the timing margin.
[0144] FIG. 15 is a flowchart of an algorithm for determining a start boundary moment of
a timing margin of a first DQ according to an embodiment of this application. The
algorithm is described by using an example in which a first target reference moment
is a, a second target reference moment is b, a first step length is K, and a second
step length is 1. Referring to FIG. 15, the algorithm may include the following steps.
[0145] Step 4071c: Adjust the moment dly of the edge of the first DQS to the first target
reference moment a, and set an initial value of a flag bit F to 0. Then step 4072c
is performed.
[0146] The flag bit F may be used to indicate whether the moment dly of the edge of the
first DQS before the adjustment is within the range of the timing margin of the first
DQ. F = 0 indicates that the moment dly of the edge of the first DQS before the adjustment
is not within the range of the timing margin of the first DQ. F = 1 indicates that
the moment dly of the edge of the first DQS before the adjustment is within the range
of the timing margin of the first DQ. For example, assuming a = 24, the storage controller
may adjust a timing of the first DQS, so that the edge of the first DQS is aligned
with a reference moment 24, that is, dly = a = 24.
[0147] Step 4072c: Sample the first DQ based on a current reference voltage and the first
DQS after the adjustment. Then step 4073c is performed.
[0148] Step 4073c: Detect whether a bit error exists in data obtained by decoding the first
DQ.
[0149] After obtaining a sampled voltage by sampling the first DQ, the storage controller
may decide the sampled voltage by using the voltage currently provided by the reference
power source VREF as a decision level, and therefore obtain, by decoding the first
DQ, data carried in the first DQ. If the storage controller detects that a bit error
exists in the data obtained by decoding, the storage controller may determine that
the current moment dly of the edge of the first DQS is not within the range of the
timing margin of the first DQ. Therefore, the storage controller may continue to determine
whether the moment dly of the edge of the first DQS before the adjustment is within
the range of the timing margin of the first DQ, that is, perform step 4074c. If the
storage controller detects that no bit error exists in the data obtained by decoding,
the storage controller may determine that the current moment dly of the edge of the
first DQS is within the range of the timing margin of the first DQ. Therefore, the
storage controller may continue to finely adjust the timing of the first DQS, that
is, perform step 4077c.
[0150] Step 4074c: Detect whether the flag bit F is equal to 1. If F is not equal to 1,
step 4075c is performed; or if F is equal to 1, step 4079c is performed.
[0151] Step 4075c: Adjust the moment dly of the edge of the first DQS to dly + K. Then step
4076c is performed.
[0152] If the storage controller detects, in the foregoing step 4074c, that F is not equal
to 1, it may be determined that the current moment dly of the edge of the first DQS
is not within the range of the timing margin of the first DQ, and that the moment
dly of the edge of the first DQS before the adjustment is not within the range of
the timing margin of the first DQ either. Therefore, the moment of the edge of the
first DQS may be first coarsely adjusted by using a first step length K as a unit.
For example, assuming that a bit error exists in sampled data obtained by sampling
the first DQ when K = 8 and the moment dly of the edge of the first DQS is equal to
24, the storage controller may coarsely adjust the timing of the first DQS rightward,
so that the moment dly of the edge of the first DQS is updated to dly = 24 + 8 = 32.
[0153] Step 4076c: Detect whether the moment dly of the edge of the first DQS after the
adjustment is later than the latest reference moment c in the reference moment set.
[0154] If dly > c, the storage controller may determine that the moment dly of the edge
of the first DQS after the adjustment is beyond the preset reference moment set, that
is, the first step length K is set to be excessively great. In this case, the storage
controller may report an error (Error), and may readjust the first step length K.
If dly ≤ c, the storage controller may continue to perform the foregoing step 4072c,
that is, continue to sample the first DQ based on the current reference voltage and
the first DQS after the adjustment, and determine whether a bit error exists in the
data obtained by decoding. For example, assuming c = 320, because the updated dly
is equal to 32, which is earlier than the latest reference moment c, the storage controller
may continue to perform step 4072c. If the first step length K = 300, because the
updated dly = 24 + 300 = 324, which is later than the latest reference moment c, the
storage controller may report an error.
[0155] Step 4077c: Update the flag bit F to 1. Then step 4078c is performed.
[0156] If the storage controller detects, in the foregoing step 4073c, that no bit error
exists in the data obtained by decoding, it may be determined that the current moment
dly of the edge of the first DQS is within the range of the timing margin of the first
DQ. Therefore, the flag bit F may be updated to 1.
[0157] Step 4078c: Adjust the moment dly of the edge of the first DQS to dly - 1. Then step
4072c is performed.
[0158] After determining that the current moment dly of the edge of the first DQS is within
the range of the timing margin of the first DQ, the storage controller may finely
adjust the moment dly of the edge of the first DQS by using the second step length
1 as a unit. Then step 4072c continues to be performed. For example, assuming that
no bit error exists in the data obtained by decoding the first DQ at the moment dly
= 32 of the edge of the first DQS, the storage controller may determine that a left
boundary of the first DQ is between 24 and 32. Therefore, the storage controller may
update F to 1, and continue to finely adjust the moment of the edge of the first DQS
leftward by using the first step length 1. Step 4079c: Determine the start boundary
moment of the timing margin of the first DQ: L_dly = dly + 1.
[0159] If the storage controller determines, in the foregoing step 4074c, that the flag
bit F is equal to 1, it may be determined that the current moment dly of the edge
of the first DQS is not within the range of the timing margin of the first DQ, and
that the moment dly of the edge of the first DQS before the adjustment is within the
range of the timing margin of the first DQ. Therefore, it may be determined that the
moment dly of the edge of the first DQS before the adjustment is the start boundary
moment. Therefore, the start boundary moment L dly may be determined as L dly = dly
+ 1. For example, it is assumed that after the foregoing steps 4072c, 4073c, 4077c,
and 4078c are performed repeatedly for a plurality of times, the storage controller
adjusts the moment dly of the edge of the first DQS to dly = 28 gradually by using
the second step length 1 as a unit. If it is detected that a bit error exists in the
data obtained by decoding the first DQ in this case, because the current flag bit
F = 1, the storage controller may determine that the moment dly of the edge of the
first DQS before the adjustment (that is, when dly = 29) is within the range of the
timing margin of the first DQ, and therefore may determine that the moment dly of
the edge of the first DQS before the adjustment is the start boundary moment L dly
of the timing margin of the first DQ, that is, may determine L dly = 28 + 1 = 29.
FIG. 16 is a flowchart of an algorithm for determining an end boundary moment of a
timing margin of a first DQ according to an embodiment of this application. The algorithm
is described by using an example in which a first target reference moment is a, a
second target reference moment is b, a first step length is K, and a second step length
is 1. Referring to FIG. 16, the algorithm may include the following steps.
[0160] Step 4071d: Adjust the moment dly of the edge of the first DQS to the second target
reference moment b, and set an initial value of a flag bit F to 0. Then step 4072d
is performed.
[0161] The flag bit F may be used to indicate whether the moment dly of the edge of the
first DQS before the adjustment is within the range of the timing margin of the first
DQ. F = 0 indicates that the moment dly of the edge of the first DQS before the adjustment
is not within the range of the timing margin of the first DQ. F = 1 indicates that
the moment dly of the edge of the first DQS before the adjustment is within the range
of the timing margin of the first DQ. For example, assuming b = 320, the storage controller
may adjust a timing of the first DQS, so that the edge of the first DQS is aligned
with a reference moment 320, that is, dly = b = 320.
[0162] Step 4072d: Sample the first DQ based on a current reference voltage and the first
DQS after the adjustment. Then step 4073d is performed.
[0163] Step 4073d: Detect whether a bit error exists in data obtained by decoding the first
DQ.
[0164] After obtaining a sampled voltage by sampling the first DQ, the storage controller
may decide the sampled voltage by using the voltage provided by the reference power
source VREF as a decision level, and therefore obtain, by decoding the first DQ, data
carried in the first DQ.
[0165] If the storage controller detects that a bit error exists in the data obtained by
decoding, the storage controller may determine that the current moment dly of the
edge of the first DQS is not within the range of the timing margin of the first DQ.
Therefore, the storage controller may continue to determine whether the moment dly
of the edge of the first DQS before the adjustment is within the range of the timing
margin of the first DQ, that is, perform step 4074d.
[0166] If the storage controller detects that no bit error exists in the data obtained by
decoding, the storage controller may determine that the current moment dly of the
edge of the first DQS is within the range of the timing margin of the first DQ. Therefore,
the storage controller may continue to finely adjust the timing of the first DQS,
that is, perform step 4077d.
[0167] Step 4074d: Detect whether the flag bit F is equal to 1. If F is not equal to 1,
step 4075d is performed; or if F is equal to 1, step 4079d is performed.
[0168] Step 4075d: Adjust the moment dly of the edge of the first DQS to dly - K. Then step
4076d is performed.
[0169] If the storage controller detects, in the foregoing step 4074d, that F is not equal
to 1, it may be determined that the current moment dly of the edge of the first DQS
is not within the range of the timing margin of the first DQ, and that the moment
dly of the edge of the first DQS before the adjustment is not within the range of
the timing margin of the first DQ either. Therefore, the moment of the edge of the
first DQS may be first coarsely adjusted by using the first step length K as a unit.
For example, assuming that a bit error exists in sampled data obtained by sampling
the first DQ when K = 8 and the moment dly of the edge of the first DQS is equal to
320, the storage controller may coarsely adjust the timing of the first DQS leftward,
so that the moment dly of the edge of the first DQS is updated to: dly = 320 - 8 =
312.
[0170] Step 4076d: Detect whether the moment dly of the edge of the first DQS after the
adjustment is earlier than the earliest reference moment d in the reference moment
set.
[0171] If dly < d, the storage controller may determine that the moment dly of the edge
of the first DQS after the adjustment is beyond the preset reference moment set, that
is, the first step length K is set to be excessively great. In this case, the storage
controller may report an error (Error), and may readjust the first step length K.
If dly ≥ d, the storage controller may continue to perform the foregoing step 4072d,
that is, continue to sample the first DQ based on the current reference voltage and
the first DQS after the adjustment, and determine whether a bit error exists in the
data obtained by decoding. For example, assuming d = 20, because the updated dly is
equal to 312, which is later than the earliest reference moment d, the storage controller
may continue to perform step 4072d. If the first step length K = 310, because the
updated dly = 320 - 310 = 10, which is earlier than the earliest reference moment
d, the storage controller may report an error.
[0172] Step 4077d: Update the flag bit F to 1. Then step 4078d is performed.
[0173] If the storage controller detects, in the foregoing step 4073d, that no bit error
exists in the data obtained by decoding, it may be determined that the current moment
dly of the edge of the first DQS is within the range of the timing margin of the first
DQ. Therefore, the flag bit F may be updated to 1.
[0174] Step 4078d: Adjust the moment dly of the edge of the first DQS to dly + 1. Then step
4072d is performed.
[0175] After determining that the current moment dly of the edge of the first DQS is within
the range of the timing margin of the first DQ, the storage controller may finely
adjust the moment dly of the edge of the first DQS by using the second step length
1 as a unit. Then step 4072d continues to be performed. For example, assuming that
after the storage controller adjusts the moment dly of the edge of the first DQS to
dly = 304 by performing step 4075b twice, no bit error exists in the data obtained
by decoding the first DQ, the storage controller may determine that a left boundary
of the first DQ is between 304 and 312. Therefore, the storage controller may update
F to 1, and continue to finely adjust the moment of the edge of the first DQS rightward
by using the first step length 1.
[0176] Step 4079d: Determine the end boundary moment of the timing margin of the first DQ:
L_dly = dly - 1.
[0177] If the storage controller determines, in the foregoing step 4074d, that the flag
bit F is equal to 1, it may be determined that the current moment dly of the edge
of the first DQS is not within the range of the timing margin of the first DQ, and
that the moment dly of the edge of the first DQS before the adjustment is within the
range of the timing margin of the first DQ. Therefore, it may be determined that the
moment dly of the edge of the first DQS before the adjustment is the end boundary
moment. Therefore, the end boundary moment L dly may be determined as L dly = dly
- 1. For example, it is assumed that after the foregoing steps 4072d, 4073d, 4077d,
and 4078d are performed repeatedly for a plurality of times, the storage controller
adjusts the moment dly of the edge of the first DQS to dly = 308 gradually by using
the second step length 1 as a unit. If it is detected that a bit error exists in the
data obtained by decoding the first DQ in this case, because the current flag bit
F = 1, the storage controller may determine that the moment dly of the edge of the
first DQS before the adjustment (that is, when dly = 307) is within the range of the
timing margin of the first DQ, and therefore may determine that the moment dly of
the edge of the first DQS before the adjustment is the end boundary moment L_dly of
the timing margin of the first DQ, that is, may determine L dly = 308 - 1 = 307. After
the timing margin of the first DQ in the read direction is detected by using the method
shown in the foregoing step 407, the storage controller may calibrate a related parameter
of the storage device based on the timing margin of the first DQ, to ensure that the
timing margin of the DQ in the read direction can ensure correct decoding of the data,
that is, ensure that the storage controller can correctly read the data.
[0178] In the process of determining the margins of the DQ, if the storage controller first
fixes the moment of the edge of the DQS to a reference moment and then detects a voltage
margin of the DQ at the reference moment, when the storage controller determines a
start boundary voltage of the voltage margin, the storage controller may also determine
the start boundary voltage by referring to the method shown in step 4071a to step
4075a or the method shown in step 4071c to step 4079c. When the storage controller
determines an end boundary voltage of the voltage margin, the storage controller may
also determine the end boundary voltage by referring to the method shown in step 4071b
to 4075b or the method shown in step 4071d to step 4079d. Details are not described
again herein in this embodiment of this application.
[0179] Step 408: Write second test data to the storage medium at a second target rate.
[0180] After the timing margin of the first DQ in the read direction is detected, the storage
controller may continue to detect a timing margin of a DQ in a write direction. In
this embodiment of this application, the storage controller may first determine a
current data transmission rate when the NFI bus works normally, and then may write
the second test data to the storage medium by using the data transmission rate during
normal working as the second target rate. The second test data may also be data prestored
in the storage controller, and may be data customized by the developer. In addition,
the second test data may be the same as or different from the first test data.
[0181] Step 409: Transmit, to the storage medium, an instruction for reading the second
test data.
[0182] Step 410: Receive a second DQ carrying the second test data, and a second DQS that
are transmitted by the storage medium.
[0183] Step 411: Within the range of the plurality of reference moments included in the
reference moment set, adjust a moment of an edge of the second DQS, and detect whether
a bit error exists in data obtained by decoding the second DQ based on the current
reference voltage and the second DQS after the adjustment, to determine a start boundary
moment and an end boundary moment of a timing margin of the second DQ separately from
the plurality of reference moments. Then step 402 is performed.
[0184] Because after the foregoing step 407, a parameter-based adjustment operation can
ensure reliability of the training data read by the storage controller, the storage
controller can detect, by using the read training data, whether a bit error exists
in the written second training data. To be specific, the storage controller may detect
whether a bit error exists in the data obtained by decoding the second DQ, and implement
detection of the timing margin of the DQ in the write direction. For the process of
detecting the timing margin of the second DQ shown in step 408 to step 411, refer
to the process of detecting the timing margin of the first DQ shown in step 404 to
step 407. Details are not described again herein.
[0185] After determining the timing margin of the second DQ, the storage controller may
continue to perform step 402, that is, continue to adjust the voltage of the reference
power source VREF and continue to detect timing margins of the first DQ and the second
DQ, until the voltage of the reference power source VREF traverses the reference voltage
set. After the voltage of the reference power source VREF traverses the reference
voltage set, the storage controller may obtain the timing margin of the first DQ (that
is, the DQ in the read direction) and the timing margin of the second DQ (that is,
the DQ in the write direction) corresponding to each reference voltage in the reference
voltage set.
[0186] Step 412: Generate a schematic diagram of two-dimensional margins of the first DQ
and a schematic diagram of two-dimensional margins of the second DQ separately.
[0187] A horizontal axis of the schematic diagram of the two-dimensional margins may be
used to indicate the moment of the edge of the DQS, a vertical axis may be used to
indicate the voltage of the reference power source VREF, and different graphical symbols
may be used at each coordinate point in the schematic diagram to indicate whether
a bit error exists in data obtained by decoding at the coordinate point. For example,
assuming that the reference voltage set includes 35 reference voltages, that is, V1
to V35, the schematic diagram of the two-dimensional margins of the first DQ that
is generated by the storage controller may be shown in FIG. 17. In the schematic diagram,
"
∗" is used to indicate that no bit error exists in the data obtained by decoding, and
"-" is used to indicate that a bit error exists in the data obtained by decoding.
As can be seen with reference to FIG. 17, when the voltage of the reference power
source VREF is a reference voltage V19, the range of the timing margin of the first
DQ is the largest.
[0188] Because the storage controller 01 may be connected to a plurality of storage media
02 by using a plurality of NFI buses 03, in the foregoing step 401, the storage controller
may detect physical parameters of each NFI bus 03 and a storage medium 02 connected
to each NFI bus 03, and perform detection on a storage medium 02 that meets the detection
trigger condition. Normal reading and writing can be performed on other storage media
02 that do not meet the detection trigger condition, to ensure non-interruption of
a service.
[0189] Order of steps of the method for detecting margins of a DQ according to this embodiment
of this application may be properly adjusted, and steps may also be correspondingly
added or deleted according to a situation. For example, step 412 may be deleted according
to a situation. Alternatively, step 408 to step 411 may be performed after step 412.
To be specific, the schematic diagram of the two-dimensional margins of the first
DQ may be first generated, and then step 402, step 403, and step 408 to step 412 are
performed to generate the schematic diagram of the two-dimensional margins of the
second DQ. Alternatively, if only the two-dimensional margins of the first DQ are
detected, step 404 may also be performed before step 402. Likewise, if only the two-dimensional
margins of the second DQ are detected, step 408 may also be performed before step
402. Any variation of the method readily figured out by a person skilled in the art
within the technical scope disclosed in this application shall fall within the protection
scope of this application. Therefore, details are not described herein.
[0190] As described above, this embodiment of this application provides a method for detecting
margins of a data signal. A receive end of the DQ may automatically detect the timing
margin and voltage margin of the DQ by adjusting the voltage of the reference power
source and the timing of the DQS. In the detection process, no other external detection
device needs to be connected, and no parameter needs to be manually adjusted. Therefore,
detection efficiency is effectively improved, and detection costs are reduced. In
addition, because the timing margin and the voltage margin are determined by the storage
controller based on whether a bit error exists in data actually obtained by decoding,
reliability of the detection result can be ensured.
[0191] FIG. 18 is a structural block diagram of an apparatus for detecting margins of a
data signal according to an embodiment of this application. The apparatus may be configured
at a receive end of a data signal in a storage device. For example, referring to FIG.
1, the apparatus may be configured in the storage controller 01. As shown in FIG.
18, the apparatus may include a detection module 501. The detection module 501 may
be configured to implement the method shown in step 101 to step 103 in the foregoing
method embodiment. FIG. 19 is a schematic structural diagram of a detection module
according to an embodiment of this application. As shown in FIG. 19, the detection
module 501 may include:
a first adjustment submodule 5011, which may be configured to implement the method
shown in step 201 or step 402 in the foregoing method embodiment;
a first determining submodule 5012, which may be configured to implement the method
shown in step 204 and step 206, or step 407 and step 411 in the foregoing method embodiment;
and
a first detection submodule 5013, configured to instruct the first adjustment submodule
5011 and the first determining submodule 5012 to repeat the operations of adjusting
the voltage and determining the timing margin, until the voltage of the reference
power source traverses the reference voltage set, where for function implementation
of the first detection submodule 5013, reference may be made to related descriptions
of step 202 or step 403 in the foregoing method embodiment.
[0192] Optionally, the first determining submodule 5012 may be configured to implement the
method shown in step 4071a to step 4075a in the foregoing method embodiment, the method
shown in step 4071b to step 4075b in the foregoing method embodiment, the method shown
in step 4071c to step 4079c in the foregoing method embodiment, and the method shown
in step 4071d to step 4079d in the foregoing method embodiment.
[0193] FIG. 20 is a schematic structural diagram of another detection module according to
an embodiment of this application. As shown in FIG. 20, the detection module 501 may
include:
a second adjustment submodule 5014, configured to adjust the moment of the edge of
the data strobe signal transmitted by the storage medium, to one reference moment
in the plurality of reference moments, where for function implementation of the second
adjustment submodule 5014, reference may be made to related descriptions of step 302
and step 308 in the foregoing method embodiment;
a second determining submodule 5015, configured to: within a range of the plurality
of reference voltages included in the reference voltage set, adjust the voltage of
the reference power source, and detect whether a bit error exists in data obtained
by decoding, based on the current reference moment and the voltage of the reference
power source after the adjustment, the data signal transmitted by the storage medium,
to obtain a start boundary voltage and an end boundary voltage of the voltage margin
of the data signal, where the start boundary voltage is a lowest reference voltage
that enables the data obtained by decoding to be free of bit errors, in the plurality
of reference voltages, and the end boundary voltage is a highest reference voltage
that enables the data obtained by decoding to be free of bit errors, in the plurality
of reference voltages; and
for function implementation of the second determining submodule 5015, reference may
be made to related descriptions of step 304 and step 310 in the foregoing method embodiment;
and
a second detection submodule 5016, configured to instruct the second adjustment submodule
5014 and the second determining submodule 5015 to repeat the operations of adjusting
the moment and determining the voltage margin, until the moment of the edge of the
data strobe signal traverses the reference moment set, where for function implementation
of the second detection submodule 5016, reference may be made to related descriptions
of step 303 and step 309 in the foregoing method embodiment.
[0194] Optionally, the receive end may be the storage controller, the transmit end may be
the storage medium, and the storage controller is connected to the storage medium
by using an interface bus. Referring to FIG. 18, the apparatus may further include:
a writing module 502, which may be configured to implement the method shown in step
203 and step 205, or step 301 and step 307, or step 404 and step 408 in the foregoing
method embodiment;
a transmission module 503, which may be configured to implement the method shown in
step 405 and step 409 in the foregoing method embodiment; and
a receiving module 504, which may be configured to implement the method shown in step
406 and step 410 in the foregoing method embodiment.
[0195] Optionally, for function implementation of the detection module 501, reference may
be made to related descriptions of step 401 in the foregoing method embodiment.
[0196] As described above, this embodiment of this application provides an apparatus for
detecting margins of a data signal. The apparatus may automatically detect the timing
margin and voltage margin of the DQ by adjusting the voltage of the reference power
source and the timing of the DQS. In the detection process, no other external detection
device needs to be connected, and no parameter needs to be manually adjusted. Therefore,
detection efficiency is effectively improved, and detection costs are reduced. In
addition, because the timing margin and the voltage margin are determined by the storage
controller based on whether a bit error exists in data actually obtained by decoding,
reliability of the detection result can be ensured.
[0197] It may be clearly understood by a person skilled in the art that, for the purpose
of convenient and brief description, for a detailed working process of the foregoing
apparatus and module, refer to a corresponding process in the foregoing method embodiment,
and details are not described again herein.
[0198] It should be understood that the apparatus for detecting margins of a data signal
in this embodiment of this application may be further implemented by using an application-specific
integrated circuit (application-specific integrated circuit, ASIC), or implemented
by using a programmable logic device (programmable logic device, PLD). The PLD may
be a complex programmable logical device (complex programmable logical device, CPLD),
a field programmable gate array (field programmable gate array, FPGA), generic array
logic (generic array logic, GAL), or any combination thereof. Alternatively, the method
for detecting margins of a DQ according to the foregoing method embodiment may be
implemented by software. When the method for detecting margins of a DQ according to
the foregoing method embodiment is implemented by software, each module in the apparatus
for detecting margins of a data signal may also be a software module.
[0199] FIG. 21 is a structural block diagram of another apparatus for detecting margins
of a data signal according to an embodiment of this application. Referring to FIG.
21, the apparatus may include a processor 1201, a memory 1202, an interface 1203,
and a bus 1204. The bus 1204 is configured to interconnect the processor 1201, the
memory 1202, and the interface 1203. Communications connections with other components
may be implemented by using the interface 1203 (wired or wireless). The memory 1202
stores a computer program 12021, where the computer program 12021 is used to implement
various application functions.
[0200] It should be understood that in this embodiment of this application, the processor
1201 may be a CPU, or the processor 1201 may be another general purpose processor,
a digital signal processor (DSP), an application-specific integrated circuit (ASIC),
a field programmable gate array (FPGA), a GPU, or another programmable logic device,
discrete gate or transistor logic device, discrete hardware component, or the like.
The general purpose processor may be a microprocessor or any conventional processor
or the like.
[0201] The memory 1202 may be a non-volatile memory. The non-volatile memory may be a read-only
memory (read-only memory, ROM), a programmable read-only memory (programmable ROM,
PROM), an erasable programmable read-only memory (erasable PROM, EPROM), an electrically
erasable programmable read-only memory (electrically EPROM, EEPROM), or a flash memory.
[0202] The bus 1204 may further include a power bus, a control bus, a status signal bus,
and the like, in addition to a data bus. However, for clear description, various types
of buses in the figure are marked as the bus 1204.
[0203] The processor 1201 is configured to execute the computer program stored in the memory
1202, and the processor 1201 implements steps in the foregoing method embodiment by
executing the computer program 12021.
[0204] An embodiment of this application further provides a chip. The chip may include a
programmable logic circuit and/or a program instruction, and when the chip runs, the
chip is configured to implement the method for detecting margins of a DQ according
to the foregoing method embodiment.
[0205] An embodiment of this application further provides a computer program product including
an instruction. When the computer program product runs on a processor, the processor
is enabled to perform steps in the foregoing method embodiment.
[0206] An embodiment of this application further provides a storage device. As shown in
FIG. 1, the storage device may include a storage controller 01 and one or more storage
media 02. An IO interface 021 of each storage medium 02 may be connected to one IO
interface 011 of the storage controller 01 by using an NFI bus 03, and a reference
power source VREF of the storage controller 01 may be connected to each storage medium
02. The storage controller 01 and/or the storage medium 02 may include the apparatus
for detecting margins of a DQ according to the foregoing embodiment, or may be a chip
provided by the foregoing embodiment.
[0207] In the embodiments of this application, the term "at least one" indicates one or
more, and the term "a plurality of" indicates two or more. The term "and/or" describes
an association relationship for describing associated objects and represents that
three relationships may exist. For example, A and/or B may represent the following
cases: Only A exists, both A and B exist, and only B exists, where A and B may be
in a singular or plural form. The character "/" generally indicates an "or" relationship
between the associated objects.
[0208] The foregoing descriptions are merely optional embodiments of this application, but
are not intended to limit this application. Any modification, equivalent replacement,
or improvement made without departing from the spirit and principle of this application
should fall within the protection scope of this application.
1. A method for detecting margins of a data signal, applied to a receive end of the data
signal, wherein the method comprises:
adjusting a voltage of a reference power source based on a plurality of reference
voltages comprised in a reference voltage set;
adjusting, based on a plurality of reference moments comprised in a reference moment
set, a moment of an edge of a data strobe signal transmitted by a transmit end of
the data signal; and
for each reference voltage and each reference moment, determining whether a bit error
exists in data obtained by decoding the data signal when the voltage of the reference
power source is the reference voltage and the moment of the edge of the data strobe
signal is the reference moment, to obtain a timing margin of the data signal at each
reference voltage and a voltage margin of the data signal at each reference moment,
wherein
the timing margin is a range of reference moments that enable the data obtained by
decoding to be free of bit errors, in the plurality of reference moments, and the
voltage margin is a range of reference voltages that enable the data obtained by decoding
to be free of bit errors, in the plurality of reference voltages.
2. The method according to claim 1, wherein the receive end comprises a register and
a bleeder circuit, a control end of the bleeder circuit is connected to the register,
and an output end of the bleeder circuit is connected to the reference power source;
and the adjusting a voltage of a reference power source comprises:
adjusting a value of the register, to adjust an output voltage of the bleeder circuit.
3. The method according to claim 1 or 2, wherein the receive end comprises a delay line,
and the delay line is connected to a latch used for latching the data strobe signal
and to an input/output interface of the receive end separately; and the adjusting
a moment of an edge of a data strobe signal transmitted by a transmit end of the data
signal comprises:
adjusting a parameter of the delay line, to adjust the moment of the edge of the data
strobe signal transmitted by the transmit end of the data signal.
4. The method according to any one of claims 1 to 3, wherein the adjusting a voltage
of a reference power source based on a plurality of reference voltages comprised in
a reference voltage set; adjusting, based on a plurality of reference moments comprised
in a reference moment set, a moment of an edge of a data strobe signal transmitted
by a transmit end of the data signal; and for each reference voltage and each reference
moment, determining whether a bit error exists in data obtained by decoding the data
signal when the voltage of the reference power source is the reference voltage and
the moment of the edge of the data strobe signal is the reference moment, to obtain
a timing margin of the data signal at each reference voltage and a voltage margin
of the data signal at each reference moment, comprise:
adjusting the voltage of the reference power source to one reference voltage in the
reference voltage set;
within a range of the plurality of reference moments comprised in the reference moment
set, adjusting the moment of the edge of the data strobe signal transmitted by the
transmit end of the data signal, and detecting whether a bit error exists in data
obtained by decoding the data signal based on the current reference voltage and the
data strobe signal after the adjustment, to determine a start boundary moment and
an end boundary moment of the timing margin of the data signal separately from the
plurality of reference moments; and
repeating the operations of adjusting the voltage and determining the timing margin,
until the voltage of the reference power source traverses the reference voltage set,
wherein
the start boundary moment is an earliest reference moment that enables the data obtained
by decoding to be free of bit errors, in the plurality of reference moments, and the
end boundary moment is a latest reference moment that enables the data obtained by
decoding to be free of bit errors, in the plurality of reference moments.
5. The method according to claim 4, wherein the plurality of reference moments are arranged
in ascending order, and the within a range of the plurality of reference moments comprised
in the reference moment set, adjusting the moment of the edge of the data strobe signal
transmitted by the transmit end of the data signal, and detecting whether a bit error
exists in data obtained by decoding the data signal based on the current reference
voltage and the data strobe signal after the adjustment, to determine a start boundary
moment of the timing margin of the data signal from the plurality of reference moments
comprises:
adjusting the moment of the edge of the data strobe signal transmitted by the transmit
end of the data signal, to a first target reference moment in the plurality of reference
moments, wherein the first target reference moment is an Xth reference moment in the plurality of reference moments, X is a positive integer less
than M/2, and M is a total quantity of reference moments comprised in the reference
moment set;
detecting whether a bit error exists in data obtained by decoding the data signal
based on the current reference voltage and the data strobe signal after the adjustment;
if any bit error exists, setting forward the moment of the edge of the data strobe
signal by a first step length, until no bit error exists in data obtained by decoding
based on the current reference voltage and the data strobe signal after the adjustment;
setting back the moment of the edge of the data strobe signal by a second step length,
until a bit error exists in data obtained by decoding based on the current reference
voltage and the data strobe signal after the adjustment; and
determining a reference moment next to the moment of the edge of the data strobe signal
after the adjustment as the start boundary moment of the timing margin of the data
signal, wherein
the second step length is equal to a time difference between two adjacent reference
moments, and the first step length is greater than the second step length and is an
integer multiple of the second step length.
6. The method according to claim 4, wherein the plurality of reference moments are arranged
in ascending order, and the within a range of the plurality of reference moments comprised
in the reference moment set, adjusting the moment of the edge of the data strobe signal
transmitted by the transmit end of the data signal, and detecting whether a bit error
exists in data obtained by decoding the data signal based on the current reference
voltage and the data strobe signal after the adjustment, to determine an end boundary
moment of the timing margin of the data signal from the plurality of reference moments
comprises:
adjusting the moment of the edge of the data strobe signal transmitted by the transmit
end of the data signal, to a second target reference moment in the plurality of reference
moments, wherein the second target reference moment is a Yth reference moment in the plurality of reference moments, Y is a positive integer greater
than M/2, and M is a total quantity of reference moments comprised in the reference
moment set;
detecting whether a bit error exists in data obtained by decoding the data signal
based on the current reference voltage and the data strobe signal after the adjustment;
if any bit error exists, setting back the moment of the edge of the data strobe signal
by a first step length, until no bit error exists in data obtained by decoding based
on the current reference voltage and the data strobe signal after the adjustment;
setting forward the moment of the edge of the data strobe signal by a second step
length, until a bit error exists in data obtained by decoding based on the current
reference voltage and the data strobe signal after the adjustment; and
determining a reference moment previous to the moment of the edge of the data strobe
signal after the adjustment as the end boundary moment of the timing margin of the
data signal, wherein
the second step length is equal to a time difference between two adjacent reference
moments, and the first step length is greater than the second step length and is an
integer multiple of the second step length.
7. The method according to any one of claims 1 to 3, wherein the adjusting a voltage
of a reference power source based on a plurality of reference voltages comprised in
a reference voltage set; adjusting, based on a plurality of reference moments comprised
in a reference moment set, a moment of an edge of a data strobe signal transmitted
by a transmit end of the data signal; and for each reference voltage and each reference
moment, determining whether a bit error exists in data obtained by decoding the data
signal when the voltage of the reference power source is the reference voltage and
the moment of the edge of the data strobe signal is the reference moment, to obtain
a timing margin of the data signal at each reference voltage and a voltage margin
of the data signal at each reference moment, comprise:
adjusting the moment of the edge of the data strobe signal transmitted by the transmit
end of the data signal, to one reference moment in the plurality of reference moments;
within a range of the plurality of reference voltages comprised in the reference voltage
set, adjusting the voltage of the reference power source, and detecting whether a
bit error exists in data obtained by decoding the data signal based on the current
reference moment and the voltage of the reference power source after the adjustment,
to determine a start boundary voltage and an end boundary voltage of the voltage margin
of the data signal separately from the plurality of reference voltages; and
repeating the operations of adjusting the moment and determining the voltage margin,
until the moment of the edge of the data strobe signal traverses the reference moment
set, wherein
the start boundary voltage is a lowest reference voltage that enables the data obtained
by decoding to be free of bit errors, in the plurality of reference voltages, and
the end boundary voltage is a highest reference voltage that enables the data obtained
by decoding to be free of bit errors, in the plurality of reference voltages.
8. The method according to any one of claims 1 to 7, wherein the receive end is a storage
controller, the transmit end is a storage medium, and the storage controller is connected
to the storage medium by using an interface bus; and before the adjusting a moment
of an edge of a data strobe signal transmitted by a transmit end of the data signal,
the method further comprises:
writing test data to the storage medium at a target rate;
transmitting, to the storage medium, an instruction for reading the test data; and
receiving the data signal carrying the test data, and the data strobe signal that
are transmitted by the storage medium, wherein
the target rate is a working rate of the interface bus or is a lower limit rate within
a bus rate range corresponding to a working mode of the interface bus.
9. The method according to any one of claims 1 to 8, wherein the adjusting a voltage
of a reference power source based on a plurality of reference voltages comprised in
a reference voltage set comprises:
adjusting the voltage of the reference power source in response to a detection instruction
based on the plurality of reference voltages comprised in the reference voltage set;
or
if detecting that a physical parameter of a storage device meets a detection trigger
condition, adjusting the voltage of the reference power source based on the plurality
of reference voltages comprised in the reference voltage set.
10. An apparatus for detecting margins of a data signal, applied to a receive end of the
data signal, wherein the apparatus comprises a detection module; and the detection
module is configured to:
adjust a voltage of a reference power source based on a plurality of reference voltages
comprised in a reference voltage set;
adjust, based on a plurality of reference moments comprised in a reference moment
set, a moment of an edge of a data strobe signal transmitted by a transmit end of
the data signal; and
for each reference voltage and each reference moment, determine whether a bit error
exists in data obtained by decoding the transmitted data signal when the voltage of
the reference power source is the reference voltage and the moment of the edge of
the data strobe signal is the reference moment, to obtain a timing margin of the data
signal at each reference voltage and a voltage margin of the data signal at each reference
moment, wherein
the timing margin is a range of reference moments that enable the data obtained by
decoding to be free of bit errors, in the plurality of reference moments, and the
voltage margin is a range of reference voltages that enable the data obtained by decoding
to be free of bit errors, in the plurality of reference voltages.
11. The apparatus according to claim 10, wherein the receive end comprises a register
and a bleeder circuit, a control end of the bleeder circuit is connected to the register,
and an output end of the bleeder circuit is connected to the reference power source;
and the detection module is configured to:
adjust a value of the register, to adjust an output voltage of the bleeder circuit.
12. The apparatus according to claim 10 or 11, wherein the receive end comprises a delay
line, and the delay line is connected to a latch used for latching the data strobe
signal and to an input/output interface of the receive end separately; and the detection
module is configured to:
adjust a parameter of the delay line, to adjust the moment of the edge of the data
strobe signal transmitted by the transmit end of the data signal.
13. The apparatus according to any one of claims 10 to 12, wherein the detection module
comprises:
a first adjustment submodule, configured to adjust the voltage of the reference power
source to one reference voltage in the reference voltage set;
a first determining submodule, configured to: within a range of the plurality of reference
moments comprised in the reference moment set, adjust the moment of the edge of the
data strobe signal transmitted by the transmit end of the data signal, and detect
whether a bit error exists in data obtained by decoding the data signal based on the
current reference voltage and the data strobe signal after the adjustment, to determine
a start boundary moment and an end boundary moment of the timing margin of the data
signal separately from the plurality of reference moments; and
a first detection submodule, configured to instruct the first adjustment submodule
and the first determining submodule to repeat the operations of adjusting the voltage
and determining the timing margin, until the voltage of the reference power source
traverses the reference voltage set, wherein
the start boundary moment is an earliest reference moment that enables the data obtained
by decoding to be free of bit errors, in the plurality of reference moments, and the
end boundary moment is a latest reference moment that enables the data obtained by
decoding to be free of bit errors, in the plurality of reference moments.
14. The apparatus according to claim 13, wherein the plurality of reference moments are
arranged in ascending order; and the first determining submodule is configured to:
adjust the moment of the edge of the data strobe signal transmitted by the transmit
end of the data signal, to a first target reference moment in the plurality of reference
moments, wherein the first target reference moment is an Xth reference moment in the plurality of reference moments, X is a positive integer less
than M/2, and M is a total quantity of reference moments comprised in the reference
moment set;
detect whether a bit error exists in data obtained by decoding the data signal based
on the current reference voltage and the data strobe signal after the adjustment;
if any bit error exists, set forward the moment of the edge of the data strobe signal
by a first step length, until no bit error exists in data obtained by decoding based
on the current reference voltage and the data strobe signal after the adjustment;
set back the moment of the edge of the data strobe signal by a second step length,
until a bit error exists in data obtained by decoding based on the current reference
voltage and the data strobe signal after the adjustment; and
determine a reference moment next to the moment of the edge of the data strobe signal
after the adjustment as the start boundary moment of the timing margin of the data
signal, wherein
the second step length is equal to a time difference between two adjacent reference
moments, and the first step length is greater than the second step length and is an
integer multiple of the second step length.
15. The apparatus according to claim 13, wherein the plurality of reference moments are
arranged in ascending order; and the first determining submodule is configured to:
adjust the moment of the edge of the data strobe signal transmitted by the transmit
end of the data signal, to a second target reference moment in the plurality of reference
moments, wherein the second target reference moment is a Yth reference moment in the plurality of reference moments, Y is a positive integer greater
than M/2, and M is a total quantity of reference moments comprised in the reference
moment set;
detect whether a bit error exists in data obtained by decoding the data signal based
on the current reference voltage and the data strobe signal after the adjustment;
if any bit error exists, set back the moment of the edge of the data strobe signal
by a first step length, until no bit error exists in data obtained by decoding based
on the current reference voltage and the data strobe signal after the adjustment;
set forward the moment of the edge of the data strobe signal by a second step length,
until a bit error exists in data obtained by decoding based on the current reference
voltage and the data strobe signal after the adjustment; and
determine a reference moment previous to the moment of the edge of the data strobe
signal after the adjustment as the end boundary moment of the timing margin of the
data signal, wherein
the second step length is equal to a time difference between two adjacent reference
moments, and the first step length is greater than the second step length and is an
integer multiple of the second step length.
16. The apparatus according to any one of claims 10 to 12, wherein the detection module
comprises:
a second adjustment submodule, configured to adjust the moment of the edge of the
data strobe signal transmitted by the transmit end of the data signal, to one reference
moment in the plurality of reference moments;
a second determining submodule, configured to: within a range of the plurality of
reference voltages comprised in the reference voltage set, adjust the voltage of the
reference power source, and detect whether a bit error exists in data obtained by
decoding the data signal based on the current reference moment and the voltage of
the reference power source after the adjustment, to determine a start boundary voltage
and an end boundary voltage of the voltage margin of the data signal separately from
the plurality of reference voltages; and
a second detection submodule, configured to instruct the second adjustment submodule
and the second determining submodule to repeat the operations of adjusting the moment
and determining the voltage margin, until the moment of the edge of the data strobe
signal traverses the reference moment set, wherein
the start boundary voltage is a lowest reference voltage that enables the data obtained
by decoding to be free of bit errors, in the plurality of reference voltages, and
the end boundary voltage is a highest reference voltage that enables the data obtained
by decoding to be free of bit errors, in the plurality of reference voltages.
17. The apparatus according to any one of claims 10 to 16, wherein the receive end is
a storage controller, the transmit end is a storage medium, and the storage controller
is connected to the storage medium by using an interface bus; and the apparatus further
comprises:
a writing module, configured to write test data to the storage medium at a target
rate;
a transmission module, configured to transmit, to the storage medium, an instruction
for reading the test data; and
a receiving module, configured to receive the data signal carrying the test data,
and the data strobe signal that are transmitted by the storage medium, wherein
the target rate is a working rate of the interface bus or is a lower limit rate within
a bus rate range corresponding to a working mode of the interface bus.
18. The apparatus according to any one of claims 10 to 17, wherein the detection module
is configured to:
adjust the voltage of the reference power source in response to a detection instruction
based on the plurality of reference voltages comprised in the reference voltage set;
or
if detecting that a physical parameter of a storage device meets a detection trigger
condition, adjust the voltage of the reference power source based on the plurality
of reference voltages comprised in the reference voltage set.
19. An apparatus for detecting margins of a data signal, wherein the apparatus comprises
a memory, a processor, and a computer program stored in the memory and capable of
running on the processor, and when the processor executes the computer program, the
method for detecting margins of a data signal according to any one of claims 1 to
9 is implemented.
20. A non-volatile storage medium, wherein the non-volatile storage medium stores an instruction,
and when the non-volatile storage medium runs on the processor, the processor is enabled
to perform the method for detecting margins of a data signal according to any one
of claims 1 to 9.
21. A chip, wherein the chip comprises a programmable logic circuit and/or a program instruction,
and when the chip runs, the chip is configured to implement the method for detecting
margins of a data signal according to any one of claims 1 to 9.
22. A storage device, wherein the storage device comprises a storage controller and a
storage medium, and the storage controller is connected to the storage medium by using
an interface bus; and
the storage controller and/or the storage medium comprise/comprises the apparatus
according to any one of claims 10 to 19; or
the storage controller and/or the storage medium are/is the chip according to claim
21.