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.

TMS320F2800157-Q1: Needed clarification for Input qualification with 6 samples.

Part Number: TMS320F2800157-Q1

Dear TI Experts,

Scenario : 

1. Using below 3 GPIO pin with 6 sample input qualification :

GpioCtrlRegs.GPAQSEL1.GPIO09 = 2;  /* For 6 Sample */
GpioCtrlRegs.GPAQSEL1.GPIO05 = 2; /* For 6 Sample */
GpioCtrlRegs.GPBQSEL1.GPIO45 = 2; /* For 6 Sample */

2. Applying GPxCTRL[QUALPRDn] value as below : 

/* For GPIO 09 and 05 i have to select QUALPRD1 of GPACTRL reg for setting the sampling window width */
GpioCtrlRegs.GPACTRL.QUALPRD1 = 120; /* 2uSec Time between samples */ 

/* For GPIO45 i have to select QUALPRD1 of GPBCTRL reg for setting the sampling window width */
GpioCtrlRegs.GPBCTRL.QUALPRD1 = 120; /* 2uSec Time between samples */ 

3. Clock speed is 120Mhz = 8.33333333nSec

Query or Clarification Needed : 

1. Is this Configuration is correct for 10uSec Sampling window width, value 120 ? Yes/No ?

  1. so time between (6-1) 5 sample is 2uSec each.

2. As I'm selecting GPACTRL.QUALPRD1 and GPBCTRL.QUALPRD1 reg, this regs will set sampling window width Time as 10us for all GPIOs which is assigned to GPACTRL.QUALPRD1 reg and GPBCTRL.QUALPRD1 reg. 

  1. So, the query is ->
    1. This 10us time will be applied to GPIO 08 to 15 if i set 120 in  GPACTRL.QUALPRD1 reg? even in GpioCtrlRegs.GPAQSEL1.GPIO0x = 2 i have selected GPIO09 and 05 as 6 sampling input qualification?
    2. Or This 120/10us for 6 sample is only applied to GPIO09 and GPIO05 only according to the selection of GpioCtrlRegs.GPBQSEL1.GPIO09 and GpioCtrlRegs.GPBQSEL1.GPIO05
  2. Same question for GPIO40 to GPIO47, 
    1. This 10us time will be applied to GPIO40 to GPIO47 if i set 120 in  GPBCTRL.QUALPRD1 reg? even in GpioCtrlRegs.GPBQSEL1 = 2 i have selected GPIO45 as 6 sampling input qualification?
    2. Or This 120/10us for 6 sample is only applied to GPIO45 only according to the selection of GpioCtrlRegs.GPBQSEL1.GPIO45 ?
  3. And After setting the value in GPACTRL.QUALPRD1 through "GPIO_setQualificationPeriod(PINADDR, 120)", why it is showing as 60 (0x3C), half of the actual value ?
    1. Why GPIO_setQualificationPeriod(pin, divider); function has division divider/2 ?

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Kindly give clarification to this and please let me know if there is something wrong in my configuration for 6 sampling window width. 

Thanks in advance Slight smile

  • Hi Meet,

    Thanks for your question. Please see the "Qualification Using a Sampling Window" section of the device TRM. This walks through the full process for choosing a specific sampling window:

    Regards,

    Vince

  • Dear Vince Toledo,

    I have already checked this before posting my question,

    Actually, i want to cross verify flow which I have mentioned in my question.

    and let me know the exact divider which i have to pass to GPIO_setQualificationPeriod driver lib function

  • Please see breakdown of how to calculate qualprd register value below, which may explain the divide by 2:

    SAMPLEFREQ = fSYSCLKOUT × 1 ÷ (2 × GPxCTRL[QUALPRDn])
    
    SAMPLEFREQ/fSYSCLKOUT  = 1 ÷ (2 × GPxCTRL[QUALPRDn])
    
    fSYSCLKOUT/SAMPLEFREQ  = (2 × GPxCTRL[QUALPRDn])
    
    (fSYSCLKOUT/SAMPLEFREQ)/2  = GPxCTRL[QUALPRDn]

    See attached Excel (not tested, please verify yourself that this works correctly) for qualprd calculator.

    EDIT: REMOVED THE EXCEL FILE WITH INCORRECT FORMULA SO OTHERS DO NOT ACCIDENTALLY USE.

    Regards,

    Vince

  • In your excel sheet, you have mentioned no of sample as 3 and 6 but it should be (Number of sample -1) right ? or do i have to take 6 and 3 ? 



    Am I right?

  • Hi Meet,

    Thanks for catching that, have corrected the off-by-one error in the below (kept the visible 3/6 and made the formulas account for the -1).

    gpio_qual_period_qualprd_calculator_v1.xlsx

    Regards,

    Vince

  • So what will be the value of divider do i have to give? 

    GPIO_setQualificationPeriod(PINaddr, 240) ; 

    Right? As above function is dividing down by 2. So i will get actual value loaded in reg is 120.

    Please confirm the same. 

  • Meet,

    The "GPIO_setQualificationPeriod" does all of the dividing calculations for you. See the description in gpio.h:

    //*****************************************************************************
    //
    //! Sets the qualification period for a set of pins
    //!
    //! \param pin is the identifying GPIO number of the pin.
    //! \param divider specifies the output drive strength.
    //!
    //! This function sets the qualification period for a set of \b 8 \b pins,
    //! specified by the \e pin parameter. For instance, passing in 3 as the value
    //! of \e pin will set the qualification period for GPIO0 through GPIO7, and a
    //! value of 98 will set the qualification period for GPIO96 through GPIO103.
    //! This is because the register field that configures the divider is shared.
    //!
    //! To think of this in terms of an equation, configuring \e pin as \b n will
    //! configure GPIO (n & ~(7)) through GPIO ((n & ~(7)) + 7).
    //!
    //! \e divider is the value by which the frequency of SYSCLKOUT is divided. It
    //! can be 1 or an even value between 2 and 510 inclusive.
    //!
    //! \return None.
    //
    //*****************************************************************************
    extern void
    GPIO_setQualificationPeriod(uint32_t pin, uint32_t divider);

    So in your case, if you are wanting a GPxCTRL period loaded into the register of 120, then yes, you would put 240 for the value.

      

    You put 240 because that divides the SYSCLK by 240 == 500000 Hz == 2us period.

      

    Regards,

    Vince