It's originally for mega2560 but i want to run it with my esp32 microcontroller.
I've been working to make this work but it's just sits there an just looking my face with a white screen..
i'm working on this about 4 days straight but nothing happened.. I was being really gentle with lcd so no damage nor i over voltage it. So it's probably because of the code but i can't find where the problem is Can you guys help me out with this thing?
thanks in advance
the links i intented to use above:
[3.5" - 320x480 - 16bit parallel - 65k colour - TFT LCD - Direct Support w/Mega2560]: www.lcdwiki.com/3.5inch_Arduino_Display-Mega2560
[TFT_eSPI]: github.com/Bodmer/TFT_eSPI
[UTFT-ESP]: github.com/gnulabis/UTFT-ESP
[lcdwiki mentions (module package)]: www.lcdwiki*.*com/3.5inch_Arduino_Display-Mega2560
[""[DOWNLOAD]""]: www.lcdwiki.com/res/Program/Arduino/3.5inch/Mega2560_16BIT_ILI9486_MAR3513_V1.0/3.5inch_Arduino_Mega2560_16BIT_Module_ILI9486_MAR3513_V1.0.zip
In User_Setup_Select.h from TFT_eSPI #include <User_Setups/Setup503_Theo_Clock_ESP32_ILI9486.h>
In map User_Setups a file with the name 'Setup503_Theo_Clock_ESP32_ILI9486.h'
// USER DEFINED SETTINGS
// Set driver type, fonts to be loaded, pins used and SPI control method etc
//
// See the User_Setup_Select.h file if you wish to be able to define multiple
// setups and then easily select which setup file is used by the compiler.
//
// If this file is edited correctly then all the library example sketches should
// run without the need to make any more changes for a particular hardware setup!
// Note that some sketches are designed for a particular TFT pixel width/height
// User defined information reported by "Read_User_Setup" test & diagnostics example
#define USER_SETUP_ID 503
// Define to disable all #warnings in library (can be put in User_Setup_Select.h)
//#define DISABLE_ALL_LIBRARY_WARNINGS
// ##################################################################################
//
// Section 1. Call up the right driver file and any options for it
//
// ##################################################################################
#define ILI9486_DRIVER
#define TFT_INVERSION_OFF
//#define TFT_INVERSION_ON
// ##################################################################################
//
// Section 2. Define the pins that are used to interface with the display here
//
// ##################################################################################
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
#define TFT_CS 22 // Chip select control pin D8
#define TFT_DC 14 // Data Command control pin
#define TFT_RST 25 // Reset pin (could connect to NodeMCU RST, see next line)
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
//#define TFT_BL PIN_D1 // LED back-light (only for ST7789 with backlight control pin)
//#define TOUCH_CS PIN_D2 // Chip select pin (T_CS) of touch screen
#define TOUCH_CS -1
// ##################################################################################
//
// Section 3. Define the fonts that are to be used here
//
// ##################################################################################
// Comment out the #defines below with // to stop that font being loaded
// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not
// normally necessary. If all fonts are loaded the extra FLASH space required is
// about 17Kbytes. To save FLASH space only enable the fonts you need!
//#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
//#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
//#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
//#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
//#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
//#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
// this will save ~20kbytes of FLASH
#define SMOOTH_FONT
// ##################################################################################
//
// Section 4. Other options
//
// ##################################################################################
//#define SPI_FREQUENCY 27000000
//#define SPI_FREQUENCY 40000000
#define SPI_FREQUENCY 55000000 // STM32 SPI1 only (SPI2 maximum is 27MHz)
//#define SPI_FREQUENCY 80000000
// Optional reduced SPI frequency for reading TFT
//#define SPI_READ_FREQUENCY 20000000
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
//#define SPI_TOUCH_FREQUENCY 2500000
Well, i needed it to be really fast and i couldn't find anything that is cheap and bigger than 3" so bought this. Also probably i can't refund it anymore so don't want to waste this thing.
But i probably gonna need to buy it if it doesn't work in this week Rush is because I have exams very soon so want to finish this up before exam week.
The needed pins are on the display that you have. Probably a problem is the level shifters to make the display 5V usable. For ESP32 not needed. I don't know how it works maybe they corrupt the ESP32 while the 5V side is to the input side and the ESP32 isn't 5V proof. That is a point to watch.
The (5V) ISP pins are on the connector.
CS on display pin 21
Reset on pin 22
DC/RS on pin 19
SDI/MOSI on pin 32
SDO/MISO on pin 31
SCK/CLK on pin 33
LED not supported on this display.
cheap is for every one others. I use this 3the option.
Good for you, but bad for all readers, if you hide your solution!
I was wondering if this can be solved, as I believed ESP32 has not enough free pins for 16bit parallel interface. So I would like to learn how you solved it, and if you solved it with the wiring of your first post.
there were still slight issues about it so i was thinking of posting answer after i fixed most of them. For an example: flashing, reverted colors, while drawing rectangle or something there are some skipped pixels, sometimes screen goes blanks..
Sometimes it works perfectly fine sometimes its broken. (There is a possibility that some of them caused by pins that shouldn't be used in this purpose)
[My LCD has 20 pins (No RD pin)]
ESP32 has 18 ~safe~ pins (if wifi not used) and for other 2 you need to sacrifice serial monitor or go with GPIO0 and GPIO2.
[WIRING] *I changed wiring a little bit but it doesn't matter at all
The things i thought for using extra modules: If you give up on RX TX(serial monitor?) pins you can add shift register and with that you got extra space. Or basically suspend lcd and do other things with it's pins (via CS=high).
*Edit: I forgot about your "how you solved it" question. I got my led and put one of its leg to ground and with the other one i checked all of the pins every time i uploaded code. First problem was PlatformIO was not uploading code to microchip so i fixed it. Second was about my code, There was some silly mistakes and also i tried to make it better. And in the end it worked!
Thank you @herom123, time for me to learn, check and try to reproduce!
I remember of a response by @david_prentice, telling some poster to take all 10 fingers, take off the socks and use the toes in addition to count. But I didn't check and kept my socks on.
I will take a look at all my ESP32 boards. I think on some (most?) some GPIO pins are missing.
And I just got some ESP32S3 boards with many pins.
Jean-Marc
Added: my LOLIN D2 board has all your pins, most in same order.
The whereabouts of my box with other ESP32 boards is currently unknown/misplaced.
This makes sense! Your display has level converters for conversion of 5V IO logic to 3.3V of the display panel controller. With 3.3V IO output of the ESP32 you have very little margin for noise.
My cheap ESP32 Devkit V1 and V2 clones have been found, relocated to a smaller box as candidates to be discarded. They have CP2102 as USB to serial converter, which don't work with ESPtool for program upload (manual push of Boot button needed).
The V1 have less pins and missing GPIO0 pin (boot button), the V2 would have all pins needed.
I have decided to not try to reproduce this test, as wiring a prototype board for the double row parallel connector takes to much time and is error-prone.
At least I have learnt that this can be done, thank you.