Library for st7793

I used David Prentice library and no sucess. Can someone help me?.

Read Registers on MCUFRIEND UNO shield
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)
reg(0x0000) 77 93 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) 00 00 00 00 00 Status Register
reg(0x000A) 00 00 Get Powsr Mode
reg(0x000C) 00 00 Get Pixel Format
reg(0x0061) 00 00 RDID1 HX8347-G
reg(0x0062) 00 00 RDID2 HX8347-G
reg(0x0063) 00 00 RDID3 HX8347-G
reg(0x0064) 00 00 RDID1 HX8347-A
reg(0x0065) 00 00 RDID2 HX8347-A
reg(0x0066) 00 00 RDID3 HX8347-A
reg(0x0067) 00 00 RDID Himax HX8347-A
reg(0x0070) 00 00 Panel Himax HX8347-A
reg(0x00A1) 00 00 00 00 00 RD_DDB SSD1963
reg(0x00B0) 00 00 RGB Interface Signal Control
reg(0x00B4) 00 00 Inversion Control
reg(0x00B6) 00 00 00 00 00 Display Control
reg(0x00B7) 00 00 Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00 ILI9481, HX8357-B
reg(0x00C0) 00 00 00 00 00 00 00 00 00 Panel Control
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA
reg(0x00CC) 00 00 Panel Control
reg(0x00D0) 00 00 00 Power Control
reg(0x00D2) 00 00 00 00 00 NVM Read
reg(0x00D3) 00 00 00 00 ILI9341, ILI9488
reg(0x00DA) 00 00 RDID1
reg(0x00DB) 00 00 RDID2
reg(0x00DC) 00 00 RDID3
reg(0x00E0) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA-P
reg(0x00E1) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA-N
reg(0x00EF) 00 00 00 00 00 00 ILI9327
reg(0x00F2) 00 00 00 00 00 00 00 00 00 00 00 00 Adjust Control 2
reg(0x00F6) 00 00 00 00 Interface Control

1 Like

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.

David.

Sitronix have sent me the ST7793 datasheet.

If you are willing to test code and report the results, I will add support for this controller.

David.

1 Like

http://www.aliexpress.com/item/3-95-inch-TFTLCD-touch-screen-with-Arduino-uno-R3-self-produced-self-marketing-private-custom/32698925330.html?spm=2114.13010608.0.100.GiFs7i

This is the display and is 3.97''.

I'm not sure about driver.

Thanks for all

I am confused. You have two different threads.

You appear to have a 2.8" 240x400 shield with an ILI9326 controller
You appear to have a 3.97" 240x400 shield with an ST7793 controller

I have a datasheet for each controller. But obviously no real-life hardware to test.

I suggest that you just edit graphictest_kbv.ino:

    tft.begin(0xB509);   // the Renesas R61509V is very similar

Report back with the results. For both Shields.

What country are you in?
Do you know how to use GitHub?

David.

David, first thanks for all.

My 3.97'' shield works perfect with B509. You can arrange it for next version of kvb library.

The other tread is about a 2.8" ?x? shield with an ILI9326 controller (see the other thread for report) but marked with (ft1509) in PCB.

The report with graphictest_kbv modified is:

Serial took 0ms to start
ID = 0x9326

I'm from Barcelona, SPAIN.

I don't know how to use GitHub, but i can learn.

Thanks again!!

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.

David.

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.

Appears a band with multicolors in vertical scroll.
https://drive.google.com/open?id=0B08AAYBlSTsBUGJFOXZMSTRWXzQ

IMG_20160817_102147682[1].jpg

I have added a "test-ili9326" Branch to GitHub.

I will send you a PM with instructions.

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?

Thanks,
-Adam

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!)

David.

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.

David.

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.

As far as I know, your 3.97" shield is 240x400 with a ST7793
I presume your 3.95" shield is 320x480 with an ILI9488 / ILI9486

It would take 30 seconds from your life to confirm this.
And another 30 seconds to paste the output from the diagnose_Touchpins.ino sketch.

David.

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

David,

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...

I was however able to get the touch screen working using this sketch: https://github.com/prenticedavid/MCUFRIEND_kbv/blob/master/examples/Touch_shield_kbv/Touch_shield_kbv.ino
I did however have to make the tft.begin(0xB509); change.

I hope this helps someone out that has the 3.97" screen and thanks David for your code.

I have removed the test_9326 branch because the ST7793, ILI9326, SPFD5420 are now supported in the regular Master branch.

David.

David, what about use your drivers with a STM32 board?

I can route cables as i need.

The link of STM32 Board is

https://es.aliexpress.com/store/product/Free-Shipping-1pcs-lot-STM32F103C8T6-ARM-STM32-Minimum-System-Development-Board-Module-For-Arduin0/1280487_32498344057.html?spm=2114.04010208.3.2.6CtxIP&ws_ab_test=searchweb0_0,searchweb201602_2,searchweb201603_1&btsid=5fb4bac5-6497-4129-9fe5-a7e2aa2cb18d

Thank you very much.

You tell me what pins you want to use. It looks as if you have 8 available pins on GPIOA, 16 pins on GPIOB, 3 pins on GPIOC.

I can map databus and control pins anywhere that you say.
However, YP, XM must be on Analog pins for the Touch to work.

Use my diagnostic sketch to see which are YP, XM on the Shield.

I already have the library working on NUCLEO-F072, -F401, -F411 boards.
I would happily buy a NUCLEO-F103 board.

I have no intention of buying your board from AliExpress because it does NOT accept Arduino Shields.

David.

I connect to

8 bit parallel interface

Port data |D7 |D6 |D5 |D4 |D3 |D2 |D1 |D0 |
Pin stm32 |PA7|PA6|PA5|PA4|PA3|PA2|PA1|PA0|

Control Pins

Control pins |RD |WR |RS |CS |RST|
Pin stm32 |PB4|PB5|PB6|PB7|PB8|

and there you have a library can be helpful, for my tft's doesn't work.

Thanks