Skip to main content
Senior III
February 27, 2026
Solved

LCD16DebugPrinter not displaying anything on RGB565 480x480 display (STM32U5)

I'm trying to use LCD16DebugPrinter to display debug text on a 480x480 RGB565 display running on STM32U5A9J-DK (circular display). I've set it up in TouchGFXHAL::initialize():

static touchgfx::LCD16DebugPrinter debugPrinter;
debugPrinter.setPosition(0, HAL::DISPLAY_HEIGHT - 20, HAL::DISPLAY_WIDTH, 20);
debugPrinter.setColor(touchgfx::Color::getColorFromRGB(0, 0, 0));
debugPrinter.setScale(1);
touchgfx::Application::setDebugPrinter(&debugPrinter);

And in my view's handleTickEvent():

static char debugStr[128];
snprintf(debugStr, sizeof(debugStr), "TICK TEST");
touchgfx::Application::setDebugString(debugStr);

Nothing appears on screen. Things I've already ruled out:

  • String buffer lifetime - using static char[] So the pointer remains valid
  • Color contrast - white background, black text
  • Widget conflict - disabled all custom widgets, issue persists

How it is supposed to work?

nico23Best answer
Senior III
March 2, 2026

Thanks, also the issue seems to be adding the code to TouchGFXHAL::initialize() doesn't make it work.

Instead, following the documentation and adding it to FrontendApplication made it work. Thanks

2 replies

MBrau.7
Associate II
March 2, 2026

You need to call  the following function after every change of the debug string content.

touchgfx::Application::invalidateDebugRegion();

 

nico23AuthorBest answer
Senior III
March 2, 2026

Thanks, also the issue seems to be adding the code to TouchGFXHAL::initialize() doesn't make it work.

Instead, following the documentation and adding it to FrontendApplication made it work. Thanks