ART-PI development board connected to Rose Technology 5 inch LCD screen

table of Contents

 

1. Tool preparation:

2. Development process:

3. Transfer the touch coordinates to TouchGFX:

4. Explanation of information configuration table of GT911 touch chip

5. Summary 


1. Tool preparation:

One ART-PI development board,

A laptop,

RT-Studio software, serial port assistant software, TouchGFXDesigner software, Visual Studio2019 software

2. Development process:

1. Open the RT-Studio software, click New Project, and select the ART-PI development board; this step is a lot of online experience, so I won’t go into details here.

2. Turn on CRC check and DMA2D, in board->cubeMX_config->core->inc->stm32H7xx_hal_conf.h as shown in the figure below:

3. Add TouchGFXlib link library, gt911 touch software package, C++ support, open rt_thread Settings file to add

 Enable the lib library of TouchGFX

Add GT911 touch driver (my LCD screen uses GT911 touch chip). Of course, if you use a different touch chip, you can also add the corresponding software package.

yH5BAAAAAAALAAAAAAOAA4AAAIMhI+py+0Po5y02qsKADs=wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw ==

Open IIC1 (communication channel between MCU and touch chip)

Click Save to add the software package and lib library to your own project (wait patiently, the process is a bit long!)

 Add C++ support

 

3. Transfer the touch coordinates to TouchGFX:

Open libraries->touchgfx_lib->Touchgfx->target->STM32TouchController.cpp file, add TouchGFX lib support, the default is to use the GT9147 touch driver template, here we only need simple modification to use.

 The following place is to see whether the touch coordinates you read correspond to your TouchGFX. If it is the opposite, the default method will be used. Mine is not reversed, so just use the original coordinate data

Alright, now let’s modify a file in libraries->touchgfx_lib->Touchgfx->App->sample_touch.cpp

The first is the same as the above, and the second is to import the header file of the GT911 we use. In the third, we set the device name, and the fourth is to register the device initialization function in the initialization list (specific information Please refer to the RTT official website document) 

At this point, the basic changes that need to be changed are over! But do you think this will work? No, no, you will find that when you download it to the board, your touch coordinates are reversed, and there may be a quarter of your touch screen where the coordinates cannot be obtained. Why? His problem lies in the setting of the GT911 register configuration table. When you look for the information in this register configuration table, you will find that this is a huge array. Of course, you don’t know what each element represents, but here is the most important thing. I will explain some of the places below!

4. Explanation of information configuration table of GT911 touch chip

What does the information configuration table look like? Take a look first!

 So much, we only care about the first seven bytes,

The first byte: the version number of the configuration table, X and Y axis resolution occupies two bytes, the second and third bytes are the x-axis resolution, the fourth and fifth bytes are the Y-axis resolution, the first The six bytes contain the setting of the number of touch points, the seventh byte contains whether to exchange the coordinates of x and y

The first byte:

The version number of the configuration information table! To update the configuration information table, you need to set the version number to be greater than the version number of the previous information table! If the version number is set to 0x00, it will be forced to update! For specific explanation, please see the figure below:

 

 The second and third bytes are the x-axis resolution, which is a 16-bit data, the first byte is the low 8bit of the data, the second byte is the high 8bit of the data; the fourth and fifth bytes are the Y-axis resolution rate;

The sixth byte is interpreted like this:

 

The low 4bit is to set the number of touch points, the high 4bit is 0 by default

Seventh byte

 

Here we only need to care about 0-1bit and how 3bit is set. 0-1bit is to select the trigger mode. Here I use interrupt falling edge trigger, that is, 01. The third bit is to set whether to exchange x, y coordinates, according to yourself Can be set

The explanation in the data sheet of GT911 is attached below:

Attach my own information configuration table array, if the screens are the same, it should be directly usable (the touch resolution I set here is 1024*600)

    0x00,0x00,0x04,0x58,0x02,0x05,0x35,0x00,0x01,0x08,
    0x28,0x08,0x5a,0x46,0x03,0x05,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x18,0x1a,0x1e,0x14,0x89,0x2a,0x09,
    0x57,0x5c,0xb5,0x06,0x00,0x00,0x00,0x02,0x01,0x1d,
    0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x46,0x82,0x94,0xc5,0x02,0x07,0x00,0x00,0x04,
    0x96,0x4a,0x00,0x85,0x54,0x00,0x77,0x5f,0x00,0x6a,
    0x6c,0x00,0x5f,0x7a,0x00,0x5f,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x02,0x04,0x06,0x08,0x0a,0x0c,0x10,0x12,
    0x14,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x02,0x04,0x06,0x08,0x0a,0x0f,0x10,
    0x12,0x16,0x18,0x1c,0x1d,0x1e,0x1f,0x20,0x21,0x22,
    0x24,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x01

5. Summary 

Alright, after doing this, you can start your embedded GUI journey with confidence! Everyone is welcome to like it! The blogger is a good and fun person!

There is something wrong in the article, everyone is welcome to criticize, correct and leave a message!

 

Guess you like

Origin blog.csdn.net/songjun007/article/details/113922992