Abstract:
A method for determining a trigger level for a periodic analog signal in a digital signal processing system is provided. The method reduces output jitter as much as possible and avoids false trigger events. To this end, the method includes measuring the minimum and maximum values of the signal in a predetermined time, defining a plurality of potential trigger values between the minimum and maximum values, assigning to the respective potential trigger value a jitter value characteristic for the jitter created by processing the signal with the potential trigger value, and determining the optimal trigger level based on the lowest jitter value.

Description:
CROSS REFERENCE TO RELATED APPLICATIONS 
       [0001]    The present application claims priority to European Patent Office application No. 12163978.5 EP filed Apr. 12, 2012, the entire content of which is hereby incorporated herein by reference. 
       FIELD OF INVENTION 
       [0002]    The invention concerns a method for determining a trigger level for a periodic analog signal in a digital signal processing system. 
       BACKGROUND OF INVENTION 
       [0003]    Digital signal processing (DSP) is concerned with the representation of discrete time, discrete frequency, or other discrete domain signals by a sequence of numbers or symbols and the processing of these signals. The goal of DSP is usually to measure, filter and/or compress continuous real-world analog signals. The first step is usually to convert the signal from an analog to a digital form, by sampling and then digitizing it using an analog-to-digital converter (ADC), which turns the analog signal into a stream of numbers. 
         [0004]    The main applications of DSP are audio signal processing, audio compression, digital image processing, video compression, speech processing, speech recognition, digital communications, RADAR, SONAR, seismology and biomedicine. Specific examples are speech compression and transmission in digital mobile phones, room correction of sound in hi-fi and sound reinforcement applications, weather forecasting, economic forecasting, seismic data processing, analysis and control of industrial processes, medical imaging such as CAT scans and MRI, MP3 compression, computer graphics, image manipulation, hi-fi loudspeaker crossovers and equalization, and audio effects for use with electric guitar amplifiers. 
         [0005]    DSP often requires accurate pulse-based measurements in connection with periodic analog signals. Here, an analog pulse signal is measured by determining a trigger level and creating a digital output each time when the analog signal level crosses the trigger level in a predetermined direction (rising or falling). Due to natural fluctuations of the analog signal, jitter will occur. Jitter is the undesired deviation from true periodicity of the periodic signal. 
         [0006]    Usually, determination of trigger level consists of determination of the maximum and minimum levels of the input signal, then using the half point between minimum and maximum. Sometimes this method is not proper, e.g. when additional, lower amplitude peaks can appear in the trigger signal due to reflections. 
       SUMMARY OF INVENTION 
       [0007]    Therefore, the problem that the invention wants to solve is to provide a method for determining a trigger level in order to reduce output jitter as much as possible and avoid false trigger events. 
         [0008]    This problem is inventively solved by a method comprising the steps of:
   measuring the minimum and maximum values of the signal in a predetermined time,   defining a plurality of potential trigger values between the minimum and maximum values,   assigning to the respective potential trigger value a jitter value characteristic for the jitter created by processing the signal with the potential trigger value, and   determining the optimal trigger level based on the lowest jitter value.   
 
         [0013]    The invention is based on the consideration that output jitter is highly dependent on the trigger level choice for processing of the signal. Thus, the trigger level should be carefully chosen from a plurality of potential trigger levels. These trigger levels should be distributed between the minimum and maximum levels of the analog signal that has been measured for a predetermined time in order to have a broad range of potential trigger levels. To find the best trigger level, the jitter created by processing the signal with a number of the potential trigger levels is evaluated. The evaluation and possible further manipulations result in a jitter value characteristic for the jitter. Then, the optimal trigger level is determined based on the lowest jitter value. 
         [0014]    Advantageously, the predetermined time for measuring the analog signal is longer than the period of the signal. This ensures that the measurement will indeed cover the global minimum and maximum of the signal and thus a proper choice of potential trigger values. 
         [0015]    Furthermore, the potential trigger values are advantageously evenly spaced. This ensures a broad range of different trigger values for the choice. 
         [0016]    Another problem regarding trigger levels occurs when the analog signal strength changes. With simple methods, small changes in the amplitude can change the trigger level or the trigger-based detection can fail due to big changes in the analog signal. Therefore, the trigger level must not always be adjusted, because this can produce jitter on phase measurements based on trigger pulses. However, at strong signal changes the trigger level should be changed, otherwise trigger detection can fail. This problem is solved by advantageously interrupting the execution of the method as described above if the difference of the measured minimum and maximum values of the signal differ from the minimum and maximum values measured during a previous execution of the method by less than a predetermined value. 
         [0017]    Determination of the jitter level of a given potential trigger level can be done by various ways. Advantageously, the jitter created by processing the signal is determined by means of a linear regression over a plurality of periods of the signal. This ensures a reliable assessment of the jitter created by a certain trigger level. Advantageously, the linear regression should be extended to 5 or more periods of the signal. 
         [0018]    To improve the determination of the optimal trigger level, the jitter values measured in a first step can be further manipulated during assignment of the jitter value to a certain trigger level. Advantageously, assigning a jitter value includes taking a sliding average over a plurality of trigger values. At fine trigger level resolution this method can help to keep distance from trigger parts where the jitter suddenly increases. However, when the trigger level resolution is rough (e.g. only 5 levels) this step may be unnecessary. 
         [0019]    Furthermore, assigning a jitter value advantageously includes replacing a measured value with a predetermined threshold value. If the jitter at a given trigger band is lower than this value, then it is accepted as ‘very good jitter level’, regardless to its exact value and replaced by the threshold level. This means that in the following procedures, these low jitter levels will be handled uniformly which simplifies these procedures. 
         [0020]    Assigning a jitter value further advantageously includes weighting a plurality of measured values with a predetermined weighting function. For example, a V-shaped weighting function can be used to shift the optimum towards the middle of the trigger safe area. Usually, this very small weighting has no effect. It is useful when the trigger output signal is near to the ideal one and all potential trigger levels have the same small jitter. In this case any of the trigger levels can be chosen. The best choice in this case is to choose the middle one. With this gentle weighting this is also possible. 
         [0021]    A digital signal processing system advantageously comprises means for executing the method of any of the preceding claims. 
         [0022]    The advantages achieved by the present invention include the provision of a new trigger level calculation method that is able to determine proper trigger levels automatically from the digitized analog input signal. The trigger level determination is based on jitter measurement on different trigger levels. For the comparison, the measured jitter levels are further processed: filtered, thresholded and weighted to ensure proper trigger selection in extreme cases as well. The accuracy of calculations is improved by using linear interpolation between neighbouring samples around the trigger level to determine trigger times more accurately. Furthermore, the method changes the output only, if the input signal is significantly changed. This behavior is advantageous at phase measurements to avoid additional phase jitter because of trigger level change. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0023]    An embodiment of the invention is further explained by means of a FIGURE, wherein the only FIGURE shows a representative block diagram of the method steps to determine a trigger level. 
       
    
    
     DETAILED DESCRIPTION OF INVENTION 
       [0024]    The method according to the embodiment of the FIGURE requires the following parameters:
   Trigger timeout value, T, from which a measurement update time can be calculated   “Low voltage” value   Minimum and maximum “safe area” limits, L1 and L2   Trigger slope direction, bRisingDirection   Number of possible trigger levels to be examined, N   
 
         [0030]    The timeout value T is a time interval within which the input signal makes at least one period. Safe area limits are limit numbers given in percent. If the interval between the minimum and maximum value of input signal is 0-100%, then minimum and maximum safe area numbers select a smaller interval in which the optimum trigger level can be selected. Trigger slope direction tells, if the trigger level to be determined relates to rising edge (bRisingDirection=TRUE) or falling edge (bRisingDirection=FALSE). 
         [0031]    The method consists of the following states:
   STATE1: Measuring  1  the minimum and maximum values of the analog input signal. This procedure should last at least T time for observation to be sure that at least one full period passes, hence the real minimum and maximum value appear in the input signal. If ready, the state is changed to STATE2.   STATE2: Determining a peak-to-peak quality number and check if signal level is acceptable. Check  2  also, if the signal level significantly differs compared to the previous extended measurement. If the signal level is not acceptable or the difference is small, then extended measurement is not necessary and the method is interrupted  3 . If the difference is sufficient, then determine auxiliary parameters for further observations, particularly define  4  a plurality of potential trigger values between the minimum and maximum values and go further to STATE3. The potential trigger values are evenly spaced.   
 
         [0034]    The pseudocode for this is shown in the following: 
         [0000]    
       
         
               
             
               
               
             
               
               
             
               
               
               
             
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
             
           
               
                   
               
             
             
               
                 STATE2: 
               
             
          
           
               
                 Quality_P2P = Max−Min; 
                 %determine Peak-to-peak quality number 
               
             
          
           
               
                 if ( (Max−Min) &lt; LOW_ VOLTAGE ) 
                 %level of input signal is 
               
             
          
           
               
                   
                 status = STATE1; 
                 not enough 
               
             
          
           
               
                 end; 
               
               
                 %determine safe area: 
               
               
                 S1 = (Max−Min)*L1/100 + Min; 
               
               
                 S2 = (Max−Min)*L2/100 + Min; 
               
               
                 %determine hysteresis for trigger examination 
               
               
                 Hyst = (Max−Min)/N; 
               
               
                 %determine recommended hysteresis of triggering 
               
               
                 Recommended_Hysteresis = 2*Hyst; 
               
               
                 if(bRisingDirection) 
               
             
          
           
               
                   
                 Hyst = −Hyst; 
               
             
          
           
               
                 end; 
               
               
                 %define N+1 trigger levels in the safe area 
               
               
                 Diff=(S2−S1)/(N−1); 
               
               
                 for(i=0;i&lt;N;i++) 
               
             
          
           
               
                   
                 TrigLevels[i] = S1 + i*Diff; 
               
               
                   
                 HystLevels[i] = TrigLevels[i] + Hyst; 
               
             
          
           
               
                 end; 
               
               
                 %check if measured new minimum and maximum values are 
               
               
                 %significantly differ from the old ones. If the difference 
               
               
                 %is smaller than (S2−S1)/(2*N), then change is not 
               
               
                 % significant and further examination is not necessary 
               
               
                 Diff =(S2−S1)/(2*N); 
               
               
                 Diff1 = abs(S1−S1_old); 
               
               
                 Diff2 = abs(S2−S2_old); 
               
               
                 S1_old = S1; 
               
               
                 S2_old = S2; 
               
               
                 if (( Diff1 &lt; Diff ) AND ( Diff2 &lt; Diff )) 
               
             
          
           
               
                   
                 status = STATE1; 
               
             
          
           
               
                 else 
               
             
          
           
               
                   
                 status = STATE3; 
               
             
          
           
               
                 end; 
               
               
                   
               
             
          
         
       
     
         [0035]    STATE3: performing extended measurement. The length of this extended measurement is 5 times timeout for each trigger level to collect several periods and determine periodlength jitter and average with enough accuracy. This determination can be run parallel on all trigger levels to save measurement time, but also can be run serial to save CPU time. The trigger detection has the following psudocode: 
         [0000]    
       
         
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
           
               
                   
                   
               
             
             
               
                   
                 % inputs are 
               
               
                   
                 float HystLevel; %actual hysteresis level from HystLevels[ ] 
               
               
                   
                 float Triglevel; % actual trigger level from TrigLevels[ ] 
               
               
                   
                 float x[ ]; % array of input samples 
               
               
                   
                 %auxiliary variables: 
               
               
                   
                 int i; 
               
               
                   
                 bool bTrigDetect; 
               
               
                   
                 STATE3: 
               
             
          
           
               
                   
                 if(bRisingDirection) 
               
             
          
           
               
                   
                 for i = each_incoming_sample_position 
               
             
          
           
               
                   
                 if( x[i] &lt; HystLevel) 
               
             
          
           
               
                   
                 bTrigDetect = TRUE; 
               
             
          
           
               
                   
                 end; 
               
               
                   
                 if(bTrigDetect AND (x[i]&gt;=TrigLevel)) 
               
             
          
           
               
                   
                 bTrigDetect = FALSE; 
               
               
                   
                 calculate_auxiliary_variables(x[i],x[i−1]); 
               
             
          
           
               
                   
                 end; 
               
             
          
           
               
                   
                 end for; 
               
             
          
           
               
                   
                 else 
               
             
          
           
               
                   
                 for i = each_incoming_sample_position 
               
             
          
           
               
                   
                 if( x[i] &gt; HystLevel) 
               
             
          
           
               
                   
                 bTrigDetect = TRUE; 
               
             
          
           
               
                   
                 end; 
               
               
                   
                 if(bTrigDetect AND (x[i]&lt;=TrigLevel)) 
               
             
          
           
               
                   
                 bTrigDetect = FALSE; 
               
               
                   
                 calculate_auxiliary_variables(x[i],x[i−1]); 
               
             
          
           
               
                   
                 end; 
               
             
          
           
               
                   
                 end for; 
               
             
          
           
               
                   
                 end; 
               
               
                   
                   
               
             
          
         
       
     
         [0036]    Calculation of auxiliary variables means a recursive regression calculation. It uses linear interpolation to determine the trigger time more accurate: 
         [0000]    
       
         
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
           
               
                   
                   
               
             
             
               
                   
                 div = (x[i−1] − x[i]); 
               
               
                   
                 if(div != 0.0f) 
               
               
                   
                 { 
               
             
          
           
               
                   
                 Correction = ((x[i] − TrigLevel) / fdiv); 
               
             
          
           
               
                   
                 } 
               
               
                   
                 else 
               
               
                   
                 { 
               
             
          
           
               
                   
                 Correction = 0.0f; 
               
             
          
           
               
                   
                 } 
               
               
                   
                 Tperiod = Tperiod + Correction; 
               
               
                   
                   
               
             
          
         
       
     
         [0037]    The auxiliary variables for regression calculation are:
   Sy: sum of (actual periodlength value−reference value),   Syy: sum of square of (actual periodlength value−reference value),   Sxy: number of actually period counted from measurement start, Cnt, multiplied with (periodlength value−reference value).   
 
         [0041]    The reference value can be the first periodlength value. This helps to keep the sum of numbers small and therefore accurate. Calculation of jitter is the following: 
         [0000]    
       
         
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
               
             
               
               
             
               
               
             
           
               
                   
                   
               
             
             
               
                   
                 float A; % lin reg. steepness 
               
               
                   
                 float B; % lin reg. offset 
               
               
                   
                 float J; % lin reg. variance 
               
               
                   
                 float P; % inner variable for lin reg calculation 
               
               
                   
                 float Q; % inner variable for lin reg calculation 
               
               
                   
                 float R; % inner variable for lin reg calculation 
               
               
                   
                 float S; % inner variable for lin reg calculation 
               
               
                   
                 float Aux; % inner variable for lin reg calculation 
               
               
                   
                 float Sx; % first moment of input 
               
               
                   
                 float Sxx; % second moment of input 
               
               
                   
                 Sx = (Cnt*(Cnt + 1))/2; 
               
               
                   
                 Sxx = (Cnt * (Cnt + 1) * ((2 * Cnt) + 1)) / 6; 
               
               
                   
                 Aux = ((Cnt * Sxx) − (Sx * Sx)); 
               
               
                   
                 if( 0 &lt; Aux ) 
               
               
                   
                 { 
               
             
          
           
               
                   
                 Aux = 1/Aux; 
               
             
          
           
               
                   
                 } 
               
               
                   
                 P = Cnt * Aux; 
               
               
                   
                 Q = Sx * Aux; 
               
               
                   
                 R = 1 / Cnt; 
               
               
                   
                 S = Sx * R; 
               
               
                   
                 A = (P * Sxy) − (Q * Sy); 
               
               
                   
                 B = (R * Sy) − (S * A); 
               
               
                   
                 J = (((Syy 
               
             
          
           
               
                   
                 − (2 * B * Sy)) 
               
               
                   
                 − (2 * A * Sxy)) 
               
               
                   
                 + (Cnt * B * B) 
               
               
                   
                 + (A * A * Sxx) 
               
               
                   
                 + (2 * A * B * Sx)); 
               
             
          
           
               
                   
                 J /= Cnt; 
               
             
          
           
               
                   
                 J = sqrt(abs(J)); 
                 %this abs value forming must be done 
               
             
          
           
               
                   
                 %because of accidental inaccuracies %in the calculations. 
               
             
          
           
               
                   
                 %Without this, square-rooting of 
               
               
                   
                 %a negative number can occur. 
               
               
                   
                   
               
             
          
         
       
     
         [0042]    Calculation of the average periodtime can be done simply by adding together the measured periodlength values and at the end divide the sum by Cnt. 
         [0043]    STATE 4: Evaluating the best trigger level by assigning  5  to the respective potential trigger value a jitter value characteristic for the jitter created by processing the signal with the potential trigger value and then determining  6  the optimal trigger level based on the lowest jitter value. In the described embodiment, this is not simply the level with the lowest measured jitter because for example selection is not possible or not the best if the jitter is the same or almost the same on all potential trigger levels. Therefore the “best trigger level” is found as follows:
   As the first step, a sliding average on the jitter vector can be done. At fine trigger level resolution this method can help to keep distance from trigger parts, where the jitter suddenly increases. However, when the trigger level resolution is rough (e.g. only 5 levels) this step is unnecessary.   As the next step of trigger position finding, a threshold level on the jitter values is used. If the jitter at a given trigger band is lower than this value, then it is accepted as a “very good jitter level”, regardless to its exact value and replaced by the threshold level. This means that in the following procedures, these low jitter levels will be handled uniformly. In the embodiment, the threshold level is 0.04 samples.   The next step is the jitter weighting. The weighting method in the embodiment is the use of a V-shaped weighting vector to shift the optimum towards the middle of the trigger safe area. This weighting vector has 0.9 weighting at the middle and 1.0 weighting at the edges. Usually, this very small weighting has no effect. It is useful only when the trigger signal is near to the ideal one and all trigger bands have the same small jitter. In this case one can choose any of the trigger bands. The best choice in this case is to choose the middle one. With this gentle weighting this is also possible.   The last step of trigger finding is to select the smallest weighted jitter output. With this one can find the best trigger level and the better trigger direction. This output corresponds to the purposes: at the selected trigger band and direction the jitter is acceptably low and the jitter will remain also low, if there are smaller changes in the trigger signal.   
 
         [0048]    The method can also calculate the following trigger quality numbers:
   absJitter: the absolute value of the jitter measured at the recommended trigger band and trigger direction. The jitter is defined as the non-corrected standard deviation of the measured periodlength values:   
 
         [0000]    
       
         
           
             j 
             = 
             
               
                 
                   1 
                   4 
                 
                  
                 
                   
                     ∑ 
                     
                       k 
                       = 
                       1 
                     
                     N 
                   
                    
                   
                     
                       ( 
                       
                         
                           T 
                           
                             k 
                             , 
                             bestband 
                           
                         
                         - 
                         
                           T 
                           avgperiod 
                         
                       
                       ) 
                     
                     2 
                   
                 
               
             
           
         
       
     
         [0050]    If this value is higher than 2 μsec, the block must sign that the output is not OK. (The periodlength parameters are calculated with linear interpolation to make accurate jitter measurements.)
   minJitter: jitter in percent relative to the periodlength measured at the recommended trigger band and direction.   trigQ1: ratio of the average jitter of all bands and minJitter:   
 
         [0000]    
       
         
           
             
               trig 
                
               
                   
               
                
               Q 
                
               
                   
               
                
               1 
             
             = 
             
               
                 j 
                 best 
               
               
                 
                   1 
                   5 
                 
                  
                 
                   
                     ∑ 
                     
                       i 
                       = 
                       1 
                     
                     5 
                   
                    
                   
                     j 
                     i 
                   
                 
               
             
           
         
       
     
         [0053]    If this number is around one, this means that the jitter is small everywhere in the safe trigger area. This is the behavior of the ideal trigger signal. If this value is high, this means that certain signal parts are not recommended for triggering that could be a problem if the trigger signal amplitude changes.
   trigQ2: absolute value of the difference of the periodlength measured at the recommended trigger band and the average periodlength of all bands, relative to the periodlength measured at recommended trigger:   
 
         [0000]    
       
         
           
             
               trig 
                
               
                   
               
                
               Q 
                
               
                   
               
                
               2 
             
             = 
             
               
                 
                   
                     
                       T 
                       best 
                     
                     - 
                     
                       
                         1 
                         5 
                       
                        
                       
                         
                           ∑ 
                           
                             i 
                             = 
                             1 
                           
                           5 
                         
                          
                         
                           T 
                           i 
                         
                       
                     
                   
                   
                     T 
                     best 
                   
                 
                 · 
                 100 
               
                
               % 
             
           
         
       
     
         [0000]    If this number is around 0, this means that the measured periodlength is the same everywhere, which is the ideal case. If the difference is high, then different periodlength values can be measured at different trigger bands. The reason for this could be high jitter, or extra, unwanted, low amplitude impulses in the input signal.
   Trigger signal Peak-to-Peak value. The higher the better.   
 
         [0056]    Thus, the method according to the embodiment determines quality numbers about the goodness of trigger. These are signal peak-to-peak, absolute jitter value, relative jitter value (relative to periodlength), ratio of jitter of chosen trigger level and average jitter in all examined trigger bands, ratio of periodlength if chosen trigger level and average periodlength in all examined trigger bands. These quality numbers can be checked by the user and used to make decisions. 
         [0057]    All steps described above are executed automatically by a processing unit in a digital signal processing system. 
       LIST OF REFERENCE NUMERALS 
       [0000]    
       
           1  Measuring the minimum and maximum values of the signal 
           2  Checking if the difference of the measured minimum and maximum values of the signal differ from the minimum and maximum values measured during a previous execution of the method 
           3  Interrupting execution 
           4  Defining a plurality of potential trigger values 
           5  Assigning to the respective potential trigger value a jitter value characteristic for the jitter created by processing the signal with the potential trigger value 
           6  determining the optimal trigger level based on the lowest jitter value