CN115114217A - Method for improving data transmission quality, USB (universal serial bus) equipment and storage medium - Google Patents

Method for improving data transmission quality, USB (universal serial bus) equipment and storage medium Download PDF

Info

Publication number
CN115114217A
CN115114217A CN202210495399.XA CN202210495399A CN115114217A CN 115114217 A CN115114217 A CN 115114217A CN 202210495399 A CN202210495399 A CN 202210495399A CN 115114217 A CN115114217 A CN 115114217A
Authority
CN
China
Prior art keywords
value
preset
error
current
differential voltage
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210495399.XA
Other languages
Chinese (zh)
Inventor
郑炜
李铭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Huaray Technology Co Ltd
Original Assignee
Zhejiang Huaray Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Huaray Technology Co Ltd filed Critical Zhejiang Huaray Technology Co Ltd
Priority to CN202210495399.XA priority Critical patent/CN115114217A/en
Publication of CN115114217A publication Critical patent/CN115114217A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0042Universal serial bus [USB]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Systems (AREA)

Abstract

The application discloses a method for improving data transmission quality, a USB device and a storage medium, wherein the method is applied to the USB device supporting a USB3.0 protocol, the USB device is used for communicating with a receiving device through a communication link, and the method comprises the following steps: initializing hardware parameters of the USB equipment to obtain initial hardware parameters; counting the times of errors occurring in a communication link to obtain an error statistic value; in response to the error statistic value meeting a preset adjusting condition, optimizing the initial hardware parameters based on a preset adjusting strategy set to obtain optimized hardware parameters; and updating the USB equipment by using the optimized hardware parameters, and sending the data to be transmitted to the receiving equipment by using the updated USB equipment through a communication link. By means of the mode, the data transmission quality can be improved in a self-adaptive mode.

Description

Method for improving data transmission quality, USB (universal serial bus) equipment and storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method for improving data transmission quality, a USB device, and a storage medium.
Background
Because the hardware environments of the devices (i.e., USB devices) using the Universal Serial Bus (USB) are different, the hardware environments include the types of the USB devices, the USB3.0 communication Bus, and the receiving devices, and the like, during the communication process between the USB devices and the receiving devices, the USB devices are prone to have problems such as data packet loss or device disconnection, and the data transmission quality of the USB devices is seriously affected; in order to improve the data transmission quality, a hardware circuit of the USB equipment can be adjusted, but the scheme depends on professional detection equipment, so that the time cost and the labor cost are high; or, the hardware parameters affecting the data transmission quality can be adjusted by adopting manual experimental tests, but the method is limited by the hardware environment, cannot realize dynamic self-adaptive adjustment, and has strong limitation.
Disclosure of Invention
The application provides a method for improving data transmission quality, a USB device and a storage medium, which can improve the data transmission quality in a self-adaptive manner.
In order to solve the technical problem, the technical scheme adopted by the application is as follows: a method for improving data transmission quality is provided, and the method comprises the following steps: initializing hardware parameters of the USB equipment to obtain initial hardware parameters; counting the times of errors occurring in a communication link to obtain an error statistic value; in response to the error statistic value meeting a preset adjusting condition, optimizing the initial hardware parameters based on a preset adjusting strategy set to obtain optimized hardware parameters; and updating the USB equipment by using the optimized hardware parameters, and sending the data to be transmitted to the receiving equipment by using the updated USB equipment through the communication link.
In order to solve the above technical problem, another technical solution adopted by the present application is: there is provided a USB device, the USB device includes a memory and a processor connected to each other, wherein the memory is used for storing a computer program, and the computer program is used for implementing the method for improving data transmission quality in the above technical solution when being executed by the processor.
In order to solve the above technical problem, the present application adopts another technical solution: a computer-readable storage medium is provided, which is used for storing a computer program, and when the computer program is executed by a processor, the computer program is used for implementing the method for improving data transmission quality in the above technical solution.
Through the scheme, the beneficial effects of the application are that: initializing hardware parameters of the USB equipment to obtain initial hardware parameters; then, counting the times of errors of the communication link to obtain an error statistic value, and judging the data transmission quality of the communication link according to the error statistic value; when the error statistic value is judged to meet the preset adjustment condition, namely the data transmission quality of the communication link is poor, the initial hardware parameter can be optimized according to the preset adjustment strategy set to obtain an optimized hardware parameter, so that the USB equipment is updated by using the optimized hardware parameter, and the communication quality of the USB equipment and the receiving equipment is improved; according to the method and the device, the communication quality is monitored according to the error statistic value, so that the data transmission quality of a communication link is improved, manual intervention is not needed, meanwhile, a special integrated circuit chip or professional detection equipment is not needed, the cost is low, and the application range is wide.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts. Wherein:
fig. 1 is a schematic flowchart illustrating an embodiment of a method for improving data transmission quality provided in the present application;
fig. 2 is a schematic flowchart illustrating another embodiment of a method for improving data transmission quality provided in the present application;
FIG. 3 is a schematic flow chart diagram illustrating an embodiment of a first predetermined adjustment strategy provided herein;
FIG. 4 is a schematic flow chart diagram illustrating an embodiment of a second preset adjustment strategy provided herein;
FIG. 5 is a schematic structural diagram of an embodiment of a USB device provided in the present application;
FIG. 6 is a schematic structural diagram of an embodiment of a computer-readable storage medium provided in the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be noted that the following examples are only illustrative of the present application, and do not limit the scope of the present application. Likewise, the following examples are only some examples and not all examples of the present application, and all other examples obtained by a person of ordinary skill in the art without any inventive work are within the scope of the present application.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
It should be noted that the terms "first", "second" and "third" in the present application are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of indicated technical features. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of the feature. In the description of the present application, "plurality" means at least two, e.g., two, three, etc., unless explicitly specifically limited otherwise. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements but may alternatively include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating an embodiment of a method for improving data transmission quality, the method being applied to a USB device supporting a USB3.0 protocol, the USB device being configured to communicate with a receiving device through a communication link, the method including:
step 11: initializing the hardware parameters of the USB equipment to obtain initial hardware parameters.
The USB device may be a device that communicates with the receiving device via a USB protocol using a USB interface, and the USB device may be a USB camera or a USB scanner. Specifically, the receiving device may be a device having a USB interface, which may be a USB acquisition card, and the USB device may establish a communication link with the receiving device through a USB3.0 communication bus to perform data transmission through the communication link.
Further, the hardware parameter of the USB device may affect the data transmission quality of the USB device, and the hardware parameter of the USB device supporting the USB3.0 protocol may include a differential voltage swing (differential voltage swing), a de-emphasis level (de-emphasis) or a direct current differential impedance (DC differential impedance), and the like, where a value of the hardware parameter may affect the communication quality between the USB device and the receiving device, and the direct current differential impedance is determined by the hardware characteristics of the USB3.0 communication bus, such as: the impedance of the communication bus or the impedance of the USB interface, etc., which are fixed values, therefore, the present embodiment can improve the data transmission quality by adjusting the differential voltage swing and the de-emphasis level; specifically, the differential voltage swing and the de-emphasis level may be initialized to obtain initial hardware parameters, and then when poor communication quality is detected, the differential voltage swing and the de-emphasis level are adjusted to adapt to different hardware environments to the maximum extent and improve data transmission quality; it is to be understood that the initial hardware parameters may be custom set by a user based on experience, or automatically configured according to default parameter values, and are not limited herein.
Step 12: and counting the times of errors of the communication link to obtain an error statistic value.
Counting the number of times of errors of the communication link to obtain an error statistic value, wherein specifically, the USB device may include a USB3.0 control chip, the USB3.0 control chip may include a register, and the register in the USB3.0 control chip may count the number of times of errors of the communication link to obtain the error statistic value; the error statistic value can reflect the data transmission quality of the communication link, the more the error statistic value is, the worse the data transmission quality of the communication link is, the register can judge whether the current communication link has an error condition by monitoring the port state of the USB3.0 communication bus, and therefore the error times are counted when the error condition occurs.
Step 13: and in response to the error statistic value meeting the preset adjustment condition, optimizing the initial hardware parameters based on a preset adjustment strategy set to obtain optimized hardware parameters.
Whether a preset adjusting condition is met or not can be judged based on the error statistic value, when the error statistic value meets the preset adjusting condition, the data transmission quality of the communication link is poor, and at the moment, the data transmission quality of the communication link can be improved by optimizing initial hardware parameters; specifically, the initial hardware parameters may be optimized based on a preset adjustment policy set, so as to obtain optimized hardware parameters, and the preset adjustment policy set may be set by a user in a user-defined manner.
It can be understood that, in the process of optimizing the initial hardware parameters, the quality of the communication link can be monitored in real time, and when the error statistic value does not meet the preset adjustment condition, the data transmission quality of the communication link is good, which indicates that the hardware parameters are completely adjusted, so as to obtain the final optimized hardware parameters.
Step 14: and updating the USB equipment by using the optimized hardware parameters, and sending the data to be transmitted to the receiving equipment by using the updated USB equipment through the communication link.
After the optimized hardware parameters are obtained, updating the USB equipment by using the optimized hardware parameters, and sending data to be transmitted to the receiving equipment by using the updated USB equipment through a communication link so as to improve the data transmission quality of the communication link; specifically, the hardware parameters can be updated by restarting the USB device, when an error occurs in the communication link, the port of the USB device can automatically enter an error Recovery state (Recovery), and after the USB device is restarted, the port state can be switched to a training state (Polling), so that link training is performed again by using the optimized hardware parameters in the training state, and then the USB device enters a normal working state (U0), and performs a data transmission task, thereby improving the data transmission quality. It can be understood that the error recovery state, the training state, and the normal operating state are states of the USB device in the related art, and are not described herein again.
The embodiment monitors the communication quality through the error statistic value, and determines whether the current communication quality is good; when the current communication quality is poor, the initial hardware parameters of the USB equipment are optimized by adopting a self-defined parameter adjusting strategy, and the optimized parameters are used for updating the USB equipment, so that the data transmission quality of a communication link is improved, manual intervention is not needed, a special integrated circuit chip or professional detection equipment is not needed, the cost is low, and the application range is wide.
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating another embodiment of a method for improving data transmission quality according to the present application, the method including:
step 21: initializing the hardware parameters of the USB equipment to obtain initial hardware parameters.
Step 21 is the same as step 11 in the above embodiment, and is not described again here.
Step 22: and counting the times of errors of the communication link to obtain an error statistic value.
The method comprises the steps that the number of times of errors of a communication link is counted by using a register in the USB device to obtain an error statistic value, the conditions of the errors of the communication link can comprise a link error condition and a physical error condition, and the error statistic value can comprise a link error statistic value and a physical error statistic value; specifically, an error that causes the port state of the USB device to switch to the error recovery state may be referred to as a link error condition, and an error that does not cause the port state of the USB device to switch to the error recovery state may be referred to as a physical error condition; further, the number of times of occurrence of errors of the communication link may be counted at intervals of a preset period, so as to obtain a link error statistical value and a physical error statistical value, where the preset period may be set by user according to an actual situation, and may be 1s or 10s, which is not limited herein.
In an embodiment, after obtaining the link error statistic and the physical error statistic, the frequency of occurrence of the link error condition and the frequency of occurrence of the physical error condition may be respectively calculated according to the link error statistic and the physical error statistic, so as to determine the data transmission quality of the communication link according to the frequency of occurrence of the link error condition and the frequency of occurrence of the physical error condition, where the specific determination manner is as shown in steps 23 to 25; in other embodiments, the data transmission quality of the communication link may also be determined by directly using the link error statistics and the physical error statistics, which is not limited herein.
Step 23: and calculating the occurrence frequency of the link error condition based on the link error statistic value to obtain a first error frequency.
Calculating the occurrence frequency of the link error condition based on the link error statistic value to obtain a first error frequency; specifically, the link error statistic may be divided by the preset period to obtain a first error frequency, i.e., a frequency of occurrence of the link error condition.
And step 24: and calculating the frequency of the physical error situation based on the physical error statistic value to obtain a second error frequency.
Calculating the frequency of physical error conditions based on the physical error statistics to obtain a second error frequency; specifically, the physical error statistic may be divided by the preset period to obtain a second error frequency, i.e. the frequency of occurrence of the physical error condition.
Step 25: and judging whether the error statistic value meets a preset adjusting condition or not based on the first error frequency and the second error frequency.
Judging whether the error statistic value meets a preset adjusting condition or not according to the first error frequency and the second error frequency; specifically, it may be determined whether the first error frequency is greater than a first preset threshold and/or whether the second error frequency is greater than a second preset threshold; and if the first error frequency is greater than a first preset threshold value and/or the second error frequency is greater than a second preset threshold value, determining that the error statistic value meets a preset adjusting condition.
It can be understood that the first preset threshold is much smaller than the second preset threshold, and in the process of the actual test, when an error condition occurs on the communication link, that is, when the communication quality is poor, the frequency of occurrence of the physical error condition is much larger than the frequency of occurrence of the link error condition, for example: the frequency of occurrence of the physical error statistical condition is thousands of times per second or tens of thousands of times per second, and the frequency of occurrence of the link error condition may be only a few times per second, then the first preset threshold may be set to 1, and the second preset threshold may be set to 1000.
Step 26: and responding to the error statistic value meeting the preset adjusting condition, and judging whether a strategy selection instruction is received.
When the error statistic value meets the preset adjustment condition, optimizing the initial hardware parameter according to a preset adjustment strategy set to obtain an optimized hardware parameter; specifically, the preset adjustment policy set may include a first preset adjustment policy and a second preset adjustment policy, the initial hardware parameter may be optimized by selecting to adopt the first preset adjustment policy or the second preset adjustment policy through a policy selection instruction input by a user, and when the user does not make a policy selection, that is, the policy selection instruction is not input, the initial hardware parameter is optimized by default by adopting the first preset policy; otherwise, the initial hardware parameters may be optimized by using a second preset policy, where specific contents of the first preset adjustment policy and the second preset adjustment policy may be set by a user in a customized manner.
In other embodiments, the policy selection instruction may include a first policy selection instruction and a second policy selection instruction, and the initial hardware parameter may be optimized by using a first preset adjustment policy when the user inputs the first policy selection instruction; and when the user inputs a second strategy selection instruction, optimizing the initial hardware parameters by adopting a second preset adjustment strategy.
Step 27: and if the strategy selection instruction is not received, optimizing the initial hardware parameter by adopting a first preset adjustment strategy to obtain an optimized hardware parameter.
When the policy selection instruction is not received, the initial hardware parameter is optimized by using the first preset adjustment policy to obtain the optimized hardware parameter, as shown in fig. 3, the following describes the step of optimizing the initial hardware parameter by using the first preset adjustment policy to obtain the optimized hardware parameter.
Step 31: the initial hardware parameters are determined as current hardware parameters.
The current hardware parameter is a hardware parameter configured for the current communication between the USB device and the receiving device, and the hardware parameter of the USB device in this embodiment may include a differential voltage swing amplitude value and a de-emphasis level value, and the hardware parameter of the USB device is initialized to obtain an initial hardware parameter, and the initial hardware parameter may include an initial differential voltage swing amplitude value and an initial de-emphasis level value.
Step 32: and adjusting the current hardware parameter by using a preset increment value to obtain an intermediate hardware parameter.
Adjusting the current hardware parameter by a preset added value to obtain an intermediate hardware parameter, wherein the preset added value can be set by a user in a self-defined way and is not limited herein, the intermediate hardware parameter can comprise an intermediate differential voltage swing amplitude value and an intermediate de-emphasis level value, and the preset added value can comprise a first preset added value and a second preset added value; the initial differential voltage swing amplitude value and the initial de-emphasis level value can be respectively determined as the current differential voltage swing amplitude value and the current de-emphasis level value; then, adjusting the current differential voltage swing amplitude value by utilizing a first preset added value to obtain a middle differential voltage swing amplitude value; and then, adjusting the current de-emphasis level value by utilizing a second preset increment value to obtain an intermediate de-emphasis level value.
In a specific embodiment, the differential voltage swing amplitude value and the de-emphasis level value respectively correspond to a respective rated maximum value and a respective rated minimum value, and in order to adjust the current differential voltage swing amplitude value, it may be determined first whether the current differential voltage swing amplitude value is smaller than the maximum differential voltage swing amplitude value (i.e. the rated maximum value of the differential voltage swing amplitude value); if the current differential voltage swing amplitude is smaller than the maximum differential voltage swing amplitude, superposing the first preset added value and the current differential voltage swing amplitude to obtain an intermediate differential voltage swing amplitude; if the current differential voltage swing amplitude is greater than or equal to the maximum differential voltage swing amplitude, the minimum differential voltage swing amplitude (i.e., the rated minimum value of the differential voltage swing amplitudes) is used as the intermediate differential voltage swing amplitude.
To adjust the current de-emphasis level value, it may first be determined whether the current de-emphasis level value is less than a maximum de-emphasis level value (i.e., a nominal maximum of the de-emphasis level values); if the current de-emphasis level value is less than the maximum de-emphasis level value, overlapping the second preset added value with the current de-emphasis level value to obtain an intermediate de-emphasis level value; if the current de-emphasis level value is greater than or equal to the maximum de-emphasis level value, the minimum de-emphasis level value (i.e., the nominal minimum of the de-emphasis level values) is taken as the intermediate de-emphasis level value.
Step 33: and restarting the USB device to update the intermediate hardware parameters to the current hardware parameters of the USB device, so that the USB device communicates with the receiving device through the communication link based on the current hardware parameters.
After each parameter optimization, executing a restart operation, and updating the intermediate hardware parameter to the current hardware parameter of the USB equipment so that the USB equipment communicates with the receiving equipment through a communication link according to the current hardware parameter; and detecting the data transmission quality of the updated communication link, and judging whether the updated current hardware parameters can achieve the effect of improving the data transmission quality.
Step 34: and counting the times of errors of the communication link to obtain an error statistic value.
Step 34 is the same as step 22, and will not be described herein.
Step 35: and judging whether the error statistic value meets a preset adjusting condition or not.
Step 35 is the same as step 25, and will not be described herein.
Step 36: and if the error statistic value does not meet the preset adjustment condition, determining the current hardware parameter as the optimized hardware parameter.
When the error statistic value does not meet the preset adjustment condition, the updated current hardware parameter can improve the data transmission quality, and the current hardware parameter can be determined as an optimized hardware parameter; if the error statistic value meets the preset adjustment condition, the updated current hardware parameter still cannot improve the data transmission quality, at the moment, the step of adjusting the current hardware parameter by the preset increment value is returned, the current hardware parameter is continuously adjusted until the error statistic value does not meet the preset adjustment condition, and the current hardware parameter is determined as the optimized hardware parameter.
In a specific embodiment, the initial differential voltage swing value and the initial de-emphasis level value may be determined as the current differential voltage swing value and the current de-emphasis level value, respectively, the value of the current de-emphasis level value is fixed, the current differential voltage swing value is adjusted, the search value is after all differential voltage swing values between the minimum differential voltage swing value and the maximum differential voltage swing value, if the error statistic value still does not satisfy the preset adjustment condition, the current de-emphasis level value is adjusted, the second preset value and the current de-emphasis level value are superimposed to obtain an intermediate de-emphasis level value, and the intermediate de-emphasis level value is updated to the current de-emphasis level value; and then, returning to the step of fixing the current de-emphasis level value and adjusting the current differential voltage swing amplitude value until the error statistic value does not meet the preset adjustment condition.
It can be understood that, considering that the differential voltage swing value has a larger influence on the communication quality of the communication link than the de-emphasis level value, the de-emphasis level value may be fixed first and then the current differential voltage swing value may be adjusted; in other embodiments, a method of fixing the current differential voltage swing value and then adjusting the current de-emphasis level value may also be adopted, which is not limited herein.
Further, in order to adjust the current differential voltage swing amplitude value, the first preset added value and the current differential voltage swing amplitude value may be superimposed to obtain a middle differential voltage swing amplitude value; restarting the USB device, and updating the intermediate differential voltage swing amplitude value to a current differential voltage swing amplitude value of the USB device so that the USB device communicates with the receiving device through the communication link based on the current differential voltage swing amplitude value and the current de-emphasis level value; counting the times of errors occurring in a communication link to obtain an error statistic value; judging whether the error statistic value meets a preset adjusting condition or not; if the error statistic value meets the preset adjusting condition, the step of superposing the first preset added value and the current differential voltage swing value is returned until the error statistic value does not meet the preset adjusting condition.
If the error statistic value still meets the preset adjustment condition, judging whether the current differential voltage swing amplitude is the same as the initial differential voltage swing amplitude or not; if the current differential voltage swing amplitude is the same as the initial differential voltage swing amplitude, indicating that all differential voltage swing amplitudes within the range of the maximum differential voltage swing amplitude and the minimum differential voltage swing amplitude are traversed, superposing the second preset added value with the current de-emphasis level value to obtain an intermediate de-emphasis level value, and returning to the step of superposing the first preset added value with the current differential voltage swing amplitude until the error statistic value does not meet the preset adjustment condition.
For example, the first preset adjustment strategy is described by taking as an example a maximum de-emphasis level value of 4.0db, a minimum de-emphasis level value of 3.0db, an initial de-emphasis level value of 3.5db, a second preset increment of 0.1db, a maximum differential voltage swing value of 1.2V, a minimum differential voltage swing value of 0.8V, an initial differential voltage swing value of 1V, and a first preset increment of 0.1V.
Firstly, setting the current differential voltage swing amplitude value to be 1V, setting the current de-emphasis level value to be 3.5db, then fixing the current de-emphasis level value to be 3.5db unchanged, adding the current differential voltage swing amplitude value 1V and the first preset added value 0.1V, and updating the current differential voltage swing amplitude value to be 1.1V; then, until the amplitude value of the current differential voltage swing is increased to the maximum amplitude value of the differential voltage swing to be 1.2V, updating the amplitude value of the current differential voltage swing to be 0.8V of the minimum amplitude value of the differential voltage swing, and then continuing to add the first preset added value of 0.1V and the amplitude value of the current differential voltage swing to be 0.8V until the amplitude value of the current differential voltage swing returns to 1V, namely the amplitude value of the current differential voltage swing is the same as the amplitude value of the initial differential voltage swing, which indicates that all the amplitude values of the differential voltage swing are traversed on the premise that the current de-emphasis level value is 3.5 db; and if the error statistic value still meets the preset adjusting condition, adding the current de-emphasis level value of 3.5db and the second preset value of 0.1db, updating the current de-emphasis level value to 3.6db, fixing the current de-emphasis level value, and repeating the adjustment of the current differential voltage swing amplitude until the error statistic value does not meet the preset adjusting condition to obtain the optimized hardware parameter.
Specifically, the scheme for adjusting the current differential voltage swing value can be shown as the following formula:
Figure BDA0003632834460000101
wherein, V in the above formula n Representing the current differential voltage swing amplitude, V 0 Represents the initial differential voltage swing value, Δ V represents the first preset increment, n represents the number of adjustments, n starts from 0, the step size is 1, 0.8 represents the minimum differential voltage swing value, 1.2 represents the maximum differential voltage swing value, and the first time (V) 0 +n*ΔV)>1.2 occurrence is referred to as case one, and (V) 0 +(n-1)*ΔV)>1.2 occurrence is called case two, and under the condition of case one or case two, if the calculated V is n Greater than or equal to V 0 And finishing the adjustment of the amplitude of the differential voltage swing.
It can be understood that, the current de-emphasis level value may also be fixed first, and then the current de-emphasis level value is continuously adjusted to generate the optimized hardware parameter, which is similar to the scheme of fixing the current de-emphasis level value first and then continuously adjusting the current differential voltage swing value in the foregoing embodiment, and is not described herein again.
Step 28: and if a strategy selection instruction is received, optimizing the initial hardware parameters by adopting a second preset adjustment strategy to obtain optimized hardware parameters.
Reference hardware parameters can be obtained, and a parameter mapping table is established based on the reference hardware parameters, the parameter mapping table may include a model of at least one USB device, a type of a USB3.0 communication bus corresponding to the model of the USB device, a model of a receiving device, and reference hardware parameters, and the parameter mapping table may be stored in a non-volatile storage medium of the USB device, such as: programmable Read Only Memory (EEPROM) or FLASH memory (FLASH), etc. to prevent data loss.
Further, the reference hardware parameter may be an optimized hardware parameter corresponding to different types of USB devices, different types of receiving devices, or different types of USB3.0 communication buses obtained by using a first preset adjustment policy, or an optimal hardware parameter corresponding to different types of USB devices, different types of receiving devices, or different types of USB3.0 communication buses obtained by experimental tests in advance, so that an appropriate optimized hardware parameter can be obtained by matching in a parameter mapping table according to a current hardware environment, where the hardware environment includes the type of the USB device, the type of the USB3.0 communication bus corresponding to the type of the USB device, and the type of the receiving device, and as shown in fig. 4, a second preset adjustment policy is described below.
Step 41: and selecting a reference hardware parameter from the parameter mapping table to obtain the current reference hardware parameter.
Selecting a reference hardware parameter from the parameter mapping table to obtain a current reference hardware parameter; specifically, one reference hardware parameter can be sequentially selected from the parameter mapping table according to a preset sequence to serve as the current reference hardware parameter, and until the parameter mapping table is traversed, a proper optimized reference parameter is selected from the current reference hardware parameter; in other embodiments, according to the type of the current USB device, the type of the receiving device, or the type of the USB3.0 communication bus, the corresponding reference hardware parameters may be first screened from the parameter mapping table, and then the screened reference hardware parameters are sequentially used as the current reference hardware parameters, and then the appropriate optimized reference parameters are selected from the current reference hardware parameters.
Step 42: and updating the current reference hardware parameter to the current hardware parameter of the USB equipment, and counting the times of errors of the communication link to obtain an error counting value.
In order to verify the effect of the current reference hardware parameter on the data transmission quality of the communication link, the USB device may be restarted, the current reference hardware parameter is updated to the current hardware parameter of the USB device, and the number of times of the error occurring in the communication link is counted to obtain an error statistic value, where the step of obtaining the error statistic value is the same as the step 22, and is not described herein again.
Step 43: and judging whether the error statistic value meets a preset adjusting condition or not.
Step 43 is the same as step 25 above and will not be described further herein.
Step 44: and if the error statistic value does not meet the preset adjustment condition, determining the current hardware parameter as the optimized hardware parameter.
If the error statistic value does not meet the preset adjustment condition, the current reference hardware parameter can play a role in improving the data transmission quality, and at the moment, the current hardware parameter is used as an optimized hardware parameter. And if the error statistic value meets the preset adjustment condition, which indicates that the current reference hardware parameter cannot achieve the effect of improving the data transmission quality, returning to the step of selecting one reference hardware parameter from the parameter mapping table until the preset end condition is met to obtain the optimized hardware parameter, wherein when the error statistic value does not meet the preset adjustment condition or the traversal of the parameter mapping table is finished, the preset end condition is determined to be met.
In an embodiment, when the traversal of the parameter mapping table is completed and the error statistic satisfies the preset adjustment condition, that is, there is no hardware parameter suitable for the current hardware environment in the parameter mapping table, the step of optimizing the initial hardware parameter by using the first preset adjustment policy may be returned to obtain the optimized hardware parameter by using the first preset adjustment policy.
Step 29: and updating the USB equipment by using the optimized hardware parameters, and sending the data to be transmitted to the receiving equipment by using the updated USB equipment through the communication link.
After the optimized hardware parameters are obtained by using the first preset adjustment strategy or the second preset adjustment strategy, the USB equipment can be restarted to update the USB equipment by using the optimized hardware parameters, and the updated USB equipment is adopted to send data to be transmitted to the receiving equipment through the communication link; it can be understood that, when updating the hardware parameters of the USB device, the receiving device may also automatically perform a restart operation at the same time, so that both the USB device and the receiving device enter a training state to complete the update of the hardware parameters together, thereby implementing the optimization of the communication link between the USB device and the receiving device.
The embodiment can adaptively adjust the hardware parameters of the USB equipment according to the error statistic value, and select the current adjustment strategy from the preset adjustment strategy set according to the strategy selection instruction; traversing and debugging the de-emphasis level value and the differential voltage swing amplitude value through a first preset adjustment strategy to obtain optimized hardware parameters, dynamically adapting to various hardware environments, realizing high-quality data transmission under different hardware environments, improving the data transmission quality and having universality; and a second preset adjustment strategy is adopted to directly carry out matching through the parameter mapping table under different hardware environments to obtain optimized hardware parameters, so that quick adaptive parameter matching can be realized, and the time spent on updating the USB equipment is shortened.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an embodiment of a USB device provided in the present application, the USB device 50 includes a memory 51 and a processor 52 connected to each other, the memory 51 is used for storing a computer program, and the computer program is used for implementing the method for improving data transmission quality in the foregoing embodiment when being executed by the processor 52.
In one embodiment, the memory 51 is further configured to count the number of times that the communication link has errors, obtain an error statistic value, and feed the error statistic value back to the processor 52, where the memory 51 may be a register.
Referring to fig. 6, fig. 6 is a schematic structural diagram of an embodiment of a computer-readable storage medium 60 provided in the present application, where the computer-readable storage medium 61 is used for storing a computer program 61, and when the computer program 61 is executed by a processor, the computer program is used for implementing the method for improving data transmission quality in the foregoing embodiment.
The computer readable storage medium 60 may be a server, a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various media capable of storing program codes.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of modules or units is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units may be integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings, or which are directly or indirectly applied to other related technical fields, are intended to be included within the scope of the present application.

Claims (15)

1. A method for improving data transmission quality, applied to a USB device supporting a USB3.0 protocol, the USB device being configured to communicate with a receiving device via a communication link, the method comprising:
initializing the hardware parameters of the USB equipment to obtain initial hardware parameters;
counting the times of errors occurring in the communication link to obtain an error statistic value;
in response to the error statistic value meeting a preset adjustment condition, optimizing the initial hardware parameter based on a preset adjustment strategy set to obtain an optimized hardware parameter;
and updating the USB equipment by using the optimized hardware parameters, and sending data to be transmitted to the receiving equipment by using the updated USB equipment through the communication link.
2. The method according to claim 1, wherein the preset adjustment policy set includes a first preset adjustment policy and a second preset adjustment policy, and the step of optimizing the initial hardware parameter based on the preset adjustment policy set to obtain an optimized hardware parameter comprises:
judging whether a strategy selection instruction is received or not;
if not, optimizing the initial hardware parameter by adopting the first preset adjustment strategy to obtain the optimized hardware parameter;
and if so, optimizing the initial hardware parameter by adopting the second preset adjustment strategy to obtain the optimized hardware parameter.
3. The method according to claim 2, wherein the step of optimizing the initial hardware parameter by using a first preset adjustment strategy to obtain the optimized hardware parameter comprises:
determining the initial hardware parameter as a current hardware parameter;
adjusting the current hardware parameter by a preset increment value to obtain an intermediate hardware parameter;
restarting the USB device to update the intermediate hardware parameters to current hardware parameters of the USB device, thereby causing the USB device to communicate with the receiving device over the communication link based on the current hardware parameters;
counting the times of errors occurring in the communication link to obtain the error statistic value;
judging whether the error statistic value meets the preset adjusting condition or not;
if so, returning to the step of adjusting the current hardware parameter by the preset added value until the error statistic value does not meet the preset adjustment condition, and determining the current hardware parameter as the optimized hardware parameter.
4. The method of claim 3, wherein the hardware parameters comprise a differential voltage swing value and a de-emphasis level value, the initial hardware parameters comprise an initial differential voltage swing value and an initial de-emphasis level value, the intermediate hardware parameters comprise an intermediate differential voltage swing value, and the preset increment comprises a first preset increment; the method further comprises the following steps:
determining the initial differential voltage swing amplitude value and the initial de-emphasis level value as a current differential voltage swing amplitude value and a current de-emphasis level value respectively;
superposing the first preset increment and the current differential voltage swing value to obtain the intermediate differential voltage swing amplitude value;
restarting the USB device, updating the intermediate differential voltage swing value to a current differential voltage swing amplitude value of the USB device, so that the USB device communicates with the receiving device over the communication link based on the current differential voltage swing amplitude value and the current de-emphasis level value;
counting the times of errors occurring in the communication link to obtain the error statistic value;
judging whether the error statistic value meets the preset adjusting condition or not;
if so, returning to the step of superposing the first preset increment and the current differential voltage swing value until the error statistic value does not meet the preset adjustment condition.
5. The method of claim 4, wherein the method further comprises:
responding to the error statistic value meeting the preset adjusting condition, and judging whether the current differential voltage swing amplitude is smaller than the maximum differential voltage swing amplitude;
if so, superposing the first preset added value and the current differential voltage swing value to obtain a middle differential voltage swing amplitude value;
and if not, taking the minimum differential voltage swing amplitude as the middle differential voltage swing amplitude.
6. The method of claim 5, wherein the intermediate hardware parameter further comprises an intermediate de-emphasis level value, wherein the preset increment value further comprises a second preset increment value, and wherein the method further comprises:
responding to the error statistic value to meet the preset adjusting condition, and judging whether the current differential voltage swing amplitude is the same as the initial differential voltage swing amplitude;
and if so, overlapping the second preset increment and the current de-emphasis level value to obtain the intermediate de-emphasis level value.
7. The method of claim 6, wherein the step of superimposing the second predetermined increment value on the current de-emphasis level value to obtain the intermediate de-emphasis level value comprises:
determining whether the current de-emphasis level value is less than a maximum de-emphasis level value;
if so, superposing the second preset added value and the current de-emphasis level value to obtain an intermediate de-emphasis level value;
if not, the minimum de-emphasis level value is taken as the intermediate de-emphasis level value.
8. The method of claim 2, wherein the USB device is connected to the receiving device via a USB3.0 communication bus, the method further comprising:
acquiring reference hardware parameters, and establishing a parameter mapping table based on the reference hardware parameters, wherein the parameter mapping table comprises at least one type of the USB equipment, the type of the USB3.0 communication bus corresponding to the type of the USB equipment, the type of the receiving equipment and the reference hardware parameters;
the second preset adjustment strategy comprises:
selecting a reference hardware parameter from the parameter mapping table to obtain a current reference hardware parameter;
updating the current reference hardware parameter to the current hardware parameter of the USB equipment, and counting the times of errors of the communication link to obtain the error statistic value;
judging whether the error statistic value meets the preset adjusting condition or not;
if yes, returning to the step of selecting one reference hardware parameter from the parameter mapping table until a preset ending condition is met.
9. The method of claim 8,
when the error statistic value does not meet the preset adjusting condition or the traversal of the parameter mapping table is finished, determining that the preset ending condition is met;
and when the traversal of the parameter mapping table is completed and the error statistic value meets the preset adjusting condition, optimizing the initial hardware parameter by adopting the first preset adjusting strategy.
10. The method of claim 1, wherein the error condition of the communication link comprises a link error condition and a physical error condition, and the error statistic value comprises a link error statistic value and a physical error statistic value, the method further comprising:
calculating the occurrence frequency of the link error condition based on the link error statistic value to obtain a first error frequency;
calculating the frequency of the physical error condition based on the physical error statistic value to obtain a second error frequency;
and judging whether the error statistic value meets the preset adjusting condition or not based on the first error frequency and the second error frequency.
11. The method of claim 10, wherein the step of determining whether the error statistic satisfies the preset adjustment condition based on the first error frequency and the second error frequency comprises:
judging whether the first error frequency is greater than a first preset threshold value and/or whether the second error frequency is greater than a second preset threshold value;
if yes, determining that the error statistic value meets the preset adjusting condition.
12. The method of claim 10, further comprising:
counting the number of times of errors of the communication link at intervals of a preset period to obtain a link error statistic value and a physical error statistic value;
dividing the link error statistic value by the preset period to obtain the first error frequency;
and dividing the physical error statistic value with the preset period to obtain the second error frequency.
13. A USB device, characterized in that it comprises a memory and a processor connected to each other, wherein the memory is used to store a computer program, which when executed by the processor is used to implement the method of improving the quality of data transmission according to any of claims 1-12.
14. The USB device of claim 13,
the memory is also used for counting the times of errors of the communication link, obtaining an error statistic value and feeding back the error statistic value to the processor.
15. A computer-readable storage medium for storing a computer program, wherein the computer program, when being executed by a processor, is adapted to carry out the method for improving the quality of data transmission according to any one of claims 1 to 12.
CN202210495399.XA 2022-05-07 2022-05-07 Method for improving data transmission quality, USB (universal serial bus) equipment and storage medium Pending CN115114217A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210495399.XA CN115114217A (en) 2022-05-07 2022-05-07 Method for improving data transmission quality, USB (universal serial bus) equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210495399.XA CN115114217A (en) 2022-05-07 2022-05-07 Method for improving data transmission quality, USB (universal serial bus) equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115114217A true CN115114217A (en) 2022-09-27

Family

ID=83326085

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210495399.XA Pending CN115114217A (en) 2022-05-07 2022-05-07 Method for improving data transmission quality, USB (universal serial bus) equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115114217A (en)

Similar Documents

Publication Publication Date Title
WO2021212948A1 (en) Storage system boot method and apparatus, and computer-readable storage medium
US20210149581A1 (en) Memory system and operation method thereof
CN110908940A (en) Method for adjusting serial port communication parameters and terminal equipment
CN104333727A (en) Audio-video transmission channel regulation method, device and system
CN115801118A (en) Interface compensation parameter setting method and communication single board
CN102447621B (en) Optimal link selecting method and equipment
CN104601376A (en) Heartbeat message sending method and device
CN112217608B (en) Data rate adjusting method and device, computer readable medium and electronic equipment
CN113422620A (en) Communication rate control method, device, equipment and readable storage medium
US10986683B1 (en) Data communication method and system, electronic device, chip and storage medium
CN115114217A (en) Method for improving data transmission quality, USB (universal serial bus) equipment and storage medium
US7936845B2 (en) Apparatus, method and computer-readable recording medium for setting signal correction-magnitude
CN110380981B (en) Flow distribution method and equipment
CN111431824B (en) Method and system for PMD sublayer link training
CN103828294A (en) Credit based power management
CN112738053A (en) Video color ring playing method, system, server, network equipment and storage medium
CN114531357A (en) Account checking method and device for configuration information
CN109062832B (en) Method, device and storage medium for adjusting I2C bus parameters
CN110069293A (en) A kind of mthods, systems and devices of upgrade server software
CN114915569B (en) Heartbeat intelligent control method, device, electronic device and storage medium
CN111367719B (en) Storage system starting method, device, equipment and medium
CN108897629A (en) A kind of EJB call parameters transmission method and relevant apparatus
CN109769270B (en) Working bandwidth adjusting method and device
CN114024882B (en) Router performance test method, device, system and storage medium
CN217789686U (en) QSGMII signal transmission packet loss processing circuit

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination