3.5” TFT LCD with touchscreen

Interfacing a 3.5" TFT LCD with Touchscreen to Pico and STM32F103 Boards

03/24/2022

On whim I purchased a couple of these display modules for about $13 each from ebay.
Then spent a few long nights porting code from Arduino libraries and other old projects
to my Raspberry Pi Pico (RP2040) microcontroller board.

These guys use a parallel interface so it take 14 GPIO pins to run them (12 if you hardwire LED & RD).

I had recently translated support code for a smaller 128x128 TFT display that used the
ST7735 driver chip and a serial SPI interface. This was for the STM32F103 (Bluepill board).
I was able to re-use many of the basic routines once the “drawPixel” function was working.
So I used this code as a basis for the ST7793 project.

The Pico SDK GPIO routines are fairly easy to understand and ultimately, between the parallel
interface and the 125MHz I was able to get excellent performance from the combination.
Filling the screen (all 96000 pixels) takes only about 65ms.

This particular driver chip allows one to read from the chip registers and CGRAM so I
spent a couple more evenings getting that to work. (don't hardwire RD if you want this to work)

A key reference was an existing Arduino library called MCUFRIEND_kbv
https://github.com/prenticedavid/MCUFRIEND_kbv
This library supports a huge array of different display types and extracting the code specific to
my ST7793 was quite tedious since it also relied on the Adafruit_GFX library.

The 3.5” display itself could be quite useful since the integrated touch-screen allows one to
create an on screen keypad for user input.

I’ll include samples of my code for both the Pico and STM32 boards below.

At this time I don’t have plans to port this back to the Arduino board since their clock rates
are a bit slow to get decent performance and the necessary pin count would leave little left
on the Uno board.

Here’s an Amazon link if you don’t like ebay:
https://www.amazon.com/DIYmalls-Display-Resistive-400x240-Arduino/dp/B09DSW4BFK

TFT Display connected to Bluepill board

TFT Display connected to Pico Breadboard

Display Module Front & Back

Description of download links:

STM32F103_TFT7793.zip TFT LCD Project for STM32F103 (Bluepill board)
USBIO_TFT_7793.zip TFT LCD Project for Raspberry Pi Pico (RP2040) board