Changing pins on a mcufriend TFT screen

hi

i want to connect a esp32 to my mcufriend screen.
when i use the standard connections screen is working
but i need to change pinorder to fit my pcb
is it possible to change the pins ?

i tried to change the pins like this

#define LCD_CS 16 // Chip select control pin
#define LCD_DC 4 // Data Command control pin - must use a pin in the range 0-31
#define LCD_RST 17 // Reset pin
#define LCD_WR 2 // Write strobe control pin - must use a pin in the range 0-31
#define LCD_RD 15
#define LCD_D0 12
#define LCD_D1 13
#define LCD_D2 32
#define LCD_D3 33
#define LCD_D4 25
#define LCD_D5 26
#define LCD_D6 27
#define LCD_D7 14

but that was not working

any suggestion?

thanks jean-marie

Look at mcufriend_shield.h
You will see the "shield" wiring.

Alter the defines to match your wiring in the LCD_ID_readreg example sketch.

Then run LCD_ID_readreg example. If it returns correct values, the defines should work in mcufriend_shield.h (but you should really put them in mcufriend_special.h)

David.

david thanks for reaction

i changed this:
//################################### ESP32 ##############################
#elif defined(ESP32) //regular UNO shield on TTGO D1 R32 (ESP32)
#define LCD_RD 21//2 //LED
#define LCD_WR 3//4
#define LCD_RS 1//15 //hard-wired to A2 (GPIO35)
#define LCD_CS 22//33 //hard-wired to A3 (GPIO34)
#define LCD_RST 23//32 //hard-wired to A4 (GPIO36)

#define LCD_D0 12
#define LCD_D1 13
#define LCD_D2 32//26
#define LCD_D3 33//25
#define LCD_D4 25//17
#define LCD_D5 26//16
#define LCD_D6 27
#define LCD_D7 14

but i get this error:
esptool.py v2.6
Serial port COM12
Connecting......
Chip is ESP32D0WDQ5 (revision 1)

A fatal error occurred: Timed out waiting for packet header
i use this:
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

do i need to change something ?

thanks jean-marie

Alter the defines to match your wiring in the LCD_ID_readreg example sketch.

Then run LCD_ID_readreg example.

It should give you meaningful report.
e.g. reg(0xD3) will show the ID on most controllers.

When you get a sensible report, paste it to your message.

David.

david

i changed the pins in mcufriend shield and in the lcd id readreg ino.
i have this error:

esptool.py v2.6
Serial port COM12
Connecting...........................

A fatal error occurred: Timed out waiting for packet header
A fatal error occurred: Timed out waiting for packet header
when i only hit the verifiy button compiling is ok

my esp is an NODEMCU-32 V1.2 module.in the IDE i choose ESP32 DEV module as bord

jean-marie

I edited LCD_ID_readrg.ino e.g.

...
#if defined(ESP32)       //regular UNO shield on TTGO D1 R32 (ESP32)
#define LCD_RD  2  //LED
#define LCD_WR  4
#define LCD_RS 15  //hard-wired to A2 (GPIO35) 
#define LCD_CS 33  //hard-wired to A3 (GPIO34)
#define LCD_RST 32 //hard-wired to A4 (GPIO36)

#define LCD_D0 12
#define LCD_D1 13
#define LCD_D2 26
#define LCD_D3 25
#define LCD_D4 17
#define LCD_D5 16
#define LCD_D6 27
#define LCD_D7 14
#else
//-- Arduino UNO or Mega 2560 Plugged as shield
#define LCD_RST A4
#define LCD_CS A3
#define LCD_RS A2
#define LCD_WR A1
#define LCD_RD A0

#define LCD_D0 8
#define LCD_D1 9
#define LCD_D2 2
#define LCD_D3 3
#define LCD_D4 4
#define LCD_D5 5
#define LCD_D6 6
#define LCD_D7 7
#endif

void setup()
{
    ...

and ran on a ST7781 Shield

reg(0x0000) 77 83 ID: ILI9320, ILI9325, ILI9335, ...

If I trawl through the Compile line you will see that I used v1.8.13 IDE (-DARDUINO=10813) Board = ESP32 DEV (-DARDUINO_ESP32_DEV) and the Core is v1.0.4 ( "-IC:\Users\David Prentice\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\variants\esp32")

I suggest that you always try ready-made examples first.

Note that the readreg sketch uses no libraries at all. Just virgin digitalRead() and digitalWrite()

David.

This topic was automatically closed after 120 days. New replies are no longer allowed.