Skip to main content
NK_it
Associate III
September 6, 2021
Question

TouchGFX application is running on simulator but failed when it runs on discovery board.

  • September 6, 2021
  • 1 reply
  • 1838 views

As per the tutorial 5: https://support.touchgfx.com/docs/tutorials/tutorial-05, I have implemented a custom trigger as per part 1. Its work perfectly on simulator but it did not run on discovery board.

When I debug this application, control went to buttonCallback handler but never hit to setBackGroundColor function.

Please let me know what I am missing.

void Screen1ViewBase::setBackGroundColor(colortype value)

{

  //Interaction1

  //When setBackGroundColor is called execute C++ code

  //Execute C++ code

  backGround.setColor(value);

  backGround.invalidate();

void Screen1ViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)

{

  if (&src == &button)

  {

    //Interaction2

    //When button clicked call setBackGroundColor on Screen1

    //Call setBackGroundColor

    setBackGroundColor(touchgfx::Color::getColorFrom24BitRGB(rand()%256, rand()%256, rand()%256));

  }

}

This topic has been closed for replies.

1 reply

Romain DIELEMAN
ST Employee
September 6, 2021

Hi,

Are you working with a custom board or from a TouchGFX Board Setup for one of ST's development kits ? What is the color depth ? Maybe also try this function instead

touchgfx::Color::getColorFromRGB(rand()%256, rand()%256, rand()%256)

I tried the tutorial with the STM32H7B3-dk and it works fine. There is nothing wrong with the piece of code you shared. Could you share your project so that I can have a look at the settings within Designer ?

/Romain

Romain DIELEMAN
ST Employee
September 6, 2021

I tried on both a 24bpp board (the STM32H7B3-dk board), where it works, and a 16bpp board (STM32F429-dk) where it does not work. It seems like the rand is the issue.

/Romain

NK_it
NK_itAuthor
Associate III
September 6, 2021

I am working on 16bpp board(STM32H747-Disco), So I will try getColorFromRGB instead of getColorFrom24BitRGB.

Thank you for your support!