cancel
Showing results for 
Search instead for 
Did you mean: 

getPixelData() Hardfault

beezybee
Associate II

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

15 REPLIES 15

I see that you are using partial buffer, GRAM display.

I do not know your hardware.

Are you sure that you have embedded memory on your display?

Also, regarding the partial buffer strategy, it is what is causing the blocks of black and white.
You set the block size to be 9060, so 9060 / 303 (your width) = 29.xx and since you have RGB565 it is 2 bytes so you have 14.xx rounded down to 14, this is the height of the block.
I would guess your partial framebuffer strategy is not set correctly.
Look at this guide to learn more about partial framebuffer .
Look at this guide for general framebuffer strategy .

Perhaps you could consider starting with a single framebuffer strategy if you have enough memory for it.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Yes, I see that, but when I change the block size to say something like 69690, I would expect 115. But I am seeing only 20 in this case. 

Yes that is because by default the block size is set to 20 pixels of height.

You could try to set your block size to 2 * 20 * 303 but since you have full white or full black blocks previously, I would guess there is something more than just the block size not being correct.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

This is the correct place to set this:

// Block Allocator for Partial Framebuffer strategy
static ManyBlockAllocator<69690, /* block size */
2, /* number of blocks */
2 /* bytes per pixel */
> blockAllocator;

I switched to single buffer but now I am seeing an all black screen with framebuffer filled with all 0x00s. Here is my my function:

void TouchGFXHAL::flushFrameBuffer(const touchgfx::Rect& rect)
{
// Calling parent implementation of flushFrameBuffer(const touchgfx::Rect& rect).
//
// To overwrite the generated implementation, omit the call to the parent function
// and implement the needed functionality here.
// Please note, HAL::flushFrameBuffer(const touchgfx::Rect& rect) must
// be called to notify the touchgfx framework that flush has been performed.
// To calculate the start address of rect,
// use advanceFrameBufferToRect(uint8_t* fbPtr, const touchgfx::Rect& rect)
// defined in TouchGFXGeneratedHAL.cpp

uint8_t* framebuffer = (uint8_t*)lockFrameBuffer();
framebuffer = framebuffer + (rect.y * 303 + rect.x) * 2;


touchgfxDisplayDriverTransmitBlock((uint8_t*)framebuffer, rect.x, rect.y, rect.width, rect.height);

unlockFrameBuffer();

TouchGFXGeneratedHAL::flushFrameBuffer(rect);
}

Hello @beezybee ,

 

When adding code, you can use the specific button for it so it gets formatted correctly :

GaetanGodart_0-1741774194575.png

 

It looks like your data is not sent correctly to the framebuffer.
Do you use SPI?
Please find the different scenarios to send data to the framebuffer .

Also, since you changed to single framebuffer, did you set the framebuffer location by address or by allocation? It is recommended to set it by allocation.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)