IPS LCD, ESP32 with eSPI library and Touch screen (DIY Generator Part 9)

Finally, a bit of a progress with the generator. This post will be about some experiences with the LCD, eSPI library and touch.

Links to project’s all posts

  1. VCA822 Gain Amplifier Circuit
  2. LM7171 Offset Circuit
  3. Gain and Offset Control Filter Circuit
  4. Dual 5V Power Supply
  5. Dual 12V TPS65131 Power Supply
  6. Battery Charging Circuit with BQ24295
  7. Basic WEB Interface
  8. IPS Capacitive LCD on an ESP32
  9. IPS LCD, ESP32 with eSPI library and Touch screen (this post)
  10. Final PCB Design for the DIY Waveform Generator
  11. Custom Design PCBs and How To Get Them Manufactured
  12. Soldering the PCB
  13. AD9833 Library and Further Output Noise Reduction
  14. Arduino BQ24295 Battery Charger Library
  15. LCD GUI with LVGL on ESP-32
  16. 3D Printed Enclosure
  17. Finished DIY generator

Problems with the LCD

First of all, I would like to comment one tiny problem which took me more than a week to solve. At first, as written in the previous post, LCD behaved perfectly, but when I have changed pin out how LCD is connected to the LCD, it started to misbehave.

Everything started with an eSPI library tests. Then I have tough that maybe ESP32 was too fast for the LCD. So, I have tried adding some delay in between write signal rise and fall edges – at first it solved the problem, but nor for long. Any random changes in the main code (like adding additional screen fill with a color) showed that the problem persisted and sometimes LCD even wouldn’t initialize.

After a lot of tinkering, checking output data with a logic analyzer, I haven’t found any logical explanation except that ESP randomly doesn’t write data to the LCD. And this got me wondering as I have at some point read that some versions of the ESP32 silicon had a bug with register writes. As it is written in this document, V0 had such problems while in V1 revision those problems were solved. As my development board was bought a log time ago, it had V0 soldered on it. I also had another module bought half a year ago, so it should have been V1 although I couldn’t tell without soldering it in and testing.

After changing the old ESP32 module to the new one all problems were solved. LCD started behaving as it should without any skipped writes. PlatformIO also proved that the new module was V1. So, the main reason of LCD misbehaving was ESP32 itself and only after changes the module to the new silicon revision (V1), the problem was solved.

LCD and eSPI library

As I have mentioned, with the LCD I have used eSPI library. This library should make things easier as it has lots functions of writing data to the display already written. It was matter of changing initialization sequence and library now works with this display. Although I haven’t tested all functions, but at least the basic ones work as intended, so the other ones should work too.

I also have started writing user interface for the generator. It can be seen below. Note that this is just the beginning, but the idea is to get something similar to the web interface written earlier.

FT6236 touch controller and R61529 LCD testing

Touchscreen

This LCD uses FT6236 capacitive touch controller. The controller communicates with the MCU through I2C connection. It also has an interrupt pin, which is pulled low when a touch is detected.

To test how touch detection works, I have written small peace of code which can be found at GitHub. It was written with PlatformIO and after uploading it to the ESP32 (of course after you have physically connected ESP to the LCD and Touch IC), you will find a black screen which draws squares in those places where a touch was detected.

ESP32 touch test code with eSPI and FT6236 controller

Interesting thing is that I somehow haven’t found touch controller I2C address in the datasheet. So, for someone who wonders what it is 0x38.

Also, keep in mind that FPC connectors which are used to connect the LCD to the board are quite hard to solder. I had an issue with the touch controller that it wouldn’t respond to I2C commands and only after thorough inspection I have found that not all FPC pins were fully soldered in…

FT6236 touch controller and its FPC adapter to ESP32 board

The adapter board was made by me at home. I have written a tutorial how it can be done either etching with chemicals or with a CNC router.

Summary

So, because now I know that all hardware more or less works as expected, I can proceed to the last stage – designing the final PCB for the generator. Although now I don’t have fully working firmware, it can be finished during PCB manufacturing or even when everything will be soldered to the board. It doesn’t matter if firmware will be written on dev board or a final PCB.

Links

The LCD was bought from Aliexpress

Touch test code on GitHub: Here

A tutorial for eSPI, Adafruit, LVGL.

Subscribe to a newsletter!

Was this page helpful?