Bodmer / TFT_eSPI

Arduino and PlatformIO IDE compatible TFT library optimised for the Raspberry Pi Pico (RP2040), STM32, ESP8266 and ESP32 that supports different driver chips
Other
3.79k stars 1.09k forks source link

RP2040 incompatible with ST7789 240x240 which has no CS pin #1758

Closed Dresch123 closed 2 years ago

Dresch123 commented 2 years ago

I have been able to get 128x128 pixel ST7735 displays working with the Pico Pi. Great!

I recently tried a 240x240 pixel ST7789 display with the Pico Pi and have not gotten anything except a blank screen. This is the display variety without the CS pin. This display works fine with ESP32 and ESP32S2 but not the Pico.

I read in one of your previous posts that SPI MODE 3 must be used with this type of display. Is there a way of invoking this SPI mode with the current library?

Thanks again for this library!

Bodmer commented 2 years ago

That display seems to be very sensitive to startup conditions. I have found one in my bit box and as you say it does not work with the RP2040. It works with ESP32 and ESP8266 though!

No idea why it does not work, all the signals look good.

Dresch123 commented 2 years ago

There are published instructions on adding a CS control line to these displays. I will try that and see if it changes anything. Thanks.

Dresch123 commented 2 years ago

Yes, adding the CS control pin does allow the ST7789 display to work with the Pico Pi and your library Add_CS st7789_Spiral .

Dresch123 commented 2 years ago

https://www.instructables.com/Adding-CS-Pin-to-13-LCD/

Bodmer commented 2 years ago

The problem with no CS pin is that that spurious clock glitches when the SPI port starts up causes a loss of sync between a particular data bit and the corresponding clock pulse. This means data is shifted and commands look like garbage so the display does not get initialised. The hardware reset is toggled so this would be expected to sync the data, but that does not seem to happen. Maybe biasing the control lines to a known state with pull-ups or pull-downs would help.

The CS line normally does the job of resyncing the bits to each clock pulse, so that is why it works now.

In summary, I think displays without a CS line should be avoided.

Bodmer commented 2 years ago

It is possible to set the SPI mode in the setuo file by for example adding this line in the setup file:

#define TFT_SPI_MODE SPI_MODE0