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

ST7735s display blackout with testlines() and testdrawcircles() #212

Open
KrisBigK opened this issue Feb 14, 2025 · 0 comments
Open

ST7735s display blackout with testlines() and testdrawcircles() #212

KrisBigK opened this issue Feb 14, 2025 · 0 comments

Comments

@KrisBigK
Copy link

What I have done:

I have built a very custom setup with a 160x80 ST7735 screen, and managed to run the "graphicstest" example project with Arduino IDE.

What went wrong:

In the "graphicstest" example, the screen displays as intended when the following two functions are commented. However, it becomes black when running the two functions.

testlines(ST77XX_YELLOW);
testdrawcircles(10, ST77XX_WHITE);

In the video, the MCU runs the "graphicstest" example project. Firstly I pressed the button to hardware reset the MCU. Note that mediabuttons(), the final function of the example project is in the buffer of the screen, and therefore displayed (for a brief moment), from the previous run of the same example project. The program ran fine until testlines(), when the screen turned black. The MCU was still running, as the Serial will eventually print "Done", but the screen would not display anything.

The delay times are reduced to cut down length of the video.

VID_20250214_172239.mp4

My thoughts

There are a million things that could have gone wrong here, but I have concluded that this is most likely an issue with the Adafruit library.
With the same setup I have also tested the E-ink library GxEPD2, which also uses SPI as well as even more flash & RAM. GxEPD2 worked completely fine though. As the project is not (yet) tested with a native Arduino MCU, there is also a possibility that the Arduino support pack of my MCU is the culprit.

Steps to reproduce:

Hardware:
I am using an PY32F002-003-030 series microcontroller with an Arduino support pack by LuatOS. The microcontroller runs on 3.3V & an external 24MHz quartz oscillator.

Sketch used 44368/65536 bytes of flash, and global variables used 1572/8192 bytes RAM. Hardware SPI is used to send data to the LCD screen.

The LCD screen is an 8p plug-in FPC one. The schematic should be correct as the display could show something. There is also an NAND flash on the same SPI bus at the time of testing.

The code modifications that I have done to the example:

// pin definitions and display selection
//#if defined(ARDUINO_FEATHER_ESP32) // Feather Huzzah32
//  #define TFT_CS         14
//  #define TFT_RST        15
//  #define TFT_DC         32

//#elif defined(ESP8266)
//  #define TFT_CS         4
//  #define TFT_RST        16                                            
//  #define TFT_DC         5

//#else
  // For the breakout board, you can use any 2 or 3 pins.
  // These pins will also work for the 1.8" TFT shield.
  #define TFT_CS         PA_4
  #define TFT_RST        PA_14 // Or set to -1 and connect to Arduino RESET pin
  #define TFT_DC         PB_5
//#endif

// For 1.44" and 1.8" TFT with ST7735 use:
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);

In Setup() :

  // OR use this initializer (uncomment) if using a 0.96" 160x80 TFT with 
  // plug-in FPC (if you see the display is inverted!)
  tft.initR(INITR_MINI160x80_PLUGIN);  // Init ST7735S mini display

  // SPI speed defaults to SPI_DEFAULT_FREQ defined in the library, you can override it here
  // Note that speed allowable depends on chip and quality of wiring, if you go too fast, you
  // may end up with a black screen some times, or all the time.
  tft.setSPISpeed(4000000);
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

1 participant