Thankyou a ton for the info and confirmation! Will go ahead and use it.
Regards,
Deepak
Thankyou a ton for the info and confirmation! Will go ahead and use it.
Regards,
Deepak
One more quick question if someone could help here.
From the product document shared 2.8inch SPI Module ILI9341 SKU:MSP2807 - LCD wiki I see that they seem to have used two different SPI buses. I see pin allocations for LCD SPI and Touch SPI are different even for CLK, MISO, MOSI.
But when I saw the TFT_eSPI library, I see that they're using common pins for CLK, MOSI, MISO and different pins for SS and D/C.
So my question is: whether the LCD is using different SPI buses internally for LCD and Touch? I would think that both LCD and Touch could be used independently and hence breakouts are different for SPI bus on that board, but on the uC side, they could share the same SPI bus.
Would that be a fair/correct understanding?
Regards,
Deepak
One more issue I see here is as follows:
I have one peripheral connected to my ESP32 on SPI bus at a frequency of approx 800 Khz. Max I could increase it to some 2.4 MHz or so.
Looking into the library files, the SPI frequency of the TFT_eSPI driver seems to be lot higher (understandably so for display use).
Is this understanding correct? Would that mean that I'll have to run two SPI buses now? One for my slow peripheral and other for the LCD?
Some information on this would be greatly appreciated. My PCB design is stuck because of this
Regards,
Deepak
No. You use Transactions e.g. SPI.beginTransaction(deepak_setting) when you access your slow peripheral.
David.
Ohh wow! That is quite a handy option to have! I almost changed my schematic to use the HSPI bus on ESP32. What a save, thanks a ton for this. I'll try it out before finalising it.
Regards,
Deepak
Hi,
Followup on my query.
I have two ESP32 boards:
We broke our heads for weeks and couldn't get the LCD working with board #2. We connected Vcc to 3.3V pin. When we tried to troubleshoot, we saw that as soon as we connected the LCD module to the board, the vtgs on Vin and 3V3 pin almost disappeared. We couldn't get any further with the troubleshooting so we just tried the board #1. And Voila! Immediately the LCD lit up.
Now we couldn't figure out why board #2 was not working and didn't want to spend any further time on it so we continued with board #1.
So LCD is now working, but unfortunately we can't get the touch to work.
Here's what we did:
This, along with the existing connections for the LCD part.
As soon as we powered up the board and the LCD, things went blank on the LCD. Just the backlit.
I'm suspecting we're doing something wrong with the connections. Would someone be so kind to help us out here? Might be if we can have the ckt if someone has already made this work? Would be of immense help.
Regards,
Deepak
Seriously. You have an ESP32. Use Bodmer's TFT_eSPI library.
If you have a problem:
Yes, it takes 10 minutes of your life to provide the information.
But you will get an accurate reply. Possiibly even from Bodmer.
Your product link provides some good information.
However, I would not recommend the LCDWIKI library software. Life will be easier with TFT_eSPI library. It wass designed for ESP32 and ESP8266.
David.
My unconditional apologies David.
User_Setup.h (12.9 KB)
I also tried with this below attached configuration. With the below, LCD continues to work but touch doesn't. I tried the "Test_Touch_Controller" example from the TFT_eSPI library itself, and I couldn't get any touch inputs seen on the serial port.
Go on. You should connect (Slave) SDO and (Slave) T_DO to (Master) MISO
And SDI, T_DIN to (Master) MOSI
MOSI means Master-Out, Slave-In
MISO means Master-In, Slave-Out
Your User_Setup.h "looks" ok. Especially if all the examples display correct colours, directions, ...
Thankyou David for your inputs. I did try that already. Check my post
deepak4you:
Here's what we did:
- Connected SCK <-> T_CLK <-> ESP32_PIN18
- Connected SDI(MOSI) <-> T_DIN <-> ESP32_PIN23
- Connected SDO(MISO) <-> T_OUT <-> ESP32_PIN19
- Connected T_CS <-> ESP32_PIN21
This, along with the existing connections for the LCD part.
When we made these connections, the LCD just went blank with only the backlit illuminated. Since that was my understanding of the connections and it did not work, hence I put a query here.
You think there's something wrong with the connections? Or maybe I should use an external power supply? Might be the LCD module is falling short of power when sourced from USB port only?
You appear to be using the default wiring. (Always a good idea to use the Author's default)
Personally, I use:
...
#define ILI9341_DRIVER
...
#if defined(ESP32)
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS 5 //15 // Chip select control pin
#define TFT_DC 13 //2 // Data Command control pin
#define TFT_RST 12 //4 // Reset pin (could connect to RST pin)
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
#define TOUCH_CS 25 //21 // Chip select pin (T_CS) of touch screen
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
#endif
...
We really need to see a real photo of your wiring. I am 100% certain that Bodmer's wiring is 100% tested.
I can only report my experience i.e. my wiring works for me. I use the same wiring with ESP8266, Teensy3.2, Nucleo, ...
David.
So i tried below:
TFT_eSPI ver = 1.4.5
Processor = ESP32
Frequency = 240 MHz
Transactions = Yes
Interface = SPI
Display driver = 9341
Display width = 240
Display height = 320
MOSI = D23 (GPIO 23)
MISO = D19 (GPIO 19)
SCK = D18 (GPIO 18)
TFT_CS = D15 (GPIO 15)
TFT_DC = D2 (GPIO 2)
TFT_RST = D4 (GPIO 4)
TOUCH_CS = D21 (GPIO 21)
Font GLCD loaded
Font 2 loaded
Font 4 loaded
Font 6 loaded
Font 7 loaded
Font 8N loaded
Smooth font enabled
Display SPI frequency = 5.0 MHz
Touch SPI frequency = 2.5 MHz
I restarted many times after that. It seemed as if the many buttons that I had pressed in my first attempt kept popping up on the screen at random times even after multiple reboots. Felt as if the pressed keys (actually the pressed area of the screen) were stored in a non-volatile buffer and was sent/read even after multiple reboots that followed.
I'm happy to see that atleast the touch is working, but so slow that I even a snail would win.
Any cues from this as to what might be going on/what might be wrong?
I ran Examples/Test and Diagnostics/Read_User_Setup/
Result: similar output to you
TFT_eSPI ver = 1.4.5
Processor = ESP32
Frequency = 240 MHz
Transactions = Yes
Interface = SPI
Display driver = 9341
Display width = 240
Display height = 320
MOSI = D23 (GPIO 23)
MISO = D19 (GPIO 19)
SCK = D18 (GPIO 18)
TFT_CS = D5 (GPIO 5)
TFT_DC = D13 (GPIO 13)
TFT_RST = D12 (GPIO 12)
TOUCH_CS = D25 (GPIO 25)
Font GLCD loaded
Font 2 loaded
Font 4 loaded
Font 6 loaded
Font 7 loaded
Font 8 loaded
Smooth font enabled
Display SPI frequency = 27.0 MHz
Touch SPI frequency = 2.5 MHz
I ran Examples/320x240/Keypad_240x320
Result: worked fine
I ran Examples/Generic/Touch_Calibrate
Result: worked fine
I ran Examples/Generic/On_Off_Button
Result: worked fine
I ran Examples/Test and Diagnostics/Test_Touch_Controller/
Result: random x, y, z values until I touch the screen. then I get Z values > 1024 (i.e. pressed) with valid X, Y values. (note these are raw ADC values and not pixel coordinates)
I would not expect anything from your photos.
Please post a clear photo showing coloured wires mating with named ESP32 pins.
Although I don't like breadboards, you could plug the TFT into one side with the ESP32 plugged into the other side. I would trim solid coloured wires to connect neatly between TFT and ESP32.
Take a photo of neat wiring. Every reader can check your wiring.
At least you have a 3.3V screen with a 3.3V ESP32. Much better than people fiddling with 5V Uno and level shifters.
Personally, I make custom shields with Protoshield pcbs with soldered headers to receive the TFT.
I can then use the "custom shield" with any Arduino-style board e.g. Due, Zero, STM32, ..., TTGO ESP32, R1 D1 ESP8266
David.
So it seems it worked finally for me as well.
What I had done initially was that I had reduced the LCD SPI frequency to 5MHz or 10MHz. For some reason, I was trying to run the LCD at a lower SPI frequency, but still touch would not work. I even tried to reduce the touch frequency, even that did not work.
After all these discussions here and my last experience where I would get delayed touch inputs, I set the LCD SPI frequency to 40MHz and Touch SPI frequency set the default 2.5MHz. And that seems to have worked!
I tried to get raw readings from the touchpad and that seemed to work but the keypad did not work. I think i'll have to reset the calibration in the code and start the process all over again to see if it is working fine.
x: 0 y: 3640 z: 79
x: 0 y: 3568 z: 111
x: 26 y: 3368 z: 49
x: 0 y: 2991 z: 118
x: 260 y: 3343 z: 64
x: 0 y: 3695 z: 176
x: 0 y: 3743 z: 113
x: 0 y: 3647 z: 90
x: 1471 y: 1891 z: 1310
x: 0 y: 3742 z: 177
x: 0 y: 3614 z: 148
x: 0 y: 3623 z: 180
x: 0 y: 3719 z: 51
x: 0 y: 3680 z: 87
x: 2655 y: 2087 z: 1084
x: 0 y: 3712 z: 86
x: 0 y: 3648 z: 96
x: 1888 y: 2959 z: 1438
x: 0 y: 3704 z: 91
x: 2687 y: 2684 z: 1817
x: 2272 y: 2416 z: 1054
x: 0 y: 2928 z: 109
x: 3132 y: 2823 z: 1699
x: 258 y: 3369 z: 80
x: 0 y: 3703 z: 101
x: 95 y: 3681 z: 156
x: 0 y: 3584 z: 84
x: 0 y: 3715 z: 133
x: 0 y: 2928 z: 30
x: 0 y: 3135 z: 158
x: 0 y: 2944 z: 56
x: 20 y: 3439 z: 84
x: 37 y: 3452 z: 18
x: 0 y: 3703 z: 82
I really don't understand what the issue was from the beginning, but it looks like everything worked with the standard configuration mentioned in the library itself.
The one thing surely that did not work was the 36pin NodeMCU-32S version of ESP32 dev board. That we checked multiple times on multiple board and did not work with the 36pin version board.
I'll still provide an update once I test the keypad code as well.
Regards,
Deepak
Think about it. Random jumper wires with loose connections will never work reliably.
Use regular square header pins with mating sockets.
Stationary solid-core wires are fairly good.
Or use soldered wires which should be the best.
Remember that the ESP32 is a fast processor. It will respond to glitches that a 16MHz Uno would ever notice.
David.
So keypad worked as well.
I think I know what happened. Since the code wasn't working on the 36pin version of the board, we kept trying different things, one of them being changing the SPI frequency.
About the wiring. We tried the breadboard initially, but with the 36pin board. And the code was still not working. Hence to eliminate any breadboard issues, we decided to hard-solder the pins. And hence we used male-female berg jumpers to do the 3 SPI connections from the LCD part to the touch part. To ensure the connections were clean, we soldered the male part of the berg pin to the board (LCD pins), and the female part slid easy and clean on the touch part. Didn't leave any possibility of a bad connection/connector.
When we used the 30pin board, all worked ok as it was supposed to be.
Apologies if this thread led to nothing. Thankyou David, ketineni and Bodmer himself to have made our lives a luxury by providing this library.
The SPI frequency should not be critical. An ILI9341 works well at 27MHz. It even works at 42MHz (as used by Marek's ILI9341_due library)
I tend to run at 8MHz or 4MHz when debugging because a cheap Logic Analyser will not be much good > 12MHz
David.
Thanks David. I am also unsure what caused the issue, but it did. Fortunately that issue is resolved, but I've hit a wall with another issue with the same display - using LCD+Touch on HSPI port and rest of my peripherals on the VSPI port. That is not working and I just started a thread here for the same. Hope I get a resolution to this as well.
Regards,
Deepak