Wrong value from readPixel() for ESP32S3 and ST7735
Hi @Bodmer, First of all, great work on this library! really amazing.
I was trying out the readPixel() code posted in other issues but it doesn't work for me. readPixel() is not reporting any value other than '0' for ST7735 on ESP32S3. The screen does get filled with the color red, but only '0' is returned for every pixel.
I have defined the required constants in the user_setup file. Files attached.
#include <TFT_eSPI.h> // Hardware-specific library
#include <SPI.h>
TFT_eSPI tft = TFT_eSPI();
void setup() {
Serial.begin(115200);
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_RED);
int w = tft.width();
int h = tft.height();
Serial.println();
Serial.println(w);
Serial.println(h);
for (int y=0; y<h; y++) {
Serial.println();
Serial.print("y:");
Serial.println(y);
for (int x=0; x<w; x++) {
Serial.print(",");
Serial.print(tft.readPixel(x,y),HEX);
}
}
Serial.print("\ncolor 1: ");
Serial.println(tft.readPixel(30,30),HEX); // <----- Try to read color
}
void loop() {
}
Disclaimer: I don't work on this library. See #3770. (I don't work on those, either; I just don't torture myself with this one.)
As a matter of debugging, I'd see if you can write back the value after reading a pixel just to be sure you don't have an orientation issue where a fillScreen is setting things to red, but a targeted ReadPixel() is targeting a pixel that's off-screen.
A total inability to read points to either a display that can't be read (not all controllers back the display with RAM that can be read—displays can legitimately be write-only) or wiring issues with the master in-slave out pin. I
http://www.technoblogy.com/show?3UEJ shows the basic steps involved in reading a 7735, though the SPI accesses are a bit obfuscated with Arduino slime. SPI reads are covered in the datasheets around 9.4.2 with the frame buffer reads aroiund 9.10/9.11 or so.
https://cdn-shop.adafruit.com/datasheets/ST7735R_V0.2.pdf
Using your logic analyzer to watch the actual bus transactions is generally quite helpful.