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.

TPS65070 TSC ADC slow

Other Parts Discussed in Thread: TPS65070

Hello,

With TSC module used for touch screen coordinate resolution, one problem we found is that the ADC conversion speed is sluggish. We have profiled each minute segments of the TSC driver and finally located the portion that takes the largest amount of time:
  
    TSCStartConversion();
 
    do {
            PMIC_readRegister(ADCONFIG, &temp);
       }while((temp & ADC_START)!= 0);
 
The process of starting the ADC and wait for its completion takes 12ms on my customized board. Since each for coordinate resolution we need to read 1)pressure 2)X pos 3)Y pos, then all the measurements together takes around 34~36ms of time.
  
In the case that the TSC is not interrupt driven but is polled by the main program, this severely limited the possible number of polling per minute; it also makes it different to insert other routine into the intervals of the TSC read routine since the time gap (length) is also short.
  
We have tried to raise I2C speed from 100K to 400K in hope to see a 1/4 decrease of time, unfortunately it turns out of little help and the slow speed of ADC is the real problem.
  
Could anyone advise how can ADC be made faster?
  
 
Paul
  • Can you please post labeled scope shots of the I2C transmissions to and from the TPS65070 throughout a touch event?

  • Daniel,

    1. Is the 12ms-around ADC conversion time normal or exceedingly too too long?

    2. could you advise in more detail how should the I2C transmission scope shots be taken?

    As the code suggests, the majority of the time is spent the do-while loop, and judging from the 12-ms time I estimate that several dozens of register ADCONFIG reads have been attempted before conversion bit 6 is cleared, because I measured elsewhere in the same TPS6507x driver file that each I2C register read takes on the order of 1ms. Do you see any problem here?

  • The elemental
    PMIC_readRegister
    &
    PMIC_writeRegister
    are just standard I2C driver code with address set to TPS6507x’s address. I don’t think there would be any problem with them. The complete code for a touchscreen read is below, and the darkened part of ReadAxis is what takes about 12ms:
     
    /*
    ** Configures the touch screen into different modes.
    */
     void TSCModeConfig(char modeVal)
    {
        PMIC_writeRegister(TSC_MODE, modeVal);
    }
     
    /*
    ** Enables the analog to digital converter
    */
     void TSCADCEnable()
    {
        char temp;
     
        PMIC_readRegister(ADCONFIG, &temp);
     
        temp |= ADC_ENABLE;
     
        PMIC_writeRegister(ADCONFIG, temp);
    }
     
    /*
    ** Selects the input channel
    */
     void TSCDACSelect()
    {
        char temp;
     
        PMIC_readRegister(ADCONFIG, &temp);
     
        temp &= ~INPUT_CHANNEL_MASK;
     
        temp |= TSC_ADC_INPUT;
     
        PMIC_writeRegister(ADCONFIG, temp);
    }
    /*
    ** Converts analog input received on touch surface to digital value
    */
     void TSCStartConversion()
    {
        char temp;
       
        PMIC_readRegister(ADCONFIG, &temp);
          
        temp |= ADC_START;
     
        PMIC_writeRegister(ADCONFIG, temp);
    }
     
    /*
    ** Reads data from ADRESULT_1 or ADRESULT_2
    */
     char ReadResult(char regAddr)
    {
        char temp;
     
        PMIC_readRegister(regAddr, &temp);
     
        return temp;
    }
    /*
    ** Reads the x or y coordinates or pressure based on mode value
    */
    void ReadAxis(char mode, unsigned char*p1, unsigned char*p2)
    {
        char result1, result2;
        char temp;
     
        /* configures touch screen in to different modes,based on mode value */
        TSCModeConfig(mode);
     
        /* enables the analog to digital convertor */
        TSCADCEnable();
     
        /* selects the input channel to be used */
        TSCDACSelect();
     
        /* converts analog value received on surface to digital value */
        TSCStartConversion();
     
        do {
                PMIC_readRegister(ADCONFIG, &temp);
           }while((temp & ADC_START)!= 0);
     
        result1 = ReadResult(ADCRESULT1);
        result2 = ReadResult(ADCRESULT2);
     
        *p1 = (unsigned char)result1;
     
        *p2 = (unsigned char)result2;
    }
  • I expect your scope shots to show the following process from the datasheet: 

    • Set TSCMODE to 101 to set TSC to TSC standby, so an interrupt is generated when the screen is touched

    • Set Bit AD enable = 1 to provide power to the ADC

    • Set input select for the ADC in register ADCONFIG to 1110 (AD_IN14 selected)

    • In register INT, set MASK TSC = 1 to unmask the interrupt on a touch of the touch screen

    • Read Bit TSC INT as it will be set after the TSC has been configured. Reading clears the interrupt.

    • After a touch was detected, an interrupt is generated by INT pin going LOW

    • Read Bit TSC INT to clear the interrupt

    • Set TSCMODE to 000 to select x-position measurement

    • Start an ADC conversion by setting CONVERSION START =1; wait until END OF CONVERSION = 1

    • Read register ADRESULT_1 and AD_RESULT_2

    • Set TSCMODE to 001 to select y-position measurement

    • Start an ADC conversion by setting CONVERSION START =1; wait until END OF CONVERSION = 1

    • Read register ADRESULT_1 and AD_RESULT_2

    • Set TSCMODE to 101 to set TSC to TSC standby again

  • Daniel,

    I think you are citing page 37 of the manual. However, this paragraph also stated in the second line that it is for the case of interrupt driven measurement. 

    The real problem I am facing is not the choice between interrupt driven or polling. In fact, I test both and both worked correctly. The problem is with the speed of ADC conversion. Since each conversion takes roughly 12ms, for a complete measurement (pressure + X + Y) I need around 36ms, then I am limited to less than 27 measurements per second.

    I want to know typically how many measurements are done per second if polling is used?

    Paul

  • As in the datasheet, you can to enable interrupt on /INT for when a touch is detected.
    The interrupt on the /INT pin only indicates a touch occurred; it is then the master I2C device's job to handle clearing the interrupt and then to read each ADC touch parameter.

    Looking at scope shots of your SCL and SDA lines will help you detect where you are going wrong. I expect the whole process outlined to take 1-2ms.

  • There are two bits seems both applicable to detect the end of AD conversion:

    • B6, CONVERSION START of ADCONFIG 07h
        • said to automatically cleared if conversion is done
    • B5, END OF CONVERSION of ADCONFIG 07h
        • 0 = conversion did not finish
        • 1=conversion done

    I have tested with B6 with correct result; what about B5, and is there any difference between using one vs another, particularly on the response time?

    And has the estimated 1-2ms time been measured on tps65070 product?

  • The response of the TSC was fast enough. The 12ms time was due to 1ms delays added by default in the I2C driver for each read/write, and after removing that the TSC measurements takes approximately 1ms to complete.

      

      

       

    Could you also confirm with http://e2e.ti.com/support/power_management/pmu/f/200/p/190858/684390.aspx#684316? I want to make sure I am querying the correct bit. Because although manual p.37 and your post above suggested using 

    END OF CONVERSION = 1

    Some driver software uses

    CONVERSION START =1

    instead.

    I tested and both worked. But is there any difference between them?

  • Please wait until END OF CONVERSION = 1 to read the ADC result.