cancel
Showing results for 
Search instead for 
Did you mean: 

Replace a Display

Sanjay27
Associate II

Hi, I’m working with an STM32H7S78-DK board and I want to replace the current display with a new one that has a resolution of 480x272. I’d like to know if this is possible, and if so, what steps or considerations I need to follow to make it work properly. Any guidance on configuring the MCU, adjusting the display driver, or handling any hardware/software changes would be really helpful. Thanks!

9 REPLIES 9
Osman SOYKURT
ST Employee

Hello @Sanjay27 ,

I can suggest to look at our documentation where we explain how to setup a display.

Osman SOYKURT
ST Software Developer | TouchGFX
Osman SOYKURT
ST Employee

Hello @Sanjay27 , any progress on configuring your screen?

Osman SOYKURT
ST Software Developer | TouchGFX

I Configured the Display, but TouchGFX isn't working correctly. The button touches aren't registering properly; they react continuously even before I release them.

Osman SOYKURT
ST Employee

Hello @Sanjay27 ,

Could you check you I2C1 config? Because the sampleTouch function reads touch status from it (at least from our TBS)?You can read more about that in our documentation.

Osman SOYKURT
ST Software Developer | TouchGFX

Hello @Osman SOYKURT 
The Buttons are Reacts before release, see the Pictures and attached video files

Sanjay27_3-1765802141375.pngSanjay27_4-1765802161385.pngSanjay27_5-1765802179527.png

 

 

 

 

Osman SOYKURT
ST Employee

Could you show us your STM32TouchController.cpp file ?

Osman SOYKURT
ST Software Developer | TouchGFX

Sure,

/* USER CODE BEGIN Header */

/**

******************************************************************************

* File Name : STM32TouchController.cpp

******************************************************************************

* This file was created by TouchGFX Generator 4.26.0. This file is only

* generated once! Delete this file from your project and re-generate code

* using STM32CubeMX or change this file manually to update it.

******************************************************************************

* @attention

*

* Copyright (c) 2025 STMicroelectronics.

* All rights reserved.

*

* This software is licensed under terms that can be found in the LICENSE file

* in the root directory of this software component.

* If no LICENSE file comes with this software, it is provided AS-IS.

*

******************************************************************************

*/

/* USER CODE END Header */



/* USER CODE BEGIN STM32TouchController */

#include <touchgfx/hal/HAL.hpp>

#include <touchgfx/hal/Types.hpp>

#include <STM32TouchController.hpp>

#include "main.h"



volatile bool doSampleTouch = false;



extern "C" I2C_HandleTypeDef hi2c1;



using namespace touchgfx;

extern "C"

{

void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)

{

if (GPIO_Pin == TP_IRQ_Pin)

{

/* Communication with TS is done via I2C.

Often the sw requires ISRs (interrupt service routines) to be quick while communication

with I2C can be considered relatively long (depending on SW requirements).

Considering that the TS feature don't need immediate reaction,

it is suggested to use polling mode instead of EXTI mode,

in order to avoid blocking I2C communication on interrupt service routines */



/* Here an example of implementation is proposed which is a mix between pooling and exit mode:

On ISR a flag is set (exti5_received), the main loop polls on the flag rather then polling the TS;

Mcu communicates with TS only when the flag has been set by ISR. This is just an example:

the users should choose they strategy depending on their application needs.*/



doSampleTouch = true;

return;

}

}

}



void STM32TouchController::init()

{

/**

* Initialize touch controller and driver

*

*/

}



bool STM32TouchController::sampleTouch(int32_t& x, int32_t& y)

{

uint8_t touches = 0;

uint8_t buf[6];

const uint16_t STATUS_REG = 0x814E;

const uint16_t TOUCH_POS_REG = 0x8150;

uint8_t ZERO = 0;



NVIC_DisableIRQ(TP_IRQ_EXTI_IRQn);

if (doSampleTouch)

{

HAL_I2C_Mem_Read(&hi2c1, 0xBA, STATUS_REG, 2, buf, 1, HAL_MAX_DELAY);

touches = (0x0F & buf[0]);



HAL_I2C_Mem_Write(&hi2c1, 0xBA, STATUS_REG, 2, &ZERO, 1, HAL_MAX_DELAY);



doSampleTouch = false;



if (touches > 0)

{

HAL_I2C_Mem_Read(&hi2c1, 0xBA, TOUCH_POS_REG, 2, buf, 4, HAL_MAX_DELAY);

x = buf[0] + (buf[1] << 8);

y = buf[2] + (buf[3] << 8);

}

}

NVIC_EnableIRQ(TP_IRQ_EXTI_IRQn);



return (touches > 0);

}



/* USER CODE END STM32TouchController */



/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

Osman SOYKURT
ST Employee

Ok, could you now check your TP_IRQ_Pin configuration on STM32CubeMX ?

OsmanSOYKURT_0-1766050205186.png

 

You can also check you i2c configuration (I would suggest to make it similar to our current) :

OsmanSOYKURT_1-1766050308069.png

OsmanSOYKURT_2-1766050464307.png

OsmanSOYKURT_3-1766050488358.png

 

 

 

Osman SOYKURT
ST Software Developer | TouchGFX

My Configurations Still not working well

Sanjay27_0-1766055286902.pngSanjay27_1-1766055307692.pngSanjay27_2-1766055323518.png

Sanjay27_3-1766055354224.png