Connect a GLCD TFT 1.8" SPI with BluePill

Arduino: 1.8.16 (Windows Store (Windows 10), Board: "Generic STM32F103C series, STM32F103C8 (20k RAM. 64k Flash), STLink, 72Mhz (Normal), Smallest (default)"

In file included from C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.51.0_x86__mdqgnx93n4wtt\libraries\TFT\src\utility\Adafruit_GFX.cpp:35:0:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.51.0_x86__mdqgnx93n4wtt\libraries\TFT\src\utility\glcdfont.c:3:20: fatal error: avr/io.h: No such file or directory

#include <avr/io.h>


compilation terminated.

exit status 1

Error compiling for board Generic STM32F103C series.

I have this error, and I try to install the library it is said in the other comment, but my program doesn't work. Can you help me, to solve this problem?

#include <avr/io.h>

The Blue pill doesn't have an AVR processor. You need a library that is compatible with the STM32F103C8T6

GLCD generally refers to a KS0108, ST7565, T6963C, ... monochrome Graphics LCD
TFT generally refers to a full colour TFT LCD e.g. ST7735, ILI9341, ...
OLED generally refers to an Organic Light Emitting Diode display e.g. SSD1306, ...

Anyway, back to your problem. The <TFT.h> library that comes with the Arduino IDE is rubbish. It relies on obsolete versions of Adafruit_ST7735.h . Neither TFT.h nor the obsolete ST7735.h version are maintained.
It is a complete mystery why the Arduino powers do not just remove it.

Then everyone can use the proper Adafruit_GFX.h and Adafruit_ST7735.h libraries. WHICH ARE MAINTAINED.

My advice is to scrap TFT.h and install Adafruit_GFX.h and Adafruit_ST7735.h via the IDE Library Manager.
Run all of the examples that come with Adafruit_ST7735

The un-maintained TFT.h was written before STM32, ESP32, ... became available.
The maintained libraries run fine on AVR, STM32, ESP32, SAM, ...


1 Like

Yes, in fact there are a lot of STM32 boards designed for it now, with a female header strip to plug an LCD or OLED directly and easily on to the board.

I am intrigued. I can only think of one "Arduino" ST7735 display.
The Arduino Esplora board had a custom Arduino Display board.

I doubt if anyone would ever make these again.

Yes, there are plenty of ILI9341, ILI9486, ... TFT Shields for Uno header sockets. And STM32 Nucleo boards with Uno header sockets.
And there are some Mega2560 TFT Shields for Mega2560, Due.

I have never seen an STM32 board with Mega2560 header sockets.

Please post some links to any STM32 / ST7735 combination.
Or an STM32 with a 16x2 LCD header socket.
Or an STM32 with an OLED socket. SPI or I2C

I have always had to make my own ProtoShield(s).
I would much prefer to buy ready-made target boards.


Here's the latest (G0 boards are starting to come out now... of the two here, just one has the interface)
STM32H7, I have some but no longer available...
Here is the F103 version, very common, I have lots and backup battery is a bonus:

These don't take the larger TFT displays, I see that's what you were talking about, but the F407 "black board" does seem to have one:

I'd be really happy if you could point me to a display for that one, I don't know enough about those or use them enough to know... it's a 32 pin connector.

Thanks for the links. The STM32H7 looks really interesting. The M7 core has an impressive performance. It is a pity that this board is no longer available.

The STM32F407 board looks good too. However it comes with a male TFT header.

Unfortunately none of the OLED / TFT footprints suit the OLEDs and TFTs on my desk.

So I will stick with regular STM32 Nucleo boards for development. Uno-format Protoshields can mount on many target boards.
Farnell delivers to my door in about 14 hours. Faster and more reliable than China.


That is strange. I've already used those boards with the most common 0.96 OLED, and I checked also the pins on a small TFT LCD module, they were compatible in principle, but I haven't powered and tested that one yet.

The same or similar H7 is still available, BTW has a camera connector:

Lucky for you, you can just order from Farnell. I assume you are in the USA or Western Europe? Anywhere else, you can still order from places like that, if you want to pay 5 times the value of the part. They have 100% bought into third party shipping solutions that are optimized for, and effectively limited to, the continental USA.

Hi, I am not sure if I understood correctly, but I have this one:


Wow, I checked the pinout and it does appear to fit. Thanks! What do you use the display with?

I don't really use it, but I used it to test STM32 boards with FSMC TFT connectors.
With both boards of your link, I believe. See also:
GxTFT/src/myTFTs at master · ZinggJM/GxTFT · GitHub
or GitHub - ZinggJM/GFX_TFT: TFT Display Classes based on GFX_ROOT and GFX_Extensions
GFX_TFT/GFX_TFT_known_configurations.h at master · ZinggJM/GFX_TFT · GitHub


Ah-ha. Your display has a 16x2 female connector. So it will plug straight into the STM32 board. FSMC is interesting but I already have a Discovery board.


I have several Chinese Red SPI TFT boards. ILI9163, ST7735, ILI9341, ILI9486, ST7796
The pinout does not match. I need SDA, SCK to be in the same place to match HW SPI MOSI, SCK pins. Obviously I can use random GPIO for CS, DC, RST.
Likewise, I have several SSD1306, SH1106 Blue SPI OLED boards. The pinout does not match.

The OLED/TFT header is not so attractive if none of my displays fit !!


It's what happens when industry standards don't exist.

These boards come with a socket for ST7735-0.96":


The latest Adafruit_ST7735 and ST7789 Library, can work on STM32 boards

F411CE + 1.8" ST7735-touch

F103C8 + 1.8" ST7735-touch

PD: Slightly larger screens can also be used if you design a bracket with a perforated plate

F411CE + NHD-FT813 3.5"
library: GD23ZUTX


We are at cross purposes !

aarg was referring to the 8-pin OLED/TFT header on the boards he had linked in #6. These have BLK, DC, SDO, CS, SCL, SDI, GND, 3V3

BLK,  DC, SDO,  CS, SCL, SDI, GND, 3V3  //aarg's header
LED, SCK, SDA,  DC, RST,  CS, GND, 3V3  //Red SPI TFT header
GND, 3V3, SCK, SDA, RST,  DC,  CS       //Blue SPI OLED header

Yes, I am familiar with some boards that have a ZIF ribbon connector. But aarg and I were referring to the display modules that come with male pin headers.


This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.