Skip to main content
MNapi
Senior II
January 21, 2024
Question

does anybody have a working code for GT911 (touch controller) ?

  • January 21, 2024
  • 2 replies
  • 10584 views

I found code on github

https://github.com/DiveInEmbedded/GT911-Touch-driver

I cannot get it to read touch data

he might be using chip with older firmware

When I try to ready firmware version I get 0x1060

The manual I found says for firmware 1040 or higher, so I guess 0x1060 might be 1060.

it is a good controller made in China, I see a lot of people asking.

No tech support from China, from the company GOODIX which makes it.

You have to initialize the chip first, configure on start each time. This might be the problem.

 

2 replies

MNapi
MNapiAuthor
Senior II
January 28, 2024

The codes are written not for STM32 so trying to figure out what other programmer was doing takes a little time.

The problem was configuration file, as usual something simple but it takes time to find out. Something I coudn't find out reading somebody else code. The configuration code might be already loaded depending how you got the display.

here is the configuration file for 1024 x 600 display, I have updated:

uint8_t GT911_Config[] = {
0x82, 0x00, 0x04, 0x58, 0x02, 0x0A, 0x0C, 0x20, 0x01, 0x08, 0x28, 0x05, 0x50, // 0x8047 - 0x8053
0x3C, 0x0F, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x8054 - 0x8060
0x00, 0x89, 0x2A, 0x0B, 0x2D, 0x2B, 0x0F, 0x0A, 0x00, 0x00, 0x01, 0xA9, 0x03, // 0x8061 - 0x806D
0x2D, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, // 0x806E - 0x807A
0x59, 0x94, 0xC5, 0x02, 0x07, 0x00, 0x00, 0x04, 0x93, 0x24, 0x00, 0x7D, 0x2C, // 0x807B - 0x8087
0x00, 0x6B, 0x36, 0x00, 0x5D, 0x42, 0x00, 0x53, 0x50, 0x00, 0x53, 0x00, 0x00, // 0x8088 - 0x8094
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x8095 - 0x80A1
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x80A2 - 0x80AD
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, // 0x80AE - 0x80BA
0x0C, 0x0E, 0x10, 0x12, 0x14, 0x16, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, // 0x80BB - 0x80C7
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x80C8 - 0x80D4
0x02, 0x04, 0x06, 0x08, 0x0A, 0x0F, 0x10, 0x12, 0x16, 0x18, 0x1C, 0x1D, 0x1E, // 0x80D5 - 0x80E1
0x1F, 0x20, 0x21, 0x22, 0x24, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, // 0x80E2 - 0x80EE
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x80EF - 0x80FB
0x00, 0x00, 0x9D, 0x01 }; // 0x80FC - 0x8100

 

First it did not want to load and update the chip, when I was reading register at address 0x8047, it was showing me 0x81.

It will not load unless the number is equal or bigger. I had to change it to 0x82. Then I had to update the checksum

at 0xFF which is 0x9D in order to the chip to accept the new data and to work. Then the flag at address 0x8100 has to be changed to 0x01.

 

It took a little time to get it working. Also reading the coordinates was a little tricky too. You have to read and reset status of one register after reading. But at the end it is looks very simple.

Senior
June 26, 2024

@MNapi did you find any code/library that is reliable and working straight out of the box?

 

Thank you

AAlzh.1
Associate II
September 14, 2024

There's a working Arduino library, you can setup the i2c code in your platform and just change the Arduino Wire function calls with your STM32 i2c code.

Also, you can connect your STM32 dev board into Aruino IDE and test your project there, then you can switch to your preferred platform.