Tuning parameters of the isochronous endpoint of a USB peripheral device in a multimedia system

. Data exchange in the multimedia system between the camera and the computer can be realized via the USB communication interface. Applying the USB port requires tuning the port parameters in such systems to ensure the quality of the services (multimedia) provided. The tuning of the communication system depends on such selection of port parameters to optimize the imposed criteria. The authors proposed a quality criterion based on the USB isochronous interval. The paper briefly presents the quality measure and the transmission model of the data package. Next, the problem of tuning the USB port was presented based on the selected parameters (MaxPacketSize and MaxBurst) of the endpoint of the peripheral device. To assess the impact of the selected parameter on the quality of services in the system, a statistical test for homoscedasticity of empirical distributions of isochronous intervals, was used. Besides the results of the conducted experiments for the selected parameters presented in the paper, the authors also tried to explain the obtained results in relation to the specification of the USB port.


Introduction
The issues and results of experiments, presented in the article, are the extension of conducted research on ensuring the quality of delivered services (QoS) through communication interfaces, in this case USB. In the works of [2]- [3], [10]- [11], the issue of QoS for the USB interface in version 2.0 was discussed. The architecture of the latest version of this port, 3.1, has been completely revised, and the solutions proposed in the quoted publications cannot be applied to the latest version of the USB port (USB 3.1 Gen 1). Some attempts to define the process model data in a USB 3.1 port has been made in the work [5]- [6]. The similar problem of applying QoS, defined in this case as ensuring the synchronization of peripheral devices using the broadcast mechanism of isochronous time stamps, was also considered in paper [4].
Determining the impact of the selected computer system parameter on the quality of scheduling of packets over time, must be the subject of statistical evaluation. Therefore, a test for homoscedasticity [15] of empirical distributions of USB 3.1 isochronous intervals was proposed. For this purpose, the Levene test was used, adapting it to the realities of the USB communication port. The validity of using the statistical test is shown in the examples by verifying the hypothesis about the impact of selected parameters (MaxPacketSize and MaxBurst) contained in descriptors of the isochronous endpoint on the quality of provided multimedia services.

Definition of the isochronous interval
The specification [1] introduces three types of intervals:  bus interval (Tbus),  service interval (Tsrv),  isochronous interval (Tiso), occurring in periodic transfers (interrupt and isochronous). As mentioned in the introduction, the isochronous interval, which is crucial for the conducted research, is defined below in a formal way. As the isochronous interval can be apply to any pair of (sub)packets (keeping the order inside the transaction) of two following transactions, the concept of isochronous interval with the number k has been introduced. Let the set S contains moments of packet transmission start (sp) in a certain segment of the USB communication system. The isochronous interval with the number k on the set S is the interval between the beginnings of transmission of k (sub)packets of two following transactions of the same i-th periodic transfer (interrupt or isochronous) and is expressed as: It is worth noting that the set S is an example of metric space, because the isochronous interval T k (i,j) complies with three axioms of the metric: determinism, symmetry and the principle of triangle inequality.

Ensuring the quality of transport services for multimedia data
The number of possible criteria used for evaluation of the communication interface is high, that is why the publication is limited only to the evaluation of the transmission quality of one data class: multimedia (like [7]- [8]). The USB specification only mentions the need to provide the bandwidth and limited delay for isochronous transmission in general. Therefore, the following criterion is proposed for the assessment of the transport services quality (QoS): regular short "lifetime" data delivery (quickly outdated multimedia data), i.e. the realization of periodic transactions (more strictly isochronous) at equal intervals (isochronous intervals). The measure that arises at once is variance. It allows the authors to determine whether the variability occurs in the population of isochronous intervals.
Formalizing, the measure defining the quality of transport services for multimedia data is the form: Such measure is a non-negative function (it results from the definition of variance), so it is desirable to minimize the value of this measure.

4
Homoscedasticity of empirical distributions of isochronous intervals As mentioned in the introduction, the aim of the presented research was to verify hypotheses about the existence of the influence of selected parameters (defined by λ) on the quality of transport services, in this case determined by measure (2).
Assuming, to simplify the explanation, that in a computer system multimedia data are transmitted from only one device, it can be expected that the λ parameter will have a significant effect on the quality function (2). There are statistical tests to identify what influence can have hanging a parameter on the variance of a measurement, because in fact a measure (2) is a variance of isochronous intervals. These tests are so-called tests for homo-and heteroscedasticity. In other words, homoand heterogeneity of variance in a set of random samples (isochronous intervals) due to parameter values.
Concluding the presented description of the homoscedasticity phenomenon, it was assumed that Λ = {λ1, .., λh} will be a set of possible values of the λ parameter. The random sample of the isochronous interval T 0 for the λ parameter with the value λi will be denoted by T(λi). If T = {T(λ1), .., T(λh)} will be a set of random samples received for subsequent values parameter λ, this experiment is e : Λ → T. The variance (also the quality function (2)) random sample T(λi) will be denoted by V(λi).
The homoscedasticity of the set T means that The verification of homoscedasticity can be performed based on a parametric test: H0: homoscedasticity H1: heteroscedasticity The proposed test should be resistant to changing the average value. Finally, the distribution of isochronous intervals is unknown, so it should not be assumed that it is always a normal distribution.
In conclusion, it can be stated that a statistical test to verify the hypothesis about the effect of the λ parameter on the quality function (2): 1) was resistant to changing the mean value, 2) did not require ex definitione the normal distribution of random sample, 3) allowed random samples of different size.
The test that meets the above postulates is the Levene test [9].
Maintaining the formulated hypothesis of the parametric test and the introduced symbols, Levene's test statistic is: where: and has a F-Snedecor distribution with degrees of freedom (h − 1, Nh). The hypothesis of homoscedasticity (H0) should be rejected at the significance level of α, if the value of the test statistic is inside the critical region as: where F is the quantile of the distribution of this test statistic. If the verdict of the homoscedasticity test assumes rejecting the hypothesis H0 for the entire set Λ with α-error, it is suggested to run homoscedasticity tests for elements of the set P(Λ), excluding single-element collections. However, only for Λ with a "low" cardinality, to avoid Cantor's theorem and carrying out a huge number of statistical tests. Such prepared test will be used to verify hypotheses about the impact of selected parameters of the isochronous endpoint on the quality of multimedia services provided.

Tuning peripheral device
Parameters of the peripheral device are exceptionally significant in the configuration of the communication system. In the case of a USB interface, all device parameters have been gathered into one structure [12]: a set of descriptors. Two descriptors are connected with the endpoint: the endpoint and the endpoint companion descriptor. They contain a number of parameters that can affect quality (2): 1) The maximum size of the data field of subpacket DPP (MaxPacketSize parameter).
2) The maximum length of the burst transaction of isochronous transfer (MaxBurst parameter). In the following sections, the endpoint parameters were assessed to determine whether the change in their value influences significantly the quality of multimedia services offered by the USB port.

Maximum size of the DPP subpacket data field
MaxPacketSize parameter in fact, it is the upper limit of the data field size (payload) of DPP subpackets. This means that the endpoint is able to accept (in the case of writing) or send (in the case of reading) a subpacket with a data field with a size not larger than the MaxPacketSize parameter. The specification [1] allows the value of this parameter from the set: ∈ {1, 2, . . . ,1024}, if it is allowed to perform the burst transaction, this parameter must be set to a maximum value of 1024. If in the transaction occurs packet with data payload less than MaxPacketSize, this is the last packet in the series.
In addition, the number of experiments to be performed, and thus statistical tests, has been limited, choosing from the set only three values: ∈ {16,512,1024}. The smallest value of λ = 16 results from the constraint imposed by the DMA chip used in the embedded peripheral device. Namely, it is required that the size of the buffer in the DMA channel is a multiple of 16, which means assuming that the buffer stores one DPP subpacket that the minimum data field size is 16. The largest value λ = 1024 results from the specification and the second value from the set λ: 512 is the value of from the middle of the set.
To sum up, the presented study aims to verify whether there is an impact of the supremum of data field size on the transport services quality: Hypothesis 1 The quality of transport services USB 3.1 multimedia data does not depend on the value of the parameter MaxPacketSize.

Experiments and their results
A test stand was prepared, its parameters are listed in Tab.1 and the parameter to be tuned is described as λ. The statistical test was limited to the entire Λ. The table 2 contains a verdict based on a statistical test. The test statistic value is outside the critical region, which means there is no reason to reject the hypothesis about homoscedasticity. Nevertheless, this does not mean that the MaxPacketSize parameter is certainly homoscedasticity of the distributions of empirical isochronous intervals. The truth of this thesis can only be presumed and the attempt can be made to justify it.  Along with the results in a tabular form, a boxplot was also (Fig. 1) prepared. It clearly illustrates the variability of the obtained empirical distributions. The whiskers in the charts stands for the limits of the 1.5 times larger range than the quarter interval.
Additionally, in Gantt charts (Fig. 2) the selected fragments of activity (TP packet transmission) are shown in the segment between the controller host and the peripheral device registered with the analyzer. Because the transmission of one TP packet takes only 40 ns and the time is significantly shorter than the service interval (e.g. 125 µs), therefore, in order to show more packages on Gantt charts, the warping time method [13] was used. The time warping function (using symbols described in [6] is as follows: where p is the tuple (1, j ∈ {1..M(1)}, 0), and δ is warping time factor expressed in percentage. Unless otherwise specified, the δ factor is 99%.

Substantiation
The isochronous interval (1) used to make the quality criterion (2) refers, in its definition, to the beginnings of the transmission of two subsequent packets. The MaxPacketSize parameter, on the other hand, affects the packet transmission time, because the more data is sent, the longer the transmission of such a packet is. The maximum size of the data field, however, does not affect the start of packet transmission, i.e. it does not affect the value of the quality measure (2), which proves the hypothesis about homoscedasticity In conclusion, the statistical analysis did not provide reasons for rejecting the hypothesis about homoscedasticity at the significance level of 0.05, and the justification confirmed the hypothesis (1), hence the conclusion: Conclusion 1 The quality of transport services USB 3.1 of multimedia data does not depend on the maximum size of the data field.

Maximum length of a burst transaction
Another parameter available in the associate descriptor and introduced in version 3.0 of the interface, is the maximum length of the burst transaction expressed by MaxBurst. As mentioned in the previous section, if burst transactions are allowed in the USB system, the maximum data field size is imposed from the upper value in the form of 1024 bytes of data in one DPP subpacket. Therefore, as established before, in the following experiments the value that has no influence on the quality of multimedia service in USB was adopted.
In the read operation from the isochronous endpoint, the burst transaction begins with the TP transaction packet being sent to the peripheral device, and the series (reference to the transaction type) of the DPH and DPP subpackets pairs from the peripheral to the host is sent back. The quality criterion (2) in its definition refers to the isochronous interval with the number zero, i.e. to the isochronous interval between two consecutive TP packets. Thus, there is no explicit relationship between the transmission of subpackets DPH-DPP and the function value (2). It can be presumed that similarly, in this case, there is a homoscedasticity phenomenon, and the discussed parameter does not affect the quality of multimedia data transmission. This assumption is expressed in the form of a hypothesis: Hypothesis 2 The quality of transport services USB 3.1 multimedia data does not depend on the value of the parameter MaxBurst. This hypothesis, based on the results of the experiments, was later subjected to statistical verification.

Experiments and their results
A test stand was prepared as described in point 5.1.1. Table 3 contains verdict based on the conducted statistical test for three values of MaxBurst. The Fig. 3 presents a comparison of empirical distributions of isochronous intervals for the MaxBurst parameter. The bar graph in the Fig. 4 presents a comparison of the quality function for three values of the MaxBurst parameter. The value of the quality function (2) is expressed as the root of this value, which in fact gives a standard deviation. Consequently, it enables to compare dimensional values (in units). The value of the test statistic in the table 3 is inside the critical region, which means that the null hypothesis must be rejected (and therefore the hypothesis 2) and take an alternative one. Contrary to predictions, it was determined in the current case that there is a phenomenon of heteroscedasticity for the MaxBurst parameter. In other words, it means: Conclusion 2 The quality of transport services USB 3.1 of multimedia data depends on the maximum length of a burst transaction. The graph from Fig. 4 illustrates the trend of this dependence. The longer the burst transaction, the worse quality is received. Moreover, the fragments of activity in the segment between the controller host and the peripheral device for three values of the MaxBurst parameter were also analyzed. The third Gantt diagram in Fig. 5 shows how unstable the USB communication is with burst transactions that is getting longer. It is worth noting that the controller host makes several attempts to initiate transactions within one service interval. Only the last attempt ends with sending back by the peripheral device three pairs of DPH-DPP subpackages.

Conclusion
Two parameters (MaxPacketSize and MaxBurst) assumed of influencing the quality and stability of transporting multimedia data in the USB system were selected as part of the research. The parameters are available in device descriptors and their values can only be selected during the design and implementation process of the embedded software of such a device. During the enumeration procedure, the host controller selects one of several available device configurations, but cannot change the values of these two parameters. Therefore, it is vital to choose the right settings for these two parameters. Experiments and analysis have shown that the first of the MaxPacketSize parameters does not aect the quality of multimedia services in the USB system, and the embedded software developer can determine its value freely. In case of the maximum length of the burst transaction (MaxBurst parameter), the situation is slightly diferent. This parameter significantly affects not only the quality of data transport, but also the stability of the communication system. It is recommended to avoid long burst transactions. Instead, other mechanisms can be applied to increase the amount of data transmitted in the service interval, e.g. use broadband transmission (Mult parameter).