cancel
Showing results for 
Search instead for 
Did you mean: 

GT811 Touchscreen Not Working

Alex Grubb
Associate II
Posted on December 09, 2016 at 17:12

Hi,

After playing with the STM32F746G Discovery for a while I decided to get a Waveshare OPEN746I-C kit with a 7 inch LCD with capacitive touchscreen as I wanted a bigger screen and access to more of the pins.

I've got the LCD working using CubeMX to generate a system workbench project and copying the supplied example code into the project and adding the necessary include paths in the C/C++ Build Settings.

However I cannot get the touchscreen working, whilst debugging the code the GT811_init() doesn't seem to be responding to the I2C read requests.

When I import the example project into Keil however the touchscreen works fine so I don't think it's a hardware issue.

I've been through the keil code and cannot see any obvious reason why it works and the system workbench code does not...

Does anyone have this board and has got the touchscreen working in system workbench?

Any suggestions to where I might be going wrong would be greatly appreciated.

Thanks in advance

Alex

9 REPLIES 9
ST Renegade
Senior
Posted on December 09, 2016 at 21:01

Have you tried to debug the code + checking whether in SystemWorkbench there is a communication on the touchscreen bus (I2C or SPI is used for touch, right?)?

Renegade

Alex Grubb
Associate II
Posted on December 10, 2016 at 11:10

Thanks for your reply ST Renegade,

I've tried to debug the code and the I2C read requests READ_SDA() seem to timeout as it seems to be permanently held high (1). The touchscreen is I2C but I don't know how to monitor the I2C bus for communication in System Workbench though I suspect that there isn't any communication on the bus.

Is there an option in System Workbench to monitor this or some other software?

Kind regards

Alex

Posted on December 10, 2016 at 12:53

This is not a STM32-specific issue, rather, general C/microcontroller programming.

> ... the supplied example code

Who supplied this? TS_I2C.c contains a bitbanged I2C implementation, possibly the poorest one I've ever seen.

static void delay_us(uint32_t value)

{

    uint32_t i;

    i = value * 250;

    while(i--);

}

Loop delay might (and will be) entirely optimized out by a half-decent compiler, unless the loop variable is tagged as volatile.

GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;

...SDA_IN() ... SDA_OUT() ...

Not that it can't be get working in a simple I2C setting, but it's not how I2C is supposed to be working - it's based on open-collector (drain).

JW

Posted on December 10, 2016 at 15:43

Hi Jan,

Thank you for your reply and explanation, the example code was supplied by Waveshare who manufactured the board i'm using.

Sounds like it would probably be best if try and re-write the TS_I2C code and use ''proper'' I2C with the HAL driver.

Thanks once again for your help on this problem, it does partly explain why it works in keil but not in System Workbench.

Kind regards

Alex

Posted on December 10, 2016 at 16:16

> Sounds like it would probably be best if try and re-write the TS_I2C code and use ''proper'' I2C with the HAL driver.

It's not what I've said.

There are reasons for bit-banging - it works even if the sensor is connected to pins which don't have I2C connectivity, for example. Also, simple I2C is easier to bit-bang than to use the hardware I2C module. I don't HAL so won't comment on that part.

JW

Posted on December 12, 2016 at 12:41

Hi Jan,

Thanks for your input, I've done as you suggested and tagged the loop variable as volatile and the touchscreen now works.

Thank you again for your help on this problem.

Kind regards

Alex

fournier_g
Associate
Posted on December 12, 2016 at 22:58

Hi Alex,

Since you are using the Waveshare board with an 7' LCD, I would like to know if you were able to make working the complete STemWIN 1024 X 600 examples from Waveshare? I'm working on this and in some samples crashes completly and I do not see why. I imported the code from Keil to VisualGDB. Thank you if you answer.

Posted on December 13, 2016 at 18:39

Hi, 

I haven't got the complete demo of the STemWin example working yet. It's next on my to do list, so will let you know if I can get it working.

Regards

Alex 

Hi Alex, i'm working with same display than yours (provided by waveshare) and also had the same problem, the function GT811_Init() doesn't works.

However i've debug the program and when i step into this function, there is a function call printf ("version:%x\r\n", version); wich crash the program (Console of SystemWorkbench shows "Info : halted: PC: 0x08001c14").

So its seems that is a memory problem, then i commented this function call (printf) and touchscreen is working.

I can't see what loop variable did you declared as volatile. I really want to do it but i couldn't found any delay loop. What loop have you modified?

Many Thanks!!

Andy