STM32-LTDC, LCD-TFT, LVGL(MCU3) Lecture 64| About touch screen controller

 

About touch screen controller


 

In this article, we will delve into the interfacing of touch screen controllers on three distinct boards: the STM32F429 DISC board, the STM32F746 DISC board, and the STM32F407 DISC-1 board, as well as explore the interfacing of an external RGB display.

 

STM32F429 DISC board touch functionality

Figure 1. STM32F429 DISC board touch functionality
Figure 1. STM32F429 DISC board touch functionality

 

The STM32F429 Discovery (DISC) board features a built-in touch screen controller, namely the STMPE811, an integrated circuit (IC) already present on the board. 

The STMPE811 controller incorporates an analog-to-digital converter (ADC) for processing touch input. 

The touch panel on the board utilizes a 4-wire resistive touch panel, and its analog signals are seamlessly connected to the STMPE811 controller.

When the touch panel is interacted with using a stylus or touch, it induces a resistance change on the touch panel. Consequently, this resistance variation results in corresponding voltage changes along the connected lines. 

The STMPE811 controller digitizes these analog signals, effectively converting them into a digital format. These digitized values are subsequently transmitted via the I2C interface to the microcontroller. 

Notably, the microcontroller employs the I2C3 peripheral for this purpose, and the necessary hardware connections are already established on the board, obviating the need for additional configuration.

 

The STM32F429 DISC board schematic is shown in Figure 2. 

Figure 2.STM32F429 DISC board Schematics touchscreen controller
Figure 2.STM32F429 DISC board Schematics

 

The schematic illustrates the connections between the touchscreen controller (STMPE811QTR) and the microcontroller. Key signals, including I2C3_SCL, I2C3_SDA, and TP_INT1, are conveyed from the STMPE811QTR controller to the microcontroller. 

There is also one more line: touch panel interrupt(TP_INT1), which indicates touch panel activity by being asserted or de-asserted when the touch panel is touched.

Please refer to its datasheet for more comprehensive information about the STMPE811QTR IC and its functionalities. This detailed document will provide a deeper understanding of the IC’s capabilities and usage.

 

STM32F746 disc board touch functionality

Figure 3. STM32F746 disc board touchscreen controller
Figure 3. STM32F746 disc board

 

On this board, there is a capacitive touch panel, and there is a capacitive touch panel controller. 

FT5336GQQ is a chipset name. The FT5336GQQ chipset serves as the controller for the capacitive touch panel. It manages touch input processing and communication with the microcontroller.

This is also I2C-based communication, and the I2C3 peripheral is being used.

I2C Communication:

  • The communication between the FT5336GQQ controller and the microcontroller is facilitated through the I2C (Inter-Integrated Circuit) protocol. This digital communication method ensures efficient data exchange.

I2C3 Peripheral:

  • The I2C3 peripheral on the STM32 microcontroller is specifically employed for connecting and communicating with the FT5336GQQ controller. It is preconfigured for seamless integration.

All these are onboard chips.

 

STM32F407 DISC-1 board and external RGB display interfacing

Figure 4. STM32F407 DISC-1 board and external RGB display interfacing touchscreen controller
Figure 4. STM32F407 DISC-1 board and external RGB display interfacing

 

To interface an external RGB display with the STM32F407 DISC-1 board, you will need to connect specific pins for touchscreen functionality. These pins include T_IRQ, T_DO, T_DIN, T_CS, and T_CLK. These pins are essential for touchscreen input and use the SPI (Serial Peripheral Interface) communication protocol.

T_IRQ:

  • T_IRQ serves as an interrupt line, allowing the touch screen controller of the external LCD module to signal the microcontroller when a touch event occurs.

T_DO (Data Out):

  • T_DO transmits data from the touchscreen controller to the microcontroller. It carries touch-related information.

T_DIN (Data In):

  • T_DIN facilitates data transmission from the microcontroller to the touchscreen controller, enabling bidirectional communication.

T_CS (Chip Select):

  • T_CS is responsible for selecting the touchscreen controller for data transfer. It enables or disables communication with the controller.

T_CLK (SPI Clock):

  • T_CLK is the clock signal for synchronizing data exchange between the microcontroller and the touchscreen controller. It plays a critical role in SPI-based communication.

 

The interface is SPI-based, meaning the microcontroller communicates with the touchscreen controller using the SPI protocol. You should use jumper wires to establish the necessary connections when connecting the external LCD. Figure 4 likely illustrates the recommended connection scheme for this purpose.

In Figure 4, you will notice that some pins are associated with the SPI peripheral, specifically PA6, PA7, and PA5, while others, such as PA8 and PA15, are simple GPIOs. 

Please note that I have just shown the connections required for touchscreen functionality here. That doesn’t mean you would need not to connect all the remaining lines, so these connections must be there. For simplicity, I’m just showing the connections required for touchscreen functionality.

Figure 5. 2.4 inch external TFT-LCD display with touchscreen controller
Figure 5. 2.4 inch external TFT-LCD display with touchscreen controller

 

On this LCD module, the chipset for the touchscreen controller is XPT2046, and the touch panel is again the 4-wire resistive touch panel, but the interface is SPI.

 

To Get the Full Course on Mastering Microcontroller: STM32 LTDC, LCD-TFT, LVGL(MCU3) Here.

FASTBIT BRAIN ACADEMY ALL COURSES 

 https://fastbitlab.com/course1/

 

Hands-On Rust Programming for Beginners

FastBitLab

The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.