2023-12-21 04:16 AM
Greetings for the day,
I'm working on STM32H745I Discovery board for 4.3 inch Touch Screen Controller ( GT911 i2c interface) able to control LED by touching flex button, working fine as per our requirements (for reference).
We're using our customized board STM32H745XIHT6 microcontroller IC with 10.4 inch LCD screen (LVDS 1024*768 part no TCG104XGLPAPNN-AN30) with touch screen(part no-RXC-GG104098) & touch controller IC (GT928 i2c interface) in our project. I'm using TOUCH GFX DESIGNER 4.18.1 for GFX designing, created a flex button with interaction its working in GFX simulation & GFX designs are displayed on screen, the code generated successfully all the necessary library is added code is error free, but unable to control the LED by touching on flex button. As per my observation there is some issue with touch configuration I'm not getting output from touch controller.
Please find the data sheet attached for both (4.3 inch & 10.4 inch) touch controllers.
I would request you to look into the matter and provide some guidance. Let me know if you need anything else.
2024-01-07 08:37 AM
Your target touch cpp file code show here. Or any debug readings from touch.
2024-01-08 01:37 AM
Thanks for the response.
Debug Observation:- In stm32h745i_discovery_ts.c file
function BSP_TS_Init(uint32_t Instance, TS_Init_t *TS_Init) returns a value
if(FT5336_Probe(Instance) != BSP_ERROR_NONE)
{
ret = BSP_ERROR_NO_INIT;
}
I'm using i2c slave address oxba as per datasheet provided unable to find the FT5336_ID its not available in datasheet.
Please find the TouchGFXGPIO.cpp content.
#include <touchgfx/hal/GPIO.hpp>
/**
* GPIO_ID Enum, these are used bt TouchGFX framework to signal events.
*
* VSYNC_FREQ, /// Pin is toggled at each VSYNC
* RENDER_TIME, /// Pin is high when frame rendering begins, low when finished
* FRAME_RATE, /// Pin is toggled when the frame buffers are swapped.
* MCU_ACTIVE /// Pin is high when framework is utilizing the MCU.
*
*/
/* USER CODE BEGIN TouchGFXGPIO.cpp */
#include "stm32h7xx.h"
#include "main.h"
using namespace touchgfx;
static int GPIO_InvertedLevels[4];
#define M_GPIO_PIN_SET(id) (GPIO_InvertedLevels[id] ? GPIO_PIN_RESET : GPIO_PIN_SET)
#define M_GPIO_PIN_RESET(id) (GPIO_InvertedLevels[id] ? GPIO_PIN_SET : GPIO_PIN_RESET)
/*
* Perform configuration of IO pins.
*/
void GPIO::init()
{
for (int id = 0; id < 4; id++)
{
if (GPIO::get(static_cast<GPIO_ID>(id)))
{
if (GPIO_InvertedLevels[id] != 1)
{
GPIO_InvertedLevels[id] = 1;
}
}
}
}
/*
* Sets a pin high.
*/
void GPIO::set(GPIO_ID id)
{
switch (id)
{
case GPIO::VSYNC_FREQ:
#if defined(VSYNC_FREQ_GPIO_Port) && defined(VSYNC_FREQ_Pin)
HAL_GPIO_WritePin(VSYNC_FREQ_GPIO_Port, VSYNC_FREQ_Pin, M_GPIO_PIN_SET(id));
#endif
break;
case GPIO::RENDER_TIME:
#if defined(RENDER_TIME_GPIO_Port) && defined(RENDER_TIME_Pin)
HAL_GPIO_WritePin(RENDER_TIME_GPIO_Port, RENDER_TIME_Pin, M_GPIO_PIN_SET(id));
#endif
break;
case GPIO::FRAME_RATE:
#if defined(FRAME_RATE_Port) && defined(FRAME_RATE_Pin)
HAL_GPIO_WritePin(FRAME_RATE_Port, FRAME_RATE_Pin, M_GPIO_PIN_SET(id));
#endif
break;
case GPIO::MCU_ACTIVE:
#if defined(MCU_ACTIVE_GPIO_Port) && defined(MCU_ACTIVE_Pin)
HAL_GPIO_WritePin(MCU_ACTIVE_GPIO_Port, MCU_ACTIVE_Pin, M_GPIO_PIN_SET(id));
#endif
break;
}
}
/*
* Sets a pin low.
*/
void GPIO::clear(GPIO_ID id)
{
switch (id)
{
case GPIO::VSYNC_FREQ:
#if defined(VSYNC_FREQ_GPIO_Port) && defined(VSYNC_FREQ_Pin)
HAL_GPIO_WritePin(VSYNC_FREQ_GPIO_Port, VSYNC_FREQ_Pin, M_GPIO_PIN_RESET(id));
#endif
break;
case GPIO::RENDER_TIME:
#if defined(RENDER_TIME_GPIO_Port) && defined(RENDER_TIME_Pin)
HAL_GPIO_WritePin(RENDER_TIME_GPIO_Port, RENDER_TIME_Pin, M_GPIO_PIN_RESET(id));
#endif
break;
case GPIO::FRAME_RATE:
#if defined(FRAME_RATE_Port) && defined(FRAME_RATE_Pin)
HAL_GPIO_WritePin(FRAME_RATE_Port, FRAME_RATE_Pin, M_GPIO_PIN_RESET(id));
#endif
break;
case GPIO::MCU_ACTIVE:
#if defined(MCU_ACTIVE_GPIO_Port) && defined(MCU_ACTIVE_Pin)
HAL_GPIO_WritePin(MCU_ACTIVE_GPIO_Port, MCU_ACTIVE_Pin, M_GPIO_PIN_RESET(id));
#endif
break;
}
}
/*
* Toggles a pin.
*/
void GPIO::toggle(GPIO_ID id)
{
switch (id)
{
case GPIO::VSYNC_FREQ:
#if defined(VSYNC_FREQ_GPIO_Port) && defined(VSYNC_FREQ_Pin)
HAL_GPIO_TogglePin(VSYNC_FREQ_GPIO_Port, VSYNC_FREQ_Pin);
#endif
break;
case GPIO::RENDER_TIME:
#if defined(RENDER_TIME_GPIO_Port) && defined(RENDER_TIME_Pin)
HAL_GPIO_TogglePin(RENDER_TIME_GPIO_Port, RENDER_TIME_Pin);
#endif
break;
case GPIO::FRAME_RATE:
#if defined(FRAME_RATE_Port) && defined(FRAME_RATE_Pin)
HAL_GPIO_TogglePin(FRAME_RATE_Port, FRAME_RATE_Pin);
#endif
break;
case GPIO::MCU_ACTIVE:
#if defined(MCU_ACTIVE_GPIO_Port) && defined(MCU_ACTIVE_Pin)
HAL_GPIO_TogglePin(MCU_ACTIVE_GPIO_Port, MCU_ACTIVE_Pin);
#endif
break;
}
}
/*
* Gets the state of a pin.
*/
bool GPIO::get(GPIO_ID id)
{
GPIO_PinState bitstatus = GPIO_PIN_RESET;
switch (id)
{
case GPIO::VSYNC_FREQ:
#if defined(VSYNC_FREQ_GPIO_Port) && defined(VSYNC_FREQ_Pin)
bitstatus = HAL_GPIO_ReadPin(VSYNC_FREQ_GPIO_Port, VSYNC_FREQ_Pin);
#endif
break;
case GPIO::RENDER_TIME:
#if defined(RENDER_TIME_GPIO_Port) && defined(RENDER_TIME_Pin)
bitstatus = HAL_GPIO_ReadPin(RENDER_TIME_GPIO_Port, RENDER_TIME_Pin);
#endif
break;
case GPIO::FRAME_RATE:
#if defined(FRAME_RATE_Port) && defined(FRAME_RATE_Pin)
bitstatus = HAL_GPIO_ReadPin(FRAME_RATE_Port, FRAME_RATE_Pin);
#endif
break;
case GPIO::MCU_ACTIVE:
#if defined(MCU_ACTIVE_GPIO_Port) && defined(MCU_ACTIVE_Pin)
bitstatus = HAL_GPIO_ReadPin(MCU_ACTIVE_GPIO_Port, MCU_ACTIVE_Pin);
#endif
break;
}
return (bitstatus == GPIO_PIN_SET);
}
2024-01-08 06:08 AM
Your custom board require custom BSP for your touch and lcd init...
And TouchGFXGPIO.cpp is irelevant here
Use STM32TouchController.cpp and as debug i mean your real display work before use touchgfx.
******************************************************************************
* File Name : STM32TouchController.cpp
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2023 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under Ultimate Liberty license
* SLA0044, the "License"; You may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* www.st.com/SLA0044
*
******************************************************************************
*/
/* USER CODE BEGIN STM32TouchController */
#include <STM32TouchController.hpp>
void STM32TouchController::init()
{
/**
* Initialize touch controller and driver
*
*/
}
bool STM32TouchController::sampleTouch(int32_t& x, int32_t& y)
{
/**
* By default sampleTouch returns false,
* return true if a touch has been detected, otherwise false.
*
* Coordinates are passed to the caller by reference by x and y.
*
* This function is called by the TouchGFX framework.
* By default sampleTouch is called every tick, this can be adjusted by HAL::setTouchSampleRate(int8_t);
*
*/
return false;
}
Here is empty generated code...
2024-01-08 09:25 PM
Your custom board require custom BSP for your touch and lcd init...could you please explain How to customize BSP...
Already made the required changes to file STM32TouchController.cpp & stm32h745i_touchcontroller.cpp file attached.
Already mentioned in my first query that the real display is working fine can display text blocks, box, analog meter. display is working fine its totally in my control. Having trouble with touch integration only.
Is it possible to connect via call for better understanding...
2024-01-08 09:51 PM
can we connect to this person...
the solution is very similar...he might help us.