cancel
Showing results for 
Search instead for 
Did you mean: 

White boxes when using Fonts from External Flash

JGoew.1
Associate II

This is a project that I just updated from TouchGFX 4.5 to 4.19.

I've been working to update a project to use external flash fonts instead of internal which was the reason from upgrading from 4.5 to 4.19.

I'm stuck at a point where the font gets loaded. It appears that the glyphNode buffer is getting filled correctly as the width, height, left, kerning, etc from the datareader->copydata

But it appears that the font itself might not be getting loaded as getBitsPerPixel is returning unexpected values like 0x79, when I know that my font has a BPP of 2. Which makes me think that the actual bitmap of the glyph might not be getting loaded.

All the other image graphics and drawings we use are working fine.

Code from TouchGFX/UnmappedDataFont.cpp
 
const GlyphNode* UnmappedDataFont::getGlyph(Unicode::UnicodeChar unicode, const uint8_t*& pixelData, uint8_t& bitsPerPixel) const
{
    int index = lookupUnicode(unicode);
 
    if (index != -1)
    {
        // Read glyphNode from unmapped flash
        touchgfx::FlashDataReader* const flashReader = ApplicationFontProvider::getFlashReader();
        flashReader->copyData(glyphList + index, &glyphNodeBuffer, sizeof(GlyphNode));
 
        pixelData = getPixelData(const_cast<const GlyphNode*>(&glyphNodeBuffer));
        bitsPerPixel = getBitsPerPixel();
        return &glyphNodeBuffer;
    }
    return 0;
}

Example:

Internal --> External

0693W00000SvTbvQAF.png 

Any ideas

8 REPLIES 8
MM..1
Chief II

Why you dont use memory mapped mode ?

JGoew.1
Associate II

The STM32F429I that we use for the display doesn't have QSPI, so I thought that wasn't possible.

Followed this for setting up the normal SPI:

https://support.touchgfx.com/4.20/docs/development/scenarios/fonts-in-unmapped-flash

Then you need debug or implement custom ApplicationFontProvider::getFlashReader

Thanks. I figured that since I was posting and stated that the data is getting pulled through my datareader that I wrote and that the problem is that it is like TouchGFX just throws away that data when exiting out of GetGlyph, it was understood that I have implemented getFlashReader and have been debugging it.

I wish TouchGFX still provided full source like when we were originally paying for it instead of this precompiled library.

Correct, it's not possible on the STM32F429I, but that wasn't originally stated.

You'd still need to ensure that the content you want to get into the external memory actually gets there, and you're not seeing white because all the bytes are 0xFF

View, or CRC, the external memory content to ensure it matches the PC generated content.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Yes doc have simple info on last lines

Remember to implement the functions in TouchGFXDataReader so data is actually read from your flash.

relevant to

Using Serial Flash for images and fonts | TouchGFX Documentation

Ok, so does that mean I need to rewrite TouchGFX's function in UnmappedDataFont.cpp?

const GlyphNode* UnmappedDataFont::getGlyph(Unicode::UnicodeChar unicode, const uint8_t*& pixelData, uint8_t& bitsPerPixel) const
{
    int index = lookupUnicode(unicode);
 
    if (index != -1)
    {
        // Read glyphNode from unmapped flash
        touchgfx::FlashDataReader* const flashReader = ApplicationFontProvider::getFlashReader();
        flashReader->copyData(glyphList + index, &glyphNodeBuffer, sizeof(GlyphNode));
        const touchgfx::GlyphNode* test = (const GlyphNode*)(&glyphNodeBuffer);
        pixelData = getPixelData(test);
        bitsPerPixel = getBitsPerPixel();
        return &glyphNodeBuffer;
    }
    return 0;
}
 
const uint8_t* UnmappedDataFont::getPixelData(const GlyphNode* glyph) const
{
    const uint8_t* const* table = (const uint8_t* const*)glyphDataList;
    return &(table[glyph->unicode / 2048][glyph->dataOffset]);
}

After I have read the info that is requested when it calls flashReader->copyData() and returned it, the glyphNodeBuffer contains that data with the size, kerning, unicode, etc... But then Touchgfx calls their getPixelData function and that doesn't seem to go out to the External Flash. Their documentation for calling unmapped memory doesn't include anything about it.

0x60000000 is our external flash. Their function isn't calling CopyData again to go out and get this data from the unmapped flash it just is like "There is where the data is." Which seems to be the whole point for what this function should be doing. So, pixel data is basically working to get the font table copied from unmapped to mapped, but then is ignoring the point that the pixel data is out in unmapped as well.

0693W00000UFR9yQAH.png