Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ST7789 blank display after update to 2.5.43 #3402

Open
MasaoC opened this issue Jul 11, 2024 · 7 comments
Open

ST7789 blank display after update to 2.5.43 #3402

MasaoC opened this issue Jul 11, 2024 · 7 comments

Comments

@MasaoC
Copy link

MasaoC commented Jul 11, 2024

I have an ST7789 module that works fine until version 2.5.34, but after 2.5.43, the display is blank.
Hardware configuration including pin configuration is the same, I modified User_Setup_select.h and Setup18_ST7789 after installing the library in either case.

I'm Using Raspberry Pi Pico with Arduino IDE. Updated library on IDE.
I reverted to 2.5.34 and the display is now working.
Board package version 3.9.3 of Rasberry Pi Pico/RP2040.
Board: Rasberry Pi Pico
SPI interface.

I modified the setup file as below on both versions.

I'm just going to use the old version, but I'm just informing this issue.

// See SetupX_Template.h for all options available
#define USER_SETUP_ID 18

#define ST7789_DRIVER     // Configure all registers

#define TFT_WIDTH  240
#define TFT_HEIGHT 320

#define CGRAM_OFFSET      // Library will add offsets required

// For Pico (PR2040)
#define TFT_CS 17   // Chip Select pin
#define TFT_DC 16   // Data Command control pin 
#define TFT_RST -1  // No Reset pin
#define TFT_MOSI 19
#define TFT_SCLK 18


#define LOAD_GLCD   // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2  // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4  // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6  // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7  // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
#define LOAD_FONT8  // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
// #define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
#define LOAD_GFXFF  // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts

#define SMOOTH_FONT

#define SPI_FREQUENCY       20000000
#define SPI_READ_FREQUENCY  20000000
#define SPI_TOUCH_FREQUENCY  2500000


@Bodmer
Copy link
Owner

Bodmer commented Jul 12, 2024

Thanks for reporting his, I have not used the library for some time due to other time pressures but will investigate as the RP2040 is my favorite processor!

@orhanyor
Copy link

if you add this line to your user setup it should work. #define RP2040_PIO_SPI
I had the same problem here
#3252

@TobiasVanDyk
Copy link

When I add #define RP2040_PIO_SPI it does not play nicely with the TouchScreen:

In file included from C:\Users\Tobias\Documents\Arduino\libraries\TFT_eSPI/TFT_eSPI.h:107, from C:\Users\Tobias\Documents\Arduino\EarleArduino\TouchLCDst7789-Pico\VolumeMacroPad340\VolumeMacroPad340.ino:24: C:\Users\Tobias\Documents\Arduino\libraries\TFT_eSPI/Processors/TFT_eSPI_RP2040.h:244:6: error: #error Touch screen not supported in parallel or SPI PIO mode, use a separate library. 244 | #error Touch screen not supported in parallel or SPI PIO mode, use a separate library. | ^~~~~ C:\Users\Tobias\Documents\Arduino\libraries\TFT_eSPI/TFT_eSPI.h:966:8: error: #error >>>>------>> Touch functions not supported in 8/16-bit parallel mode or with RP2040 PIO. 966 | #error >>>>------>> Touch functions not supported in 8/16-bit parallel mode or with RP2040 PIO. | ^~~~~

@umeiko
Copy link

umeiko commented Jul 31, 2024

mine works

// ST7789 240 x 280 display with no chip select line
#define USER_SETUP_ID 18

#define ST7789_DRIVER     // Configure all registers

#define TFT_WIDTH  240
#define TFT_HEIGHT 280

#define CGRAM_OFFSET      // Library will add offsets required
#define TFT_RGB_ORDER TFT_RGB  // Colour order Red-Green-Blue


#define TFT_CS 9   // CS
#define TFT_DC 8   // RX
#define TFT_RST -1  // No Reset pin
#define TFT_MOSI 7  // TX
#define TFT_SCLK 6  // SCK


#define LOAD_GLCD   // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2  // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4  // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6  // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7  // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
#define LOAD_FONT8  // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
#define LOAD_GFXFF  // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts

#define SMOOTH_FONT

#define RP2040_PIO_SPI
#define RP2040_DMA
// #define SPI_FREQUENCY  27000000
// #define SPI_FREQUENCY  80000000
#define SPI_FREQUENCY  40000000
// #define SPI_FREQUENCY  20000000


#define SUPPORT_TRANSACTIONS

But my issue is the color is wrong, seems tft.pushImage() draw the (blue, red, green) But not (red, green, blue) as expect.

@MasaoC
Copy link
Author

MasaoC commented Aug 15, 2024

Thanks for everyone's reply! #define RP2040_PIO_SPI sounds like a solution to the issue. thanks.
I haven't tried it since I've already moved on to new hardware using a 16-bit parallel connection with TFT.
And I updated the library 2.5.43. And yes, a parallel connection with a new version library does work!

Anyway, thanks a lot. I will leave this issue open for a while but, if there are no more posts for a while I will close as solved.

@jdrowell
Copy link

I wish I'd found this issue before going through all the trouble of git bisecting the pico-sdk. Simply adding

#define RP2040_PIO_SPI
#define RP2040_DMA

like described above fixed the issues with my LilyGo T-Display 2040 on arduino-pico later than 3.2.2. I don't know enough about SPI to tell what the best fix is, but the breaking change in pico-sdk was here:

0121007c853a36cebcf78e591437d6c79c964d4b Improve SPI set-up: Don't change the config whilst it is enabled (#1227)

It seems that disabling and re-enabling SPI does not work well with the TFT_eSPI driver, at least on this board. The only instance that really affects the sketches I tested was in src/rp2_common/hardware_spi/include/hardware/spi.h static inline void spi_set_format(). Just commenting lines 185, 186 and 197 got the TFT working again. And because pico-sdk is still at 1.5.1 on the latest tag of arduino-pico, this fix works for all versions of arduino-pico after 3.2.2.

@Splarkszter
Copy link

I can't make mine work but I'm using an ESP32.

It's the same ST7789 240x320 but without touchscreen.

I have a pico but i need to solder the pins so I haven't been able to try it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants