• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Other Analog & Touch » Touch » Touch Forum » Problem with TSC 2046
Share
Touch
  • Forum
  • E2E Wiki
Options
  • Subscribe via RSS
Check out
Analog Wire blog
  • $core_v2_blog.Current.Name

    RS-485 - Who says you can't teach an old dog new tricks?

    Posted 2 days ago
    by Neel Seshan
    Would you agree that RS-485 has turned out to be one of the most...
  • $core_v2_blog.Current.Name

    Filter for thought

    Posted 3 days ago
    by Soufiane Bendaoud
    Have you ever wondered how engineers designed active filters...
  • $core_v2_blog.Current.Name

    Let’s take this driver out for a spin

    Posted 9 days ago
    by Soufiane Bendaoud
    Before I suggest a suitable op amp to drive an ADC, I look at...

Forums

Problem with TSC 2046

This question is answered
Dhiman Das
Posted by Dhiman Das
on Mar 21 2012 18:07 PM
Prodigy85 points

I am interfacing TSC2046 with Atmega16 and sending the command word 0xDF( to measure X) and 0x9F( to measure Y) through SPI bus. I am using SCK as 2MHz. But I can not receive the SPI data properly according to Touch screen and sometime the busy signal remain high and receive 00 or invalid data. The PENIRQ signal is working. What is the duration of remain high of busy signal?Please help me regarding this issue.

TSC2046
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Wendy Fang
    Posted by Wendy Fang
    on Mar 22 2012 09:52 AM
    Verified Answer
    Verified by Dhiman Das
    Genius9725 points

    Hello Dhiman,

    With command word 0xDF or 0x9F, you were using the single-ended mode, which is not recommended for touch function.

    Suggest using the command word 0xD0 or 0x90, for 12 bit resolution; or 0xD8 or 0x98 for 8-bit resolution.  For multiple reading, the PD0 should be set between samples. For example, if you would like to sample 3 times on 12-bit X data, the command words should be: (1) 0xD1, (2) 0xD1, (3) x0D0.

    For your 2MHz DCLK, the duration of each DCLK is 0.5us.  Note that, refer to Figure 9 on pg 15 of the d/s, the TSC2046 ADC takes 3 DCLKs (or 1.5us)  to sample at the touch signal in a touch command, which is the minimal edge of the specification (Table 6 at pg 18 of the d/s). You may use a little slower  DCLK rate to get more margin here.

    The busy pin is redundant and something from the developing history of this device.The busy signal is always from low to high at the falling edge of the 8th DCLK, and from high to low at the falling edge of the 9th DCLK. Thus you should ignore it.

    Regards,
    Wendy F.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Dhiman Das
    Posted by Dhiman Das
    on Mar 22 2012 11:05 AM
    Prodigy85 points

    Thank you Mr. Wendy

    What is the recommended rate of DCLK to get appropriate data for TSC2046?

    TSC2046
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Wendy Fang
    Posted by Wendy Fang
    on Mar 22 2012 11:11 AM
    Genius9725 points

    You are more than welcome!

    Anything up to 2MHz should work.  For test purpose,  may you try 1MHz to give the TSC enough time, and tell me if there is any difference?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Dhiman Das
    Posted by Dhiman Das
    on Mar 23 2012 02:20 AM
    Prodigy85 points

    :-) I know Mr. Wendy the difference can not be detectable but I want the system to run at optimum speed.

    Now, please suggest me one thing. How much delay should I use between transmission and receive of SPI data to avoid erroneous result. I am using 4us @ 1MHz DCLK but I am not receiving desire data at same touch i/p.

    Thank you again.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Wendy Fang
    Posted by Wendy Fang
    on Mar 23 2012 15:22 PM
    Genius9725 points

    Hello Dhiman,

    As long as the DCLK rate is slower than 2MHz, the performance should be fine. However, you mentioned that you could not receiving desired touch data, which make me wondering what exact problem do you have? Is the data too noise? Or ...?

    If the touch data is too noisy,  the app note sbaa155a (http://www.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=sbaa155a&fileType=pdf) may help!

    Regards,
    Wendy F.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Dhiman Das
    Posted by Dhiman Das
    on Mar 24 2012 09:07 AM
    Prodigy85 points

    Dear Mr. Wendy

    I have already read the app note and I am designed according to it. I also connect the capacitor to X+,X-,Y+,Y- of the touch screen. When there is no touch I am receiving Y=127 and X=000. There is same value somewhere in between two distinct points. I am sending the command word as you told. I don’t understand if there is problem with touch screen or my SPI protocol. Please suggest me the duration of delay between sending the command and receiving the data.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Wendy Fang
    Posted by Wendy Fang
    on Mar 27 2012 09:36 AM
    Genius9725 points

    Dear Dhiman,

    The minimal durance for data acquisition is 1.5us, as specified in Table 6 (pg 18) of the d/s, which is the time between the falling edge of the 5th DCLK and the falling edge of the 8th DCLK.

    May you please send me the related PCB schematic; and the related software source code? Just for curious :-)! Thanks!

    Regards,
    Wendy F.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Wendy Fang
    Posted by Wendy Fang
    on Mar 27 2012 09:43 AM
    Genius9725 points

    Dear Dhiman,

    Sorry --  just want to emphasize that: the higher capacitance on the touch input lines are usually do more "bad" than "good", and thus do not add caps on the X+/X-/Y+/Y- lines unless absolutely necessary. A good practice on reducing the noise there is: (1) to have good PBC layout practice, especially good grounding; and (2)  to design the analog interface as simple, as short, as secure as possible.

    Regards,
    Wendy F.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Dhiman Das
    Posted by Dhiman Das
    on Apr 01 2012 14:55 PM
    Prodigy85 points
    TSC_2046.zip

    Dear Mr.Wendy

    Sorry for delay reply. I was too much busy. I have attached the corresponding file that you asked.

    Thank you again.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Wendy Fang
    Posted by Wendy Fang
    on Apr 02 2012 11:59 AM
    Genius9725 points

    Hello Dhiman,

    Thanks for your info, which is a great help for this debugging!

    Based on your schematic and software source code, I think I could totally understand why your reading is X=0 and Y=127 when there is no touch.

    (1) based on the schematic, I can see you are not using the /PENIRQ pin, then your software would not know when to read from the TSC. If the touch is not applied on the panel while the X or Y is read, the X data is read from the Y+ pin which is pulled low at Y-  (refer to Figure 10 of the d/s) and thus you get X=0; and the Y is read from the X+ pin which is pulled high by the 50K or 90K internal pull-up resistor and thus you get Y = 255 (the full scale at 8-bit resolution).

    (2 based on your software source code, it seems you are using only 16 bits in a frame and thus you missed the LSB, which appears at the 17th bit of the DCLK after /CS low, refer to Figure 11 or 13 of the d/s. Therefore, your max is 127.

    My pennies:

    On hardware schematic,

    • remove the 10Kohms and LED on the /PENIRQ pin; and connect the /PENIRQ to the host processor as an interrupt or GPI.
    • reduce  or eliminate the capacitance on the analog lines

     On software side:

    • before read a touch data, check the /PENIRQ status. Read touch data only when /PENIRQ is low.
    • if you need 8 bit resolution, you need to use the 24-bit (3-byte)SPI. The following is the code in TSC2046EVM firmware for your reference --

     // when /PENIRQ = 0, send convert X command
    SPISS = 0;                                        // make sure slave is selected
    spiComm(0xD0 | TSCConfig);     // send command
    resh = spiComm(0x00) & 0x7F;   // clock out 8 zeros - read 1/b11-b5...
    resl = spiComm(0x00);                 // clock out 8 more zeros - read b4-b0 + 3 zeros...
    if (twelveBit){
         read_data[1] = (resh*256 + resl)>>3;
    }
    else{
          read_data[1] = (resh*256 + resl)>>7;
     }
     SPISS = 1;                                       // deselect slave
     
     // check and find /PENIRQ = 0, send convert Y command
     SPISS = 0;                                       // make sure slave is selected
     spiComm(0x90 | TSCConfig);     // send command
     resh = spiComm(0x00) & 0x7F;  // clock out 8 zeros - read 1/b11-b5...
     resl = spiComm(0x00);                // clock out 8 more zeros - read b4-b0 + 3 zeros...
     if (twelveBit){
          read_data[2] = (resh*256 + resl)>>3;
     }
     else{
          read_data[2] = (resh*256 + resl)>>7;
     }
     SPISS = 1;                                    // deselect slave

    Hope the above helps!

    Regards,
    Wendy F.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Dhiman Das
    Posted by Dhiman Das
    on Apr 04 2012 14:11 PM
    Prodigy85 points
    Thank you very much Mr. Wendy.
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Dhiman Das
    Posted by Dhiman Das
    on Apr 30 2012 18:22 PM
    Prodigy85 points

    Dear Mr.Wendy

    I think I have still bug in my code. It will be grateful for me if you share whole/total code from TSC2046EVM firmware for my reference.

    Thank you again.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Wendy Fang
    Posted by Wendy Fang
    on May 01 2012 09:21 AM
    Genius9725 points

    Dear Dhiman,

    Sure, I will send the TSC2046EVM-PDK firmware source code to you directly, because our firmware source code is not for public. May you provide your email address?

    Thanks,
    Wendy F.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Dhiman Das
    Posted by Dhiman Das
    on May 01 2012 18:23 PM
    Prodigy85 points

    Dear Mr Wendy

    It's "dhiman.das19@gmail.com"

    It will be really grateful for me. 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Rob G
    Posted by Rob G
    on Nov 18 2012 10:50 AM
    Prodigy90 points

    Thanks Wendy, your comments are very helpful.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use