Skip to main content
Fchen.1864
Associate II
November 30, 2019
Question

Installing the binary font at the external SDRAM on the STM32F429BI board will Cause program crash.

  • November 30, 2019
  • 5 replies
  • 3001 views

Here are my programs:

const int FontCacheSize = 10000;

uint8_t fontdata[FontCacheSize] __attribute__((at(0XC0E00000))) __attribute__ ((aligned(4)));

FrontendApplication::FrontendApplication(Model& m, FrontendHeap& heap)

   : FrontendApplicationBase(m, heap)

{

​

 FIL fil;      /* File object */

 FRESULT fr;   /* FatFs return code */

 UINT br;

 fontCache.setMemory(fontdata, FontCacheSize);

 /* Open a text file */

 fr = f_open(&fil, "0:/Font_VINERITC_TTF_20_4bpp.bin", FA_READ|FA_WRITE|FA_OPEN_ALWAYS);

 if(fr == FR_OK)

 {

  fr = f_read(&fil, fontdata, FontCacheSize, &br);

  fr = f_close(&fil);

  

  new (&bf) BinaryFont((const struct touchgfx::BinaryFontData*)fontdata);

   TypedTextDatabase::setFont(Typography::DEFAULT, &bf);

 }

}

​

Sometimes it able to work. But , if I touch the screen the program will crash.

Most of the time,the program crash on the power on.

​

2�?I'm not sure what this filedatareader is. Who can give me an example. The chip is stm32f429bi, and the file system is FatFs.Thank you .

0690X00000At5P6QAJ.png

​

This topic has been closed for replies.

5 replies

Martin KJELDSEN
Principal III
December 2, 2019

Normally you'd use Binary Fonts because you have a typography that is incredibly large, and you cannot or won't place it in external flash memory, so you place it on an SD-Card. You then have to read this data from the SD-Card (Here's where the FileDataReader comes into play).

/Martin

Fchen.1864
Associate II
December 2, 2019

Hello​, Martin, Thank you for your answer. 

What you say is what I need.

I want to read ​the typography to SDRAM from the Sd-card. 

1.Can you give me a specific example for the FileDataReader. 

2. How about my first question?Do you know why?When I define the fontdata[FontCacheSize] in the internal RAM, it go good.

Fchen.1864
Associate II
December 2, 2019

1.I have an external sdram of 16MB.

2. I want trying to read glyphs into a cache( preferably define in Sdram) in the case where loading a complete binary font is not possible.(e.g. Chinese).

jguo.2
Associate
April 5, 2022

I have the same problem as you. Has this problem been solved ?