This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PGA450-Q1: time of flight

Part Number: PGA450-Q1
Other Parts Discussed in Thread: PGA450Q1EVM

Hello Scott ,

Why the equation have not  the SAT_TIME ?

  • Hello hunt.cn,

    The example pga450_main.c equation to solve for time-of-flight is provided as:

    //*** CODE SNIPPET BEGIN ***//
    if ( MaskEcho == 0){
    if ( data_FIFO[lcv] > DetectionThreshold) {

    EN_CTRL = 0x8C; //log free running timer
    FRT_T2.u8[0]=FRT_MSB; // ESFR 0xBA
    FRT_T2.u8[1]=FRT_LSB; // ESFR addr 0xBB
    if (FRT_T1.u16 > FRT_T2.u16) {
    TimeOfFlight.u16 = 65535+FRT_T2.u16-FRT_T1.u16;
    }
    else {
    TimeOfFlight.u16 = FRT_T2.u16-FRT_T1.u16;
    }
    MaskEcho = 1;
    //break; // when enabled, break from loop as soon as an object is found
    }
    }
    //*** CODE SNIPPET END ***//

    The variable FRT_T1.u16 is captured immediately after issuing the burst-and-listen command, while the variable FRT_T2.u16 is captured at the time of the threshold interrupt. This difference does not need to factor in the SAT_TIME since T1 already includes this time.

    Refer to section 7.3.11 Free-Running Timer of the PGA450-Q1 datasheet on FRT details.
  • Hello Akeem,

    I don't want to use Free-Running Timer ,becauce the test results have about +5cm error when using the example pga450_main.c .

    So I used Equation 2  in the 《LIN Demostration Using PGA450Q1EVM》, this Equation's Accuracy  is  about ±1.5cm. But I don't know why have not SAT_TIME.

    code as:

    //*** CODE SNIPPET BEGIN ***//
    if ( MaskEcho == 0){
    if ( data_FIFO[lcv] > DetectionThreshold) {

    lcv_temp1=lcv

    MaskEcho = 1;
    //break; // when enabled, break from loop as soon as an object is found
                                            }
    }

    TimeofFlightTemp.u16 =(lcv_temp1<<4) + (BLANKING_TIMER<<4);


    //*** CODE SNIPPET END ***//

  • hunt.cn,
    The transducer saturation time measurement is independent from the FIFO record start time. Therefore, the saturation time is not included in the Time-of-Flight calculation.

    SAT_TIME does not offset the FIFO record start time, only the BLANKING_TIMER offsets the FIFO record start time. SAT_TIME is intended to be used for diagnostic purposes, and can be used to set the BLANKING_TIMER. For instance, if the saturation time is known to be 1000us, then the blanking timer can be set to a value of 62x16us to ignore the saturated region of the record window to enable minimum distance detection.
  • hunt.cn,

    If your code sequence is

    EN_CTRL = 0x85; // start burst, saturation check, and log FRT
    ...
    while(STATUS2 & 0x02 == 0){} // wait for Echo signal to be below saturation threshold
    ...
    EN_CTRL = 0x0C; // start filling FIFO
    ...
    // time-of-flight calculation

    then you will need to add the SAT_TIME to the time-of-flight equation.
  • Hi ,Akeem,

    Thanks for your reply ,  It 's great help for me . 

    My code sequence is your mention ,  not changed  codes sequence in the original <example pga450_main.c>, but some issues in my test.

    1、 TOF calculation equation without SAT_TIME ,  but it had good accuracy。

    I added one code to read SAT_TIME after <code> EN_CTRL = 0x0C </code> ,  and throw it out by UART ,  it 's value is 0 .

    So SAT_TIME does not offset the FIFO record start time too , That is why the equation have good accuracy whitout add SAT_TIME to the TOF equation.

    2、Why SAT_TIME had a zero value .

    it seem to be impossible,  because there had a  code like  :

    SAT_DEGLITCH = 0x09;                   // 2us per count || 1/58kHz (17.2uS)

    So SAT_TIME should have 1 value at least.        //  8bit at 16 us resolution

    3、I got a picture with PGA450Q1EVM GUI 1.50.1 , maybe why SAT_TIME = 0.

    configure GUI 1.50.1 : in Digital Test MUX set GPIO1 to output SAT_DONE 

    ch1 is burst waveform , ch2 is SAT_Done from gpio1.