Page 1 of 2

ST7789 component bug (SOLVED)

Posted: Wed Oct 27, 2021 7:37 pm
by Sasi
Hello,

I wanted to try a 240x240 1,3" display module with the ST7789 driver, but it didn't work. I tested it with PIC16F18875 MCU.
Then I saw that someone else had also the same problem with this component macro.
I took a snapshot of the display control.
The yellow signal is for SCL, the green is for D / C and the blue is for SDA.
ST7789Dataline.jpg
ST7789Dataline.jpg (89.22 KiB) Viewed 3475 times
ST7789_TEST.fcfx
(9.9 KiB) Downloaded 113 times
You can see that the MCU data output and the LCD drive data output are sometimes active at the same time, which does not seem to be correct.
Is this component macro reparable?
Does it use a hardware SPI module? If it does, how can I select the channel to use.

Best Regards,
Sasi

Re: ST7789 component bug

Posted: Fri Oct 29, 2021 2:11 pm
by BenR
Hi Sasi,

Do you have a link to the specific display you're using so we can see how it's configured.

Re: ST7789 component bug

Posted: Fri Oct 29, 2021 2:34 pm
by Sasi
Hi Ben,

I have a few pieces of this type.
GMT130_v1_0.jpg
GMT130_v1_0.jpg (55.13 KiB) Viewed 3439 times
I hope there is correct data on the PCB. :roll:

Thanks:
Sasi

Re: ST7789 component bug

Posted: Fri Oct 29, 2021 3:24 pm
by Sasi
I also tried it with PIC18F27Q10 MCU. I used only the "Initialise" command of macro.
The problem is same as before.
This happened on the data line after a Reset:
ST7789_INIT.jpg
ST7789_INIT.jpg (54.67 KiB) Viewed 3435 times
ST7789Dataline_Init.jpg
ST7789Dataline_Init.jpg (103.95 KiB) Viewed 3435 times
ST7789_TEST_Q10.fcfx
(8.77 KiB) Downloaded 109 times
The beginning of the second (EFh) byte is not perfect either.

I hope I could help you.
Have a nice weekend.

Sasi

Re: ST7789 component bug

Posted: Sat Nov 13, 2021 9:36 pm
by Sasi
Hello,

I think I found a possible cause of the error.
In the Initialization macro, the clock signal starts from a high level when the MCU sends the first byte to the LCD module. (01h, Software reset)
A rising edge is missing to write the MSB bit of the first data byte. The first data byte has only 7 clock pulses.
ST7789_Initialise_First_byte.jpg
ST7789_Initialise_First_byte.jpg (60.54 KiB) Viewed 3349 times
Therefore, the LSB bit of the first data byte will be the MSB bit of the second data byte.
This shift is true for the entire data stream, so both the 52h command (Read display brightness value)
and the 56h command (Read content adaptive brightness control) appear on the data line,
switching the SDA line of the LCD module to output mode.

Regards,

Sasi

Re: ST7789 component bug

Posted: Mon Nov 15, 2021 4:11 pm
by BenR
Hello,

Thanks for letting us know, I've now created an update for the component for you on the library update system which should hopefully fix the clock problem.

Re: ST7789 component bug

Posted: Tue Nov 16, 2021 9:10 am
by Sasi
Hi Ben,

The clock is OK now, but the display still does not work. :(
The anomaly is still on the SDA pin.
I'm still experimenting with it.

Regards,
Sasi

Re: ST7789 component bug

Posted: Tue Nov 16, 2021 6:10 pm
by Sasi
Hi Ben,

I implemented and tested the initialization datas and commands of the ST7789 display with an SPI Master macro.
If the polarity of the clock is "Idle low" and the phase of the clock is "Leading edge" then I experience the original problem.
If I set the polarity of the clock to "Idle High" and leave its phase on "Leading Edge", it works correctly.
I don't know why, but the display works in this setting only. :o (I read the description of the ST7789 chip superficially.) :oops:
Would you set the polarity of the clock to "Idle High"?

Thanks,
Sasi
ST7789_InitTEST_working.fcfx
(18.56 KiB) Downloaded 117 times

Re: ST7789 component bug

Posted: Thu Nov 18, 2021 3:09 pm
by Sasi
Hi Ben,

Can you change the polarity of the clock signal, please?
Or is it a more complex task and takes longer?

Regards,
Sasi

Re: ST7789 component bug

Posted: Fri Nov 19, 2021 3:14 pm
by BenR
Hi Sasi,

Thanks for letting us know and sorry for the delay.

I've made a change to the component for you now so that it should idle high and hopefully that will solve the problem.