Skip to main content
Associate
March 6, 2025
Question

getPixelData() Hardfault

  • March 6, 2025
  • 3 replies
  • 1299 views

I have a screen with only 1 line of text and I get a Hard Fault when I try to run it. I get the fault here at the glyph->dataOffset:


const uint8_t* GeneratedFont::getPixelData(const GlyphNode* glyph) const
{
const uint8_t* const* table = (const uint8_t* const*)glyphData;
return &(table[glyph->unicode / 2048][glyph->dataOffset]);
}

I have everything stored in internal flash and it is initialized before TouchGFX

3 replies

GaetanGodart
Technical Moderator
March 7, 2025

Hello @beezybee and welcome to the community!

 

Can you share your project?

Can you hare the stack call please?

Also, what hardware and software are you using?

 

Regards,

beezybeeAuthor
Associate
March 7, 2025

I cannot shar my entire project but if there is something specific I should be able to share that. I am using STM32U5A5 with TouchGFX Designer 4.24.1 and CubeMX 6.12.1. Here is my call stack


HardFault_Handler
<Exception frame>
touchgfx::GeneratedFont::getPixelData(touchgfx::GlyphNode const *) const
[??getGlyph_1 + 0xb]
touchgfx::Font::getGlyph(unsigned short) const
[??getNextLigature_0 + 0x23]
[??getStringWidthLTR_0 + 0xb]
touchgfx::Font::getStringWidth(unsigned char, unsigned short const *...) const
[??getTextWidth_5 + 0x1d]
[_ZN8touchgfx8TextArea19resizeToCurrentTextEv + 0x17]
[_ZN8touchgfx8TextArea12setTypedTextERKNS_9TypedTextE + 0x1d]
GasReadingHeadingBase::GasReadingHeadingBase()
GasReadingHeadingBase::subobject GasReadingHeadingBase()
GasReadingHeading::GasReadingHeading()
GasReading4ScreenViewBase::GasReading4ScreenViewBase()
GasReading4ScreenViewBase::subobject GasReading4ScreenViewBase()
GasReading4ScreenView::GasReading4ScreenView()
GasReading4ScreenPresenter * touchgfx::makeTransition<GasReading4ScreenView, GasReading4ScreenPresenter, touchgfx::NoTransition, Model>(touchgfx::Screen * *, touchgfx::Presenter * *, touchgfx::MVPHeap &, touchgfx::Transition * *, Model *)
FrontendApplicationBase::gotoGasReading4ScreenScreenNoTransitionImpl()
touchgfx::Callback<FrontendApplicationBase>::execute()
touchgfx::MVPApplication::evaluatePendingScreenTransition()
touchgfx::MVPApplication::handlePendingScreenTransition()
[??tick_2 + 0x9]
touchgfx::HAL::backPorchExited()
[??taskEntry_0 + 0xb]
touchgfx_taskEntry()
MX_TouchGFX_Process
HMI_thread_entry
_tx_thread_shell_entry
<Exception frame>
[PC = 0xefef'efef]

GaetanGodart
Technical Moderator
March 10, 2025

Hello @beezybee ,

 

Thank you for the stack call.

 

It seems the issue happens during a transition.
Can you try to remove the transition and still do the screen change and see if the issue still happens?

The stack call show issue at "GeneratedFont::getPixelData(touchgfx::GlyphNode const *) const" but you say the issue happens on line "return &(table[glyph->unicode / 2048][glyph->dataOffset]);" and specifically at "glyph->dataOffset", how do you know that?

If that is indeed accurate, perhaps the glyph do not have a dataOffset, what font are you using?
Can you try to use another font to see if the issue persist?

 

Regards,

beezybeeAuthor
Associate
March 10, 2025

I have removed the transition and changed the font but no luck. I have done some testing with dataOffset and it doesn't hardfault when I set it to 0 (also doesn't work) but when the value is greater it throws the hard fault. I have attached my TouchGFX project for your reference. 

beezybeeAuthor
Associate
March 10, 2025

Update, I have upgrade to TouchGFX 4.25.0 and CubeMX 6.14.0 and U5 FW package to 1.70 and I am no longer seeing the HardFault. But I am still having an issue with the display not being correct. I am still only seeing blocks of all white and all black. No text is display and framebuffer confirms this. When I print out the size of the rect I get 303 for width and 14 now for height. My display is 303x230.

GaetanGodart
Technical Moderator
March 11, 2025

Hello @beezybee ,

 

Can you share your .ioc file (STM32CubeMX)?

It looks like your board bring up is not working,

 

Regards,

beezybeeAuthor
Associate
March 11, 2025

Please see the attached file.