Clock and data phase difference calibration method, electronic equipment and storage medium
The software algorithm uses low voltage differential signal data to automatically synchronize the clock and data phase difference, which solves the problems of low calibration efficiency and high bit error rate when the data transmission frequency is high in the prior art, and achieves efficient and accurate data transmission calibration.
Patent Information
- Application Number
- CN202310620650.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-29
- Publication Date
- 2024-11-29
AI Technical Summary
The existing automatic static calibration method cannot effectively calibrate the clock and data phase differences caused by external data sources and hardware connections when the data transmission frequency is high, resulting in frequent data reading or identification errors, and the efficiency of relying on a single debugging method is low. .
Through software algorithm, use real low-voltage differential signal data with synchronization code to automatically synchronize the clock and data phase difference, set the initial calibration step and delay time, construct a flag bit array, identify the valid interval, and adjust it according to preset conditions. Calibrate step size and type until the calibration requirements are met or the upper limit of the cycle inspection round is reached.
Improve calibration efficiency and data transmission accuracy, reduce bit error rate, simplify calibration process, and save costs.
Smart Images

Figure CN119051653A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of electronic circuits, and in particular to a method for calibrating a clock and data phase difference, an electronic device, and a storage medium. Background Art
[0002] In data transmission, the phase deviation (skew) between the clock (CLK) and data (DATA) is an important factor in ensuring the accuracy and rate of the data acquisition system. When the sampling clock edge is aligned with the center of the data, the data and clock are said to be aligned. At this time, the phase deviation is 0, and the sampled data is correct. Bit errors may only occur when the edge is aligned around the rising / falling edge of the data.
[0003] Existing technologies support automatic static calibration of deviations caused by differences in trace lengths in circuit boards. However, it is impossible to correctly calibrate deviations that exist in the external data source itself or that are caused by the increase in peripheral lines due to hardware connection. When the data transmission frequency is low, such small deviations can still be barely accepted, but when the data transmission frequency increases and the number of data paths increases, there will be high requirements for the precise value of the phase. At this time, if it is found that data reading or recognition errors frequently occur when relying solely on automatic static calibration, it is necessary to manually change the delay calibration value and judge the correctness of the data for calibration, but this method that relies on single debugging is too inefficient. Summary of the invention
[0004] In order to solve the above technical problems, the present disclosure provides a method for calibrating the clock and data phase difference, which can directly use real low voltage differential signal (LVDS) data with synchronization codes, and automatically synchronize the calibration of the clock and data phase difference caused by internal and external lines during data transmission through software algorithms, thereby improving the calibration efficiency and the accuracy of transmitted data.
[0005] In one aspect, the present disclosure provides a method for calibrating a clock and data phase difference, comprising:
[0006] Setting the initial calibration step length and the initial value of the delay time length according to the calibration type, and constructing a flag array, wherein the length of the flag array is the upper limit value of the delay step number determined under the corresponding calibration type;
[0007] Perform a round of calibration at the initial calibration step length: update the delay time length according to the delay step number, and receive low voltage differential signal data sent by the data source at each delay time length, identify each low voltage differential signal data, and obtain the valid interval of the flag bit array;
[0008] In the case where the valid interval meets the preset conditions, the midpoint of the valid interval is used as the target calibration value.
[0009] In some implementations, the calibration type is selected from one of clock delay calibration and data delay calibration.
[0010] In some implementations, the step of setting the initial calibration step size and the initial value of the delay time according to the calibration type includes:
[0011] Determine the upper limit of the delay step number according to the calibration type;
[0012] The input clock cycle is divided by the upper limit of the delay step number to calculate the initial calibration step length, and the initial value of the delay duration is zero.
[0013] In some embodiments, the step of updating the delay time according to the delay step number and receiving the low voltage differential signal data sent by the data source at each delay time includes:
[0014] The delay step number is increased sequentially, and each increased delay step number is multiplied by the initial calibration step length to obtain an updated delay duration each time, and low voltage differential signal data sent by the data source is received at each delay duration until the delay step number is equal to the delay step upper limit value.
[0015] In some implementations, the step of identifying each of the low voltage differential signal data to obtain a valid interval of the flag bit array includes:
[0016] Read the register to determine whether the received data is correct;
[0017] Assign a value to the flag bit corresponding to the delay step number in the flag bit array according to the judgment result;
[0018] The interval of multiple consecutive flag bits in the flag bit array that represent correct identification is taken as the valid interval.
[0019] In some implementations, the step of assigning a value to a flag bit corresponding to the number of delay steps in the flag bit array according to the judgment result includes:
[0020] If the judgment is correct, the flag bit corresponding to the delay step number in the flag bit array is assigned the first preset value, otherwise it is assigned the second preset value.
[0021] In addition, the sign of judging whether it is correct or not is that there will be a fixed synchronization code in the sent data specified by the protocol, and there is a register flag bit for identifying the synchronization code inside the chip receiving the data. If the synchronization code can be recognized, it means that the received data is correct, and if the synchronization code cannot be recognized, it means that the received data is wrong.
[0022] In some embodiments, the preset conditions include that the ratio of the valid interval to the calibration interval reaches a preset threshold, and both the valid interval before and after the valid interval in the calibration interval are flag bits indicating recognition failure.
[0023] In some embodiments, before performing a round of calibration at the initial calibration step size, the calibration method further includes:
[0024] Set the upper limit of the number of cyclic inspection rounds;
[0025] In the case that the valid interval does not meet the preset condition, the calibration step length is adjusted and a new round of calibration is performed at the adjusted calibration step length until the valid interval meets the preset condition or reaches the upper limit of the cyclic inspection rounds.
[0026] In some implementations, the above situation where the valid interval does not meet the preset condition includes: the obtained valid interval can be completely identified, but the proportion of the valid interval does not reach the preset threshold,
[0027] In this case, the step of adjusting the calibration step size includes:
[0028] The sum of the delay step value at the end of the valid interval obtained this time plus 1 is multiplied by the current calibration step length, and the quotient of the calculated product divided by the upper limit of the delay step number is used as the initial calibration step length for the next round of calibration.
[0029] In some embodiments, the above-mentioned situation that the preset condition is not met in the valid interval includes: there is no identification failure flag bit at the rear of the valid interval in the calibration interval,
[0030] In this case, the step of adjusting the calibration step size includes:
[0031] A delay coefficient is set, and the calibration step length is adjusted to the product of the delay coefficient and the initial calibration step length, and the delay coefficient is a real number greater than 1.
[0032] In some implementations, the step of setting the delay coefficient includes:
[0033] When the first delay step number is less than half of the upper limit of the delay step number, the delay coefficient is set to a first delay coefficient, wherein the first delay step number is the delay step number corresponding to the first flag bit indicating correct identification in the valid interval, and the first delay coefficient is a real number greater than 1;
[0034] When the first delay step number is greater than or equal to half of the upper limit of the delay step number, the delay coefficient is set to a second delay coefficient, wherein the second delay coefficient is a real number greater than the first delay coefficient.
[0035] In some implementations, the above situation where the valid interval does not meet the preset condition also includes:
[0036] The calibration step length is adjusted until the upper limit of the cyclic inspection round is reached, and the obtained valid interval still does not meet the preset condition,
[0037] In this case, the calibration type is changed, and the step of setting the initial calibration step and the initial value of the delay time according to the calibration type is returned, and then the calibration method is continued until the valid interval meets the preset conditions or reaches the upper limit of the cyclic inspection rounds.
[0038] In some implementations, the above situation where the valid interval does not meet the preset condition also includes:
[0039] The step of changing the calibration type is performed, and the calibration method is executed until the upper limit of the cyclic inspection round is reached, and the obtained valid interval still does not meet the preset conditions,
[0040] In this case, the preset threshold of the effective interval ratio is reduced, and then the calibration method is continued to be executed until the effective interval meets the preset condition or reaches the upper limit of the cyclic inspection rounds.
[0041] On the other hand, the present disclosure also provides an electronic device, wherein the electronic device includes a memory, a processor, and a clock and data phase difference calibration method program stored in the memory and executable on the processor, wherein the clock and data phase difference calibration method program implements the steps of the clock and data phase difference calibration method as described above when executed by the processor.
[0042] On the other hand, the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the steps of the method for calibrating the clock and data phase difference as described above.
[0043] The beneficial effects of the present invention are as follows: a calibration method for clock and data phase difference provided by the present disclosure includes: setting the initial calibration step length and the initial value of the delay time length according to the calibration type, and constructing a flag array, wherein the length of the flag array is the upper limit value of the delay step number determined under the corresponding calibration type; performing a round of calibration under the initial calibration step length: updating the delay time length according to the delay step number, and receiving the low voltage differential signal data sent by the data source under each delay time length, identifying each low voltage differential signal data, and obtaining the valid interval of the flag array; and when the valid interval meets the preset conditions, taking the midpoint of the valid interval as the target calibration value. The calibration method provided by the present disclosure does not need to construct a test sequence, and can directly use the real low voltage differential signal (LVDS) data with synchronization code sent by the data source for calibration, which is simple and convenient, and improves the efficiency of the calibration work. At the same time, through the design of the program algorithm, it can realize the automatic synchronization during data transmission to calibrate the error caused by the change of the peripheral line or the increase of the data transmission rate, reduce the bit error rate in data transmission, improve the calibration efficiency and calibration accuracy, and save costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings.
[0045] Figure 1 A timing diagram showing a static calibration principle of a clock and data phase difference in the prior art;
[0046] Figure 2 A schematic diagram showing a flow chart of a method for calibrating a clock and data phase difference provided by an embodiment of the present disclosure;
[0047] Figure 3 Show Figure 2 A schematic diagram of a model application of the calibration method shown in one embodiment;
[0048] Figure 4 Show Figure 3 Schematic diagram showing that the effective interval width meets the expected requirements in the scenario shown;
[0049] Figure 5 Show Figure 3 A schematic diagram of an implementation situation in which the effective interval width does not meet the expected requirements in the illustrated scenario;
[0050] Figure 6 Show Figure 3 A schematic diagram of another implementation situation in which the effective interval width does not meet the expected requirements in the illustrated scenario;
[0051] Figure 7 A schematic diagram of a model of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0052] In order to facilitate the understanding of the present disclosure, the present disclosure will be described more comprehensively below with reference to the relevant drawings. The preferred embodiments of the present disclosure are given in the drawings. However, the present disclosure can be implemented in different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the understanding of the content of the present disclosure more thorough and comprehensive.
[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present disclosure belongs. The terms used in the specification of the present disclosure are only for the purpose of describing specific embodiments and are not intended to limit the present disclosure.
[0054] In data transmission, the phase of the clock (CLK) and data (DATA) should ensure that the sampling clock edge is aligned with the center of the data as much as possible. At this time, the data and clock are said to be aligned, and the deviation (skew) is 0. There is a module inside the chip that automatically calibrates the skew caused by the physical circuit. Figure 1 As shown, it uses its own 24MHz clock as data and clock input, applies delay to the clock or data, and constructs a calibration sequence such as odata to determine whether the output data (odata) is flipped from aa(55) to 55(aa) to ensure edge alignment of the two. The actual delay of the data and clock supports a maximum of 32 steps and 16 steps of calibration respectively according to the minimum step size. However, due to the limitation of this automatic static calibration method, this method is powerless to the deviation of the data source itself caused by the external line.
[0055] Based on this, the present invention proposes a method for calibrating the phase difference of clock and data, which can adjust the phase of the clock and data respectively, and judge the calibration status based on the real low voltage differential signal (LVDS) data with synchronization code sent by the data source. There is no need to construct a calibration sequence such as odata separately. The LVDS data sent by the data source can be directly used to complete the calibration work synchronously during data transmission, thereby improving the calibration efficiency and calibration accuracy.
[0056] In order to reduce the bit error rate in data transmission, it is necessary to ensure that the sampling clock edge is aligned with the center of the data as much as possible. To this end, the corresponding delay calibration module is designed inside the chip to achieve alignment; the phases of the clock and data can be adjusted separately through software algorithms or hardware modules, and the adjustment range can be determined by setting the calibration step (Step / picosecond (ps)) and the delay step number; the maximum clock delay step number generally supported is 32 steps, and the maximum data delay step number is 16 steps; taking the clock as an example, the range of clock delay that can be adjusted is 32*Step ps. As long as the sampling clock edge is aligned with the stable part near the center of the data, the data can be correctly identified. Only when the edge is aligned with the rising / falling edge of the data, bit errors may occur. In order to obtain correct data more stably, the calibration program should try to obtain the delay value that makes the clock edge align with the center of the data, traverse all the steps (N) to obtain the delay interval that can correctly identify the data (referred to as the effective interval in this article), and select the middle value of the delay time in this effective interval as the final output result.
[0057] Hereinafter, the present disclosure will be described in detail with reference to the accompanying drawings.
[0058] Figure 2 A flow chart of a method for calibrating a clock and data phase difference provided in an embodiment of the present disclosure is shown.
[0059] refer to Figure 2 , a method for calibrating a clock and data phase difference provided by an embodiment of the present disclosure includes:
[0060] S110: Setting the initial calibration step length and the initial value of the delay time according to the calibration type, and constructing a flag bit array.
[0061] In step S110, the calibration type is selected from one of clock delay calibration and data delay calibration. The result of dividing a clock cycle of the input LVDS data by the upper limit of the delay step number can be used as the initial calibration step length so that the delay interval can cover the entire clock cycle; the upper limit of the delay step number here is determined according to the calibration type used: for data path delay, the upper limit of the adjustable step number is generally 16, and the upper limit of the adjustable step number of the clock path delay is generally 32. The two optional calibration types are respectively applicable to calibration when the clock path is delayed compared to the data path or the data path is delayed compared to the clock path, so as to meet the verification requirements of different delay situations. It should be noted that for the clock path, the delay of the data path is equivalent to the advance of the clock path.
[0062] The length of the flag array is the upper limit of the delay steps determined by the corresponding calibration type. Here, the elements of each flag in the flag array represent correctly identifiable / incorrectly identifiable data. The elements of the flags of correctly identifiable data and the flags of incorrectly identifiable data together constitute the entire calibration interval. The elements of continuous flags of correctly identifiable data constitute the valid interval. Only the arrays whose positions and proportions in the entire calibration interval meet the preset conditions are ideal arrays that meet the calibration requirements. Moreover, the array sequence of a flag element in the valid interval also represents the delay steps corresponding to the correctly identified flag.
[0063] In some implementations, the step of setting the initial calibration step size and the initial value of the delay time according to the calibration type includes:
[0064] Determine the upper limit of the delay step number according to the calibration type;
[0065] The input clock cycle is divided by the upper limit of the delay step number to calculate the initial calibration step length, and the initial value of the delay time length is zero. It should be noted that the initial value of the delay time length is 0 at the beginning of each calibration cycle.
[0066] S120: Perform a round of calibration at the initial calibration step length: update the delay duration according to the delay step number, and receive low voltage differential signal data sent by the data source at each delay duration, identify each low voltage differential signal data, and obtain the valid interval of the flag bit array.
[0067] In step S120, each delay duration in a round of calibration can be obtained one by one by incremental calculation according to the initial calibration step length, and the upper limit of the number of increments is the upper limit of the delay step number. In this embodiment, the above-mentioned step of updating the delay duration according to the delay step number, and receiving the low voltage differential signal data sent by the data source at each delay duration, includes: increasing the delay step number in sequence, multiplying each increased delay step number by the initial calibration step length, obtaining an updated delay duration each time, and receiving the low voltage differential signal (LVDS) data sent by the data source at each delay duration, until the delay step number is equal to the upper limit of the delay step number. Thus, a complete valid interval can be obtained.
[0068] In some implementations, the step of identifying each of the low voltage differential signal data to obtain a valid interval of the flag bit array includes:
[0069] Read the register to determine whether the received data is correct;
[0070] Assign a value to the flag bit corresponding to the delay step number in the flag bit array according to the judgment result;
[0071] The interval of multiple consecutive flag bits in the flag bit array that represent correct identification is taken as the valid interval.
[0072] In some implementations, the step of assigning a value to a flag bit corresponding to the number of delay steps in the flag bit array according to the judgment result includes:
[0073] If the judgment is correct, the flag bit corresponding to the delay step number in the flag bit array is assigned a first preset value, otherwise a second preset value. Specifically, for example: if the data is correctly identified, the corresponding flag bit in the flag bit array is assigned 1, otherwise 0; or if the data is correctly identified, the corresponding flag bit in the flag bit array is assigned 0, otherwise 1, which is not limited here and can be selected according to application requirements in practice.
[0074] In some embodiments, a sign for determining whether the received data is correct or not is that the LVDS data sent by the (data source) specified in the protocol contains a fixed synchronization code, and a register flag for identifying the synchronization code is contained in the chip receiving the data. If the synchronization code can be identified, it indicates that the received data is correct, and if the synchronization code cannot be identified, it indicates that the received data is incorrect.
[0075] The flag register in the present disclosure is a 32-bit register with a custom base address in the chip memory, wherein the flag bit is used to indicate the correct or incorrect result of a certain transmission data recognition.
[0076] S130: When the valid interval meets a preset condition, taking the midpoint of the valid interval as a target calibration value.
[0077] In step S130, the above-mentioned preset conditions include that the proportion of the valid interval in the calibration interval reaches a preset threshold. More specifically, the purpose of the flag bit array is to find a continuous and sufficiently wide valid interval that can correctly identify data, and determine its width proportion in the entire calibration interval of the flag bit array, and the above-mentioned preset conditions also require that the valid interval before and after in the calibration interval are both flag bits indicating recognition failure.
[0078] In some implementations, if the clock delay calibration method is selected, the upper limit of the delay step number is q, the period of the input clock is T, the delay step number is N, the initial calibration step length is Step_0=T / q, the delay time length is Delay=Step*N, the initial value of the delay step number N is 0, and the initial value of the delay time length Delay is 0. Data is sent under this delay time length and it is determined whether the data recognition is normal. The judgment result is output and assigned to the flag bit array of the corresponding bit, such as 1 for correct assignment and 0 for error. Then, it is determined that the delay step number N is less than the upper limit of the delay step number q, and the delay step number N is incremented. N=1, then the delay time length Delay=Step* 1. Send data under the delay time and determine whether the data recognition is normal, output the judgment result and assign it to the flag array of the corresponding bit, and then continue to determine that the delay step number N is less than the upper limit value q of the delay step number, then continue to increment the delay step number N, and so on, until the delay step number N completes traversal of all delay steps, that is, if the upper limit of the delay step number is q, the delay step number is incremented q times, and q delay durations are obtained. On this basis, a q-bit flag array A[q] is also obtained, and then the flag array A[q] is output, and the position and proportion of the valid interval of the flag array under the calibration step (Step_0=T / q) are identified.
[0079] At a certain calibration step length, the flag array obtained after completing a round of calibration will have the following conditions:
[0080] For the sake of clarity, we draw the flag array as follows Figures 4 to 6 As shown, 1 indicates that data recognition fails under the current calibration step, and 0 indicates that data recognition succeeds. Taking the data delay with 16 intervals as an example, if clock delay calibration is selected, the flag array will have 32 flag elements, and these 32 flag elements together constitute the calibration interval. The purpose of the flag array is to find a valid interval composed of continuous and sufficiently wide flag elements that correctly recognize the data, and the effective interval ratio (or width) in the entire calibration interval meets the preset conditions, that is, Figure 4 The complete identifiable interval appears as shown. The expected width ratio of the effective interval can be set by yourself. Here, the effective interval width ratio is set to be no less than 1 / 3. Then the midpoint of the delay time is selected as the target calibration value output to achieve stable and accurate data recognition.
[0081] The above complete interval means that there are steps before and after the successful recognition interval where recognition failed. This means that the program has found a complete data stability area. At this time, the program will determine the effective interval width ratio (effective interval / calibration interval, Figure 4The proportion shown is 7 / 16, and satisfying the requirement of not less than 1 / 3) has met expectations. When the proportion reaches the preset threshold, the middle value of the delay duration delay corresponding to the effective interval is output to end the calibration procedure.
[0082] Of course the above Figure 4 The scenario shown is the result obtained under ideal conditions or after calibration. In practice, it is generally not obtained directly at one time. There may be a situation where the effective interval does not meet the expected requirements: in some embodiments, the rear part of the interval is missing, such as Figure 5 As shown, in this case, the complete identification interval is not found. If the valid interval of the flag array obtained after a round of calibration under the current calibration step cannot meet the preset conditions, the calibration step will be changed and recalibrated. It should be noted that the corresponding calibration step adjustment method may be different for different situations that do not meet the preset conditions. The calibration step adjustment method is determined according to the specific situation that does not meet the preset conditions, so that the appropriate calibration step can be used to complete the calibration more quickly and improve the calibration efficiency.
[0083] For example, in some embodiments, if a complete identifiable valid interval is found, but the valid interval does not meet the expected proportion requirement, the calibration step size will be changed and recalibrated. On this basis, the calibration step size of the next calibration will be calculated as follows: the number of steps at the end of the valid interval obtained this time is recorded as X, and the calibration step size of the next calibration is:
[0084] Step_1 = ((X+1)*Step_0) / q, where q is the upper limit of the delay step number of the current calibration type. This method can make the proportion of the effective interval large enough, making the obtained intermediate value more accurate, thereby improving the accuracy of calibration.
[0085] In other embodiments, before performing a round of calibration at the initial calibration step size, the calibration method further includes: setting an upper limit value of the number of cyclic inspection rounds;
[0086] In the case that the valid interval does not meet the preset condition, the calibration step length is adjusted and a new round of calibration is performed at the adjusted calibration step length until the valid interval meets the preset condition or reaches the upper limit of the cyclic inspection rounds.
[0087] In some other implementations, the above-mentioned situation that the preset condition is not met in the valid interval includes: there is no identification failure flag bit at the rear of the valid interval in the calibration interval,
[0088] In this case, the step of adjusting the calibration step size includes:
[0089] Set the delay coefficient Z, adjust the calibration step length Step_n to the delay coefficient Z multiplied by the initial calibration step length Step_0, and the delay coefficient Z is a real number greater than 1, such as Figure 3 In one embodiment, the absence of a recognition failure flag at the rear of the effective interval within the calibration interval includes: the first delay step is less than half of the upper limit of the delay step, and the first delay step is the delay step corresponding to the first flag indicating correct recognition in the effective interval,
[0090] Furthermore, the step of setting the delay coefficient Z and adjusting the calibration step length Step_n to the delay coefficient Z multiplied by the initial calibration step length Step_0 includes:
[0091] The delay coefficient Z is set to a first delay coefficient m, where the first delay coefficient m is a real number greater than 1.
[0092] In other embodiments, the absence of a recognition failure flag at the rear of the valid interval within the calibration interval includes the first delay step being greater than or equal to half of the upper limit of the delay step,
[0093] Furthermore, the step of setting the delay coefficient Z and adjusting the calibration step length Step_n to the delay coefficient Z multiplied by the initial calibration step length Step_0 includes:
[0094] The delay coefficient Z is set to a second delay coefficient n, where the second delay coefficient n is a real number greater than the first delay coefficient m.
[0095] In the above different implementations, the setting of the delay coefficient can be determined according to the specific situation that does not meet the preset conditions, so as to obtain a more appropriate effective interval in the verification interval more quickly, which can improve the calibration efficiency and accuracy to a certain extent.
[0096] The above statement shows that in the case of unsuccessful calibration, the calibration step length can be adjusted (the calibration step length increases when the number of verification rounds does not reach the upper limit of the number of cyclic verification rounds) and then the aforementioned calibration method is continued to be executed cyclically, which will also produce different results: one is that the calibration step length is adjusted cyclically and the number of cycles reaches the upper limit but the calibration is still not successful, and the other is that the calibration step length is adjusted cyclically and the number of cycles does not exceed the set upper limit, and the calibration is successful. The latter can end the calibration procedure and output the calibration result as described above, and the former can re-execute the aforementioned calibration method by changing the calibration type.
[0097] In some implementations, the above situation where the effective interval width of the flag bit array does not meet the expected requirements also includes:
[0098] After adjusting the calibration step, the effective range still does not meet the preset conditions.
[0099] And, in this case, return to the above step of setting the initial values of the calibration step and delay time according to the calibration type, change the calibration type, and then continue to execute the calibration method until the valid interval meets the preset conditions or reaches the upper limit of the cyclic inspection rounds.
[0100] In practice, the above situations may occur alternately. By adjusting the calibration step size or changing the calibration type through the execution steps / methods in each situation, the calibration can be converged to the normal situation. Figure 4 The length of the valid interval shown achieves the expected result; however, after executing the above method, it is still possible that the program is completed but the valid interval is not found; in this case, it can be appropriately considered to reduce the expected width ratio of the valid interval based on the needs to ensure successful calibration.
[0101] In some implementations, the situation in which the valid interval of the flag bit array does not meet the preset condition also includes:
[0102] After changing the calibration type, the valid interval still does not meet the preset conditions.
[0103] Furthermore, in this case, the preset threshold value of the proportion of the valid interval in the verification interval is reduced, and then the above calibration method is continuously executed until the valid interval meets the preset condition or reaches the upper limit value of the cyclic verification rounds.
[0104] Existing technology supports automatic static calibration of errors caused by differences in trace lengths in circuit boards. However, when errors exist in the external data source itself or errors caused by additional peripheral lines due to hardware connection cannot be correctly calibrated, smaller errors can be barely accepted when the data transmission frequency is low, but when the data transmission frequency increases and the number of data paths increases, high requirements are placed on the precise value of the phase. At this time, if it is found that data reading or recognition errors frequently occur when relying solely on automatic static calibration, it is necessary to manually change the delay calibration value and judge the correctness of the data for calibration, but this method that relies on single debugging is too inefficient.
[0105] The clock and data phase difference calibration method provided in the embodiment of the present disclosure does not need to construct a test sequence, and can directly use the LVDS data sent by the data source for calibration. It is simple and convenient, and the efficiency of the calibration work is improved. At the same time, through the design of the program algorithm, it can realize the calibration of errors caused by changes in peripheral circuits or increased data transmission rates in a high-frequency working environment, and achieve the purpose of calibration through processing methods under a variety of preset scenarios, thereby reducing the bit error rate in data transmission, improving calibration efficiency and calibration accuracy, and saving costs.
[0106] Figure 3 Show Figure 2 A schematic diagram of a model application of the calibration method shown in one embodiment, Figure 4 Show Figure 3 The schematic diagram shows that the effective interval width meets the expected requirements in the scenario shown. Figure 5 Show Figure 3 A schematic diagram of an implementation situation in which the effective interval width does not meet the expected requirements in the scenario shown, Figure 6 Show Figure 3 A schematic diagram of another implementation scenario in which the effective interval width does not meet the expected requirements in the illustrated scenario.
[0107] refer to Figure 3 In one embodiment, Figure 2 The calibration method shown can be calibrated through the following process: First, the calibration method supports clock and data delays respectively, and the initial value of the clock and data calibration step (Step_0) uses 1 / q of the input clock cycle T as the initial step, so that the delay interval can cover the entire clock cycle, where q is the upper limit of the delay step number corresponding to the calibration type (such as clock delay calibration), and the value of q is determined according to the calibration type used: for data path delay, q=16, and for clock path delay, q=32. At the same time, a flag array A[q] of length q is constructed, and each element of the array corresponds to the data recognition result of each delay duration, 1 indicates data recognition failure, and 0 indicates success. Then set the upper limit of the cyclic inspection round Times and the preset threshold of the effective interval ratio. Then calculate and set the initial value of the calibration step length, and start the calibration procedure under the calibration step length: set the delay length Delay = Step*N (N = 0, 1, 2, ... q-1) for each cycle, and the delay step number N increases from 0 to the corresponding upper limit q-1. At each delay length, the data source sends LVDS data, and reads the register to determine whether the data is correct. The mark for judging whether it is correct here is that there will be a fixed synchronization code in the LVDS data specified by the protocol, and the chip receiving the data has a register flag bit that recognizes the fixed synchronization code. In this embodiment, if the data is correct, the corresponding flag bit array A[N] is assigned to 0, otherwise it is assigned to 1. After q times of N increment, a round of calibration under this step length is completed, and we may obtain the interval of correct data recognition under this step length (such as Figures 4 to 6 shown).
[0108] At the same time, under a certain calibration step length, after completing a round of calibration, the flag array will have the following conditions: Figure 4 The following figure shows the complete identifiable range after successful calibration. Figure 5It shows that the rear part of the interval is missing after the calibration fails. In this case, the complete identification interval is not found. The first delay step number X is the delay step number corresponding to the first flag position indicating correct identification in the valid interval. The first delay step number X is less than half of the upper limit of the delay step number (i.e., q / 2). The delay length Delay corresponding to the first delay step number X is Delay=Step_0*X. When X Figure 4 The complete identification interval is shown, but the effective interval ratio may be less than the expected value. At this time, the calibration method described in the above embodiment can be used for calculation.
[0109] Figure 6 It shows that the effective interval width is always smaller than the expected length, which means that when this happens, first use Figure 5 However, there may be a scenario where the calibration step is set too large, resulting in a small number of delay steps that span the valid interval, resulting in the interval length failing to reach the expected level (i.e., a complete valid interval appears but the expected percentage requirement is not met). At this time, the calibration step is adjusted by the aforementioned corresponding method. If the expected level is still not achieved after the calibration step is adjusted for more than a preset number of times (e.g., 2 times), then the reverse direction delay should be used for calibration. This means that if clock delay calibration is used at the beginning, then after this situation occurs, it is necessary to change to data delay calibration, and vice versa. After changing the calibration method, repeat the aforementioned operation until the target is achieved.
[0110] In practice, the above Figures 4 to 6 These three situations will appear alternately. By adjusting the calibration step size or changing the calibration type through different processing methods in each case, the effective interval distribution of the flag array will converge to Figure 4 The effective interval length in the calibration reaches the expected purpose; if the program is run to completion and no effective interval is found, consider appropriately reducing the preset threshold of the effective interval ratio until the calibration is successful.
[0111] Figure 7 A schematic diagram of a model of an electronic device provided by an embodiment of the present disclosure is shown.
[0112] This embodiment also provides an electronic device, the model schematic diagram of the electronic device is as follows Figure 7 As shown, the electronic device 100 includes a processor 110 and a memory 120; wherein the memory 120 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor 110 to implement the above-mentioned clock and data phase difference calibration method.
[0113] Figure 7 The electronic device 100 shown further includes a bus 101 and a communication interface 130 , and the processor 110 , the communication interface 130 and the memory 120 are connected via the bus 101 .
[0114] The memory 120 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The bus 101 may be an ISA bus, a PCI bus, or an EISA bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only a single line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0115] The communication interface 130 is used to connect to at least one user terminal and other network units through a network interface, and send the encapsulated message to the user terminal through the network interface.
[0116] The processor 110 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 110. The above processor 110 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 120, and the processor 110 reads the information in the memory 120 and completes the steps of the method of the above embodiment in combination with its hardware.
[0117] On the other hand, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method of the above embodiment are executed.
[0118] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0119] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0120] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0121] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0122] It should be noted that in the description of the present disclosure, it needs to be understood that the terms "upper", "lower", "inner" and the like indicating orientation or positional relationship are only for the convenience of describing the present disclosure and simplifying the description, and do not indicate or imply that the components or elements referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present disclosure.
[0123] In addition, in this article, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of more restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device that includes the element.
[0124] Finally, it should be noted that: Obviously, the above embodiments are only examples for clearly illustrating the present disclosure, and are not intended to limit the implementation methods. For ordinary technicians in the relevant field, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived from this are still within the scope of protection of the present disclosure.
Claims
1. A method for calibrating a clock and data phase difference, characterized in that: include: Setting the initial calibration step length and the initial value of the delay time length according to the calibration type, and constructing a flag array, wherein the length of the flag array is the upper limit value of the delay step number determined under the corresponding calibration type; Perform a round of calibration at the initial calibration step length: update the delay time length according to the delay step number, and receive low voltage differential signal data sent by the data source at each delay time length, identify each low voltage differential signal data, and obtain the valid interval of the flag bit array; In the case where the valid interval meets the preset conditions, the midpoint of the valid interval is used as the target calibration value.
2. The calibration method according to claim 1, wherein: The calibration type is selected from one of clock delay calibration and data delay calibration.
3. The calibration method according to claim 1, wherein: The step of setting the initial calibration step length and the initial value of the delay time length according to the calibration type includes: Determine the upper limit of the delay step number according to the calibration type; The input clock cycle is divided by the upper limit of the delay step number to calculate the initial calibration step length, and the initial value of the delay duration is zero.
4. The calibration method according to claim 3, wherein: The step of updating the delay time according to the delay step number and receiving the low voltage differential signal data sent by the data source at each delay time includes: The delay step number is increased sequentially, and each increased delay step number is multiplied by the initial calibration step length to obtain an updated delay duration each time, and low voltage differential signal data sent by the data source is received at each delay duration until the delay step number is equal to the delay step upper limit value.
5. The calibration method according to claim 4, wherein: The step of identifying each of the low voltage differential signal data to obtain the valid interval of the flag bit array includes: Read the register to determine whether the received data is correct; Assign a value to the flag bit corresponding to the delay step number in the flag bit array according to the judgment result; The interval of multiple consecutive flag bits in the flag bit array that represent correct identification is taken as the valid interval.
6. The calibration method according to claim 5, wherein: The step of assigning a value to the flag bit corresponding to the delay step number in the flag bit array according to the judgment result includes: If the judgment is correct, the flag bit corresponding to the delay step number in the flag bit array is assigned the first preset value, otherwise it is assigned the second preset value. In addition, the sign for judging whether it is correct or not is that there will be a fixed synchronization code in the sent data specified by the protocol, and there will be a register flag bit for identifying the synchronization code inside the chip receiving the data. If the synchronization code can be recognized, it means that the received data is correct, and if the synchronization code cannot be recognized, it means that the received data is wrong.
7. The calibration method according to claim 1, wherein: The preset conditions include that the proportion of the valid interval in the calibration interval reaches a preset threshold, and both the valid interval before and after the valid interval in the calibration interval are flag bits indicating recognition failure.
8. The calibration method according to claim 7, wherein: Before performing a round of calibration at the initial calibration step size, the calibration method further includes: Set the upper limit of the number of cyclic inspection rounds; In the case that the valid interval does not meet the preset condition, the calibration step length is adjusted and a new round of calibration is performed at the adjusted calibration step length until the valid interval meets the preset condition or reaches the upper limit of the cyclic inspection rounds.
9. The calibration method according to claim 8, wherein: The situation where the valid interval does not meet the preset condition includes: the obtained valid interval can be completely identified, but the proportion of the valid interval does not reach the preset threshold, In this case, the step of adjusting the calibration step size includes: The sum of the delay step value at the end of the valid interval obtained this time plus 1 is multiplied by the current calibration step length, and the quotient of the calculated product divided by the upper limit of the delay step number is used as the initial calibration step length for the next round of calibration.
10. The calibration method according to claim 8, wherein: The situation where the preset condition is not met in the valid interval includes: there is no identification failure flag bit at the rear of the valid interval in the calibration interval, In this case, the step of adjusting the calibration step size includes: A delay coefficient is set, and the calibration step length is adjusted to the product of the delay coefficient and the initial calibration step length, and the delay coefficient is a real number greater than 1.
11. The calibration method according to claim 10, wherein: The step of setting the delay coefficient comprises: When the first delay step number is less than half of the upper limit of the delay step number, the delay coefficient is set to a first delay coefficient, wherein the first delay step number is the delay step number corresponding to the first flag bit indicating correct identification in the valid interval, and the first delay coefficient is a real number greater than 1; When the first delay step number is greater than or equal to half of the upper limit of the delay step number, the delay coefficient is set to a second delay coefficient, wherein the second delay coefficient is a real number greater than the first delay coefficient.
12. The calibration method according to claim 8, wherein: The situation where the preset condition is not met in the valid interval also includes: The calibration step length is adjusted until the upper limit of the cyclic inspection round is reached, and the obtained valid interval still does not meet the preset condition, In this case, the calibration type is changed, and the step of setting the initial calibration step and the initial value of the delay time according to the calibration type is returned, and then the calibration method is continued until the valid interval meets the preset conditions or reaches the upper limit of the cyclic inspection rounds.
13. The calibration method according to claim 12, wherein: The situation where the preset condition is not met in the valid interval also includes: The step of changing the calibration type is performed, and the calibration method is executed until the upper limit of the cyclic inspection round is reached, and the obtained valid interval still does not meet the preset conditions, In this case, the preset threshold of the effective interval ratio is reduced, and then the calibration method is continued to be executed until the effective interval meets the preset condition or reaches the upper limit of the cyclic inspection rounds.
14. An electronic device, characterized in that: The electronic device includes a memory, a processor, and a clock and data phase difference calibration method program stored in the memory and executable on the processor. When the clock and data phase difference calibration method program is executed by the processor, the steps of the clock and data phase difference calibration method as described in any one of claims 1 to 13 are implemented.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: The computer program is executed by a processor to implement the steps of the method for calibrating the clock and data phase difference as claimed in any one of claims 1 to 13.
Citation Information
Cited By
Phase calibration method, demodulation device, charger, electronic equipment and storage medium
CN120785702A
