Sitronix have a 240x432 ST7793 controller chip. I can not locate a datasheet.
If you can find a datasheet, I will support the controller.
Meanwhile, you could try tft.begin(0x7783) which is for a 240x320 ST7781 controller.
Or try tft.begin(0xB509) which is for a Renesas 240x432 R61509V controller.
There is an Ilitek 240x432 ILI9326 controller. I do not support it. No one has asked.
Note that guesswork that goes wrong could mean inappropriate commands being sent.
So if you get a white screen, do not leave the display powered.
Your controller is clearly identified as an ILI9326.
Since this is a 240x432 controller, I am guessing that your panel is 240x400 i.e. narrow and deeper than a regular 2.4" 240x320 screen.
Just run the same modified sketch. What happens with 0xB509 ?
Regarding the ST7793. Do you get good vertical scroll? The R61509 that I own will show a white band i.e. the panel is configured for 240x432 when it should be 240x400.
Just run the same modified sketch. What happens with 0xB509 ?
Reply:
Serial took 0ms to start
ID = 0x9326
White screen.
Regarding the ST7793. Do you get good vertical scroll? The R61509 that I own will show a white band i.e. the panel is configured for 240x432 when it should be 240x400.
I will need to think about the "white band" in vertical scroll with your ST7793. (it is not white. it just has random pixels)
David.
Edit. I have added both ILI9326 and ST7793 to the GitHub test branch. You do not need to "force" tft.begin(0xB509)
I have concluded that the "white band" is always going to be present in these "old" controllers.
If you want to use the Vertical Scroll feature, you should call the display 240x432 and accept that not all is visible.
I just got the same 3.97" display. In the graphictest_kvb example I made the "tft.begin(0xB509);" change and it works. But I can't get any touch screen examples working. Does anyone have any examples that use the touch screen to get started?
David,
Can you share the link to your code on GitHub as well as instructions on the forum?
I had always assumed that punters could find their Touch pins with a DMM.
Now that I come to think about it, I can probably diagnose the wiring automatically.
I might even be able to determine which pair are X and which are Y.
I will post a sketch after Ralfie has been to the vet. (assuming it works!)
Ok, the sketch seems to work. It should run on any Arduino.
diagnose_Touchpins.ino:
void showpins(int A, int D, int value, const char *msg)
{
Serial.print(msg);
Serial.print(" (A" + String(A - A0) + ", D" + String(D) + ") = ");
Serial.println(value);
}
void setup()
{
int i, j, value, Apins[2], Dpins[2], Values[2], found = 0;
Serial.begin(9600);
Serial.println("Making all control and bus pins INPUT_PULLUP");
Serial.println("Typical 30k Analog pullup with corresponding pin");
Serial.println("would read low when digital is written LOW");
Serial.println("e.g. reads ~25 for 300R X direction");
Serial.println("e.g. reads ~30 for 500R Y direction");
Serial.println("");
for (i = A0; i < A5; i++) pinMode(i, INPUT_PULLUP);
for (i = 2; i < 10; i++) pinMode(i, INPUT_PULLUP);
for (i = A0; i < A4; i++) {
for (j = 5; j < 10; j++) {
pinMode(j, OUTPUT);
digitalWrite(j, LOW);
value = analogRead(i); // ignore first reading
value = analogRead(i);
if (value < 100) {
showpins(i, j, value, "Testing :");
if (found < 2) {
Apins[found] = i;
Dpins[found] = j;
Values[found] = value;
found++;
}
}
pinMode(j, INPUT_PULLUP);
}
}
if (found == 2) {
Serial.println("Diagnosing as:-");
for (i = 0; i < 2; i++) {
showpins(Apins[i], Dpins[i], Values[i], (Values[i] < Values[!i]) ? "XM,XP: " : "YP,YM: ");
}
}
}
void loop()
{
// put your main code here, to run repeatedly:
}
Please understand that unusual values or if you don't find two pairs, this means that your Touch Glass is probably cracked.
Does anyone have a working demo for the touch screen function for the 3.97" mcufriend shield they can share? I'm coming up short getting a touch screen demo to run at all for this shield. I did not have any issues with the 3.95" shield.
Here are my results running diagnose_Touchpins.ino with my 3.97" TFT LCD on my mega 2560:
Making all control and bus pins INPUT_PULLUP
Typical 30k Analog pullup with corresponding pin
would read low when digital is written LOW
e.g. reads ~25 for 300R X direction
e.g. reads ~30 for 500R Y direction
Testing : (A1, D7) = 33
Testing : (A2, D6) = 21
Diagnosing as:-
YP,YM: (A1, D7) = 33
XM,XP: (A2, D6) = 21
For what its worth the chips on my 3.97" screen read
DP74HC245
5K0101
After a fair amount of searching I found your repository on GitHub. Here is is for those that don't know:
"I have added both ILI9326 and ST7793 to the GitHub test branch. You do not need to "force" tft.begin(0xB509)"
I could not find this test branch you speak of...