Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs

Getting touchscreen working with STM32

Andy Brown have written a nice tutorial on how to implement and program resistive touchscreen controllers. He took screen with ADS7843 – standard and cheap resistive touch controller. Mastering it you will be able to do same with many other compatible controllers like UH7843 or XPT2046. Controller can uses SPI interface to talk to microcontroller. Before he started programming it seemed that it should be very easy to read values form controller AD converter and interpret it as coordinates. But it turned out that things are more complicated as it looks in the beginning. Main problems rise due to noise and AD reading variation. In order to make touch precise some processing has to be done like smoothing multiple samples and rejecting bad convertions at the beginning. Anyway finally Andy worked out an algorithm that allowed to read touchscreen coordinates using STM32plus and do some basic stuff like drawing on screen. Continue reading