Skip to main content
Associate
April 6, 2024
Solved

xpt2046 touch controller

  • April 6, 2024
  • 29 replies
  • 17554 views

Hi, I'm having trouble with the resistive touch screen on my display. Here's some info about my project - I'm using an stm32f401cdu6 microcontroller, a 7" display with an SSD1963 controller, and a touch controller XPT2046. I based my project on the offpic user libraries on GitHub. You can find my microcontroller configuration and source files at https://github.com/koob7/stm32-f401-display. The display works fine, but the touch only works in power mode (XPT PD1=0, PD0=1). The first issue is the synhronic generation of interrupts on the irq pin even when the screen isn't touched. This happens even when interrupts are disabled (XPT PD0=1). In the future, I'd like to only read touch input when it's actually pressed. The second problem occurs in power-down mode (XPT PD0=0): when I change the X position on the touch, both X and Y values change. A similar issue happens when changing Y.

    This topic has been closed for replies.
    Best answer by kob77

    I have a solution! The issue was the delay after resetting the CS pin in the function communicating with XPT. I also changed the display mode to 11. In this case, the mentioned delay is not necessary, and all the problems were fixed. Regarding the delay in interrupt handling, the solution was to increase the priority of the systick interrupt so that it is more important than the touch interrupt. In this case, the delay in communicating with XPT also works (but I no longer need it). Thank you very much for your help and dedicated time. I found another problem - I connected an SD card SPI reader (without a card inserted, just physical connection without uploading code) and its presence interferes with reading from XPT. It's very strange because I set the CS pin of the reader to a high level. Do you have any idea what the problem might be?

    29 replies

    Harvey White
    Senior III
    April 12, 2024

    The redesigning is why you may want to consider modules (that you design and build).  Change a section, just change the module.  Not sure if the 2MB (FLASH) will be enough.  Always easier to plan for it and just leave the module out.

    On projects, pick your battles wisely.  The less you have to build (the hard way) the more you can spend time on fixing the whole design.  It's a balance that evolves over time.  My first designs started with Nucleo boards, which was fine until I ran into the limitations of such projects.

    wire wrap is a very reconfigurable method of construction.  Ask your supervisor, but it's not likely you will use it because I rather doubt that the technology is available. 

     

     

    kob77Author
    Associate
    April 12, 2024

    Okay, I'll think over the whole issue and make a decision. Thanks again for your time and the knowledge you've shared. It's really important to me.

    Harvey White
    Senior III
    April 12, 2024

    Glad to be of help.