Showing results for 
Search instead for 
Did you mean: 

Changing to a different display

Associate II

Hi everyone,

I'm using the STM32F429 discovery board which comes with an LCD display. I tried out some example keil projects and also made some projects on TouchGFX software with hardware integration. All was working fine. I also have a different display(ST7282 display controller-does not require any initialization) of 480*272 resolution with me and wanted to interface that to the discovery board. But TouchGFX wont let me select a different resolution after selecting STM32F429. How do I add this new display? What all files I have to modify in the generated C project? I read the article on Changing to a different display. But it didn't help.

Can someone help me?

Chief III

Hi @arun_cheriyan​,

Are you using CubeMX to generate your project or the Application Templates from within the TouchGFX Designer?

Best regards,


Hi Martin,

I used the TouchGFX designer to generate the required project. I selected the STM32F429I discovery board option and then blank UI in the designer. Since I was using the 480*272 display I did some tinkering to the generated projects BoardConfiguration.cpp file to make the new display work( It had the configuration for 240*320 display). But the result was not good:


There should be two buttons displayed.

Here's what I did in the BoardConfiguration.cpp file:

1.adjusted the size related things

/* Configure horizontal synchronization width */

    LtdcHandler.Init.HorizontalSync = ((uint32_t)4);

    /* Configure vertical synchronization height */

    LtdcHandler.Init.VerticalSync = ((uint32_t)4);

    /* Configure accumulated horizontal back porch */

    LtdcHandler.Init.AccumulatedHBP = ((uint32_t)43);

    /* Configure accumulated vertical back porch */

    LtdcHandler.Init.AccumulatedVBP = ((uint32_t)12);

    /* Configure accumulated active width */

    LtdcHandler.Init.AccumulatedActiveW = 480;

    /* Configure accumulated active height */

    LtdcHandler.Init.AccumulatedActiveH = 272;

    /* Configure total width */

    LtdcHandler.Init.TotalWidth = 531;

    /* Configure total height */

    LtdcHandler.Init.TotalHeigh = 292;

2.commented the driver init function

/* LCD Init */


3.adjusted these functions

uint32_t LCD_GetXSize(void)


    //return LcdDrv->GetLcdPixelWidth();

return 480;


  uint32_t LCD_GetYSize(void)


    //return LcdDrv->GetLcdPixelHeight();

return 272;


void touchgfx_init()


  HAL& hal = touchgfx_generic_init<STM32F4HAL>(dma, display, tc, 480, 272, 0, 0);

  os_inited = true;






4.Edited the .touchgfx file in the project to :

"Resolution": {

   "Width": 480,

   "Height": 272


can you give any suggestions?

I have managed to make the display work. Now there is the touch controller to setup. This new display uses the GT911 capacitive touch controller. The project generated by TouchGFX uses the resistive touch controller. What all changes do i have to make to the current project to switch to the new touch controller?

If my assumption is right I need to only change the definitions of these two functions:

virtual void init() ;

virtual bool sampleTouch();

Am I right?

But I was not able to find where the sampleTouch() function is being called from. I'm not very good in C++.

You can use F746 Discovery touch controller for example of programming fot touch

Hi @arun_cheriyan​ ,

Sorry for the late reply. Trying to catch up here. It's a good thing you @ me, since i will get an email and i can go through those.

For the Touch Controller you could just replace the contents of init() and sampleTouch() for the existing one and use the for GT911 driver instead.


In the past when changing displays I have just changed the resolution in the json of the .touchgfx file for my project in order to be able to retain screens and just go back in and resize things. It's a little annoying cause you have to find/replace your resolution in multiple places but this worked for me in TouchGFX v4.10.0.

Hi @Martin KJELDSEN​ 

Thank you for the advice.

I have managed to make the touch controller work as well.

It would have been nice if TouchGFX designer lets you choose desired resolutions. Will this feature be coming to TouchGFX designer anytime soon?

@Community member​ 

Thats exactly what I did. I had to edit the BoardConfiguration.cpp file too. anyways now its working .

What do you mean? Runtime change of resolutions? A resolution is often tied to a hardware configuration (Framebuffer, touch controller coordinates, etc) to match that resolution. And all your screen definitions would need to change.