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

Solving problems with the ST7783 #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aretw0
Copy link

@aretw0 aretw0 commented Jul 4, 2020

I had been having problems with the ST7783. I found a solution that solves my problem and I want to add.
Based on https://forum.arduino.cc/index.php?topic=264068.msg2326989#msg2326989

Only tested on Arduino Uno.

I had been having problems with the ST7783. I found a solution that solves my problem and I want to add.
Based on https://forum.arduino.cc/index.php?topic=264068.msg2326989#msg2326989

Only tested on Arduino Uno.
Copy link
Owner

@prenticedavid prenticedavid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My ST7781 display is a Red 2.4 inch Mcufriend Shield bought in about 2014.
The library Gamma setting is crap. The default Gamma is crap.
I do not get flickering.

Look at the graduated colour band in the graphictest_kbv Penguin screens.
Display Photos on the screen.

What is your screen? Please post a link. e.g. Ebay Sale page.
TFT panels vary. Your shield might have a TFT panel from a different TFT manufacturer but still use a ST7781 controller.

David.

Edit. I added this sequence from the Sitronix App Note. It looks much better on my TFT panel. Both for Colour Grades and for displaying JPEG colour photos.

        static const uint16_t ST7781_regValues_CPT24[] PROGMEM = {
            0x0001, 0x0100,     // Driver Output Control Register (R01h)
            0x0002, 0x0700,     // LCD Driving Waveform Control (R02h)
            0x0003, 0x1030,     // Entry Mode (R03h)
            0x0008, 0x0302,     // Porch
            0x0009, 0x0000,     // Scan
            0x000A, 0x0008,     // Fmark Off
            0x0010, 0x0000,     // Power Control 1 (R10h)
            0x0011, 0x0005,     // Power Control 2 (R11h)
            0x0012, 0x0000,     // Power Control 3 (R12h)
            0x0013, 0x0000,     // Power Control 4 (R13h)
            TFTLCD_DELAY, 100,
            0x0010, 0x12B0,     // Power Control 1 SAP=1, BT=2, APE=1, AP=3
            TFTLCD_DELAY, 50,
            0x0011, 0x0007,     // Power Control 2 VC=7
            TFTLCD_DELAY, 50,
            0x0012, 0x008C,     // Power Control 3 VCIRE=1, VRH=12
            0x0013, 0x1700,     // Power Control 4 VDV=23
            0x0029, 0x0020,     // NVM read data 2 VCM=32
            TFTLCD_DELAY, 50,
            0x0030, 0x0000,     // Gamma Control 1 App Note CPT 2.4
            0x0031, 0x0106,     // Gamma Control 2
            0x0032, 0x0101,     // Gamma Control 3
            0x0035, 0x0106,     // Gamma Control 4
            0x0036, 0x0203,     // Gamma Control 5
            0x0037, 0x0000,     // Gamma Control 6
            0x0038, 0x0707,     // Gamma Control 7
            0x0039, 0x0204,     // Gamma Control 8
            0x003C, 0x0106,     // Gamma Control 9
            0x003D, 0x0103,     // Gamma Control 10
            0x0060, 0xA700,     // Driver Output Control (R60h) .kbv was 0xa700
            0x0061, 0x0001,     // Driver Output Control (R61h)
            0x0090, 0X0030,     // Panel Interface Control 1 (R90h)

            // Display On
            0x0007, 0x0133,     // Display Control (R07h)
            TFTLCD_DELAY, 50,
        };
        init_table16(ST7781_regValues_CPT24, sizeof(ST7781_regValues_CPT24));
        //init_table16(ST7781_regValues, sizeof(ST7781_regValues));

@aretw0
Copy link
Author

aretw0 commented Jul 4, 2020

I think you didn't look at the link I reference and remember that I was talking about the ST7783

I quote for you:

The example programs (MyGraphicTest and tftpaint) worked with a couple of problems:

  • ....(Not important or already solved)...
  • The screen was very bright with low contrast colors. (This was my problem)

The second problem was harder. Looking more closely, it seemed that every other row of pixels was showing white.
I found a couple of posts where people had fixed similar sounding problems by changing some of the settings made to the SST7783 registers when the TFT library initializes the display.
After some trial and error, the following changes to TFTLCD.cpp (in the st7783 library) solved the problem. Near the bottom of the file, there is a PROGMEM array of register addresses and values.

Screenshot_2020-07-04 2 8 TFT LCD, unknown ID - Page 6 (2)

Maybe I could have been clearer and explained more but that's it.

Look the pics of before and after:

photo_2020-07-04_12-30-07

photo_2020-07-04_12-29-59

About the eBay sale page: I received this TFT screen as a gift a long time ago, I will ask the friend that gave me.

And about this:

Look at the graduated colour band in the graphictest_kbv Penguin screens

I'm using PlatformIO and the compiler says that there is no reference for penguin variable.

@prenticedavid
Copy link
Owner

prenticedavid commented Jul 4, 2020

You have a regular Mcufriend shield. My one has AMS117 regulator. Modern (crap) pcb has an empty SOIC-8 footprint.

There is no Sitronix ST7783 controller. The Sitronix ST7781 reports an ID=0x7783.
As I said. Panels vary. My panel works well with CPT2.4 sequence. Your panel may have been made by a different Panel manufacturer.

I can only find the CPT2.4 App Note from Sitronix.
Ilitek App Notes have examples for CPT2.4, CMO2.4, Hitachi2.4, WinTek2.4, LPL2.4, Tianma2.4,

If your sequence produces good results, stick with it.

My panel has a good picture but very narrow viewing angle. (like most cheap Mcufriend shields)

David.

@aretw0
Copy link
Author

aretw0 commented Jul 4, 2020

Sorry if I said something dumb, lol

I don't have much knowledge of electronics. It was cool looking for an answer out there. It brought me here, so I grateful.
I appreciate your explanation and advice about this.

Great work btw

p.s.: FYI, here it is the "eBay" page

p.p.s.: I found this comment of yours at this thread, and I think that's my real problem.

@aretw0 aretw0 closed this Jul 4, 2020
@prenticedavid
Copy link
Owner

prenticedavid commented Jul 5, 2020

As I said. My shield is old. Newer shields might have a different pcb and a different panel.
Your Ebay link shows a pcb with AMS1117 regulator. Does your pcb look the same as the Ebay link ?

Yes, I have a low opinion of the "new pcb" design. And a fairly low opinion of all Mcufriend designs. However, the 2.4 inch shields do "work".

Please try the default ST7781 initialisation from the v2.9..8 Release.
Then try the sequence that I posted.
Then try both sequences with your 0x0002,0x0500, and 0x002B,0x000E, changes.

I would appreciate feedback. i.e, what pcb you have, which initialisation gives the best picture.

David.

@prenticedavid prenticedavid reopened this Jul 5, 2020
@aretw0
Copy link
Author

aretw0 commented Jul 5, 2020

My shield looks a little different from this link.
Here it is:

photo4904906309514668176
photo4904906309514668177

About what you ask:

  • The default ST7781 initialization from the v2.9.8 Release creates something like the "before photo" I sent. Here is an example of this with a project I have been doing:

Initialization from the v2.9.8
photo_2020-07-05_16-33-17

After my changes
photo_2020-07-05_16-32-59

-The sequence that you posted: NAILED IT!

photo_2020-07-05_16-46-03

I don't think I have to change anything, anymore. Thank you very much!!!

Do you want me to add to my PR this perfect sequence?

Regards, Arthur.

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

Successfully merging this pull request may close these issues.

2 participants