Need help with esp32 and 1.54" 3 wire 9 bit display

Yea, sorry about that.
I checked and found for 0x0C ping that we are doing, I'm getting back 0x66.
So as per datasheet (see attached image) it is 18 bit per pixel

Untitled.png

I have never seen a datasheet for ST7789H2. I have datasheets for ST7789 and ST7789V.
Sitronix revisions will be consistent.

Himax change behaviour and protocol between revisions.

The Adafruit SPITFT class uses SPI mode#3 when bit-bashing. And mode#0 for hardware SPI.
Most TFT controllers will work with either mode#0 or mode#3.

My bit-bash readreg code is mode#0. Please do not mix mode#0 and mode#3 calls. The /CS line should synchronise ok. My ST7789 board has no /CS pin. It works with Adafruit_ST7789 bit-bash constructor but not with hardware SPI constructor.

I suggest that you adapt the Adafruit code. Or perhaps I might post a special 9-bit Branch of my ST7789_kbv library.

My readreg reads the "reset" values of the registers. Hence PIXFMT=0x06. All controllers default to 0x06. Life is much simpler if you select PIXFMT=0x05 and use 565 pixels.

David.

I have attached the st7789H2 datasheet to the GitHub link messaged to you.

I can change the PIXFMT to 0x66, 0x06, 0x55 or 0x05 form the LCD initialization code, and was able to read it back, even I realized 565 format was better since I have adafruits library, but it didn't work maybe I'm missing something there. Ill code some more later today, will tell you.

In a nutshell, I need to send command Caset, then its parameter, command Raset and its parameter, and then 0x2C command (to push the window set from RAM to screen) and then the pixel data for each of the pixel in the window defined, correct?
Do I need to send the anything after sending the pixel data for it to write to screen or just sending the pixel data is enough?

PS: I was finally able to turn on the LCD. I need to experiment on different RGB format I guess for LCD to show colors. I'll probably check other coded libraries for reference. The code is on GitHub for you to check/edit please if you may.

Hi David,

So finally I was able to get the display working, showing color and stuff. The problem was that DC was the 9th-bit clone of MOSI. This was so strange and frustrating. I tried using just the mosi, or just the dc, but neither worked alone. Both have to be in there! MOSI was bi-directional.
The code is there on GitHub for you to check. Only file Init.cpp may be of interest to you.
Thanks again for your help.

Shravan

Did you try my Branch on Github?
I have tested it on ST7789, ILI9341, ILI9481, ILI9488.
Only 9481 is 9-bit. 7789, 9341 can use 565 or 666 pixels. 9481, 9488 can only use 666 pixels.

The ESP32 library is broken. You have to fix this if you want to use the ESP32 hardware SPI.

I will look at your code. But it is non-standard.
My library uses regular GFX calls i.e. like 95% of the civilised world.

David.

I did not. I'll probably try it next week.

The color format was 666 RGB, 9 bit for each of the parameter. It turned out to be simpler than the 565 RGB, since each of RGB was a byte long + 9th bit.

I'll probably port the code to include the GFX library.

Anyways, I'm currently trying to get the capacitive touch working. It is based on FT6336.
I'm using IO16 = SCL, IO17 = SDA, IO19 = INT on ESP32 for this, hopefully, these pins are okay for the touch interface.
It's an I2C bus, and I'm using Wire.h library of ESP32 to get it going.

I'll try and get this working, don't know if you have ever worked on FT6336?

Shravan