The ST7793 is a big, cheap 8-bit parallel Touchscreen TFT-module with “arduino shield” pinouts. Price is below 6 Euros (without shipping) https://www.aliexpress.com/item/1lot-2- … 19187.html
It is supported nearly out of the box with mcufriend kbv library -> https://github.com/prenticedavid/MCUFRIEND_kbv
Beware if you use another board, because there are some #ifdef exactly for the bluepill and or nucleo, so you need to change the library files or just set a #define in the sketch for bluepill, so check if this matches with your board (maple mini won’t do that!):
#elif defined(ARDUINO_GENERIC_STM32F103C) || defined(ARDUINO_NUCLEO_F103C8) || defined(ARDUINO_BLUEPILL_F103C8)TFT——-Bluepill
D0———–A0
to
D7———–A7
LCD_RST—-PB9
LCD_CS—–PB8
LCD_RS—–PB7 (=LCD_CD)
LCD_WR—-PB6
LCD_RD—–PB0
Be careful: You need to connect 3.3 and 5V!
Forget using hardware scrolling with this display.
Reason: The controller is 240×432 and the TFT-display is 240×400 so you’ll get 32 lines of garbage while hardware scrolling. (Ok, HW-scrolling is cool a first time looking and further you’ll never need/miss it again)
I probably don’t bother for ST7793 / R61509. I do not own these.
I was not aware that 3.97 was 240×400. 3.95 inch is 320×480.
Similarly 3.6 inch is 240×400. 3.5 inch is 320×480
I am sure that other panels will emerge out of the woodwork one day.
If you want to scroll, sleep, … or anything else, just ask.
David.
Thank you for your library! I’ll never will use the HW scrolling function, because it isn’t “partially” for the ST7793
There is another problem: The pin mapping for the bluepill while using a touchscreen:
LCD———————AVR—–Bluepill
LCD WR TOUCH_YP—A0——PB6
LCD RS TOUCH_XM—-A2——PB7
XM and YP must be on an analog input pin, either PB6 and PB7 are digital only pins.
We have 10 Analog Inputs on STM32F103C8 -> PA0 to PA7 and PB0, PB1
So I need to rewrite it and put LCD WR and LCD RS to PB0 and PB1. Drawback: All analog inputs are used only by display. I’ve to thing about a better solution (maybe not using the whole PA (to 07) port for the 8-bit port….)
PB2 is on middle BOOT1 jumper pin (bluepill) available.
In addition you have bridge R4 (I think) on the back side to have direct connection between jumper pin and IC pin.
Plug the Shield into a Uno and run the Diagnose_TouchPins or Calibration sketch.
Most shields use A1, A2, 7, 6 or sometimes A1, A2, 9, 8.
I do have one 3.3V shield
Diagnosing as:-
XM,XP: (A2, D8) = 25
YP,YM: (A3, D9) = 36
ID = 0x9320
Testing: (A1,D6)=34
Testing: (A2,D7)=36
Strange that both values are quiet similar. On another MCUFRIEND Uno Shield Display the values are more “right” (25,30) – but the touchdisplay works on UNO, have to look for some better STM32 implementation (Currently I have some strange Y values on Nucleo/bluepill).
Testing: (A1,D6)=34
Testing: (A2,D7)=36
#elif defined(ARDUINO_BLUEPILL_F103C8) || defined(ARDUINO_GENERIC_STM32F103C)
int XP = PB6, YP = PA6, XM = PA7, YM = PB7; //most common configuration
The values on UNO didn’t really match on STM32 (maybe caused by 3.3 vs 5V?) so I use the nucleo with the official CORE (thanks for that hind, David!) for calibration:
uint8_t YP = A2; // must be an analog pin, use "An" notation!
uint8_t XM = A1; // must be an analog pin, use "An" notation!
uint8_t YM = 7; // can be a digital pin
uint8_t XP = 6; // can be a digital pin
uint8_t SwapXY = 0;
uint16_t TS_LEFT = 76;
uint16_t TS_RT = 911;
uint16_t TS_TOP = 66;
uint16_t TS_BOT = 944;
Instead of swapping pins etc, I diagnose the actual X, Y pins in Portrait mode.
This gives you a clear value for LEFT, RT, TOP, BOT.
And means you can map your pixel coordinates appropriately when using a different orientation.
David.
BTW: Did I say, that this TFT-shield is really a secret tip? ![]()


