cancel
Showing results for 
Search instead for 
Did you mean: 

Ddrawing line with partial frame strategy on STM32F0 based on STM32G0 eval board

PIRRI.1
Associate II

I'm using STM32f030cc MCU connected to an SD card and TFT Display 320x240 through SPI interface on a specific board. The SPi1 is used. it's the same configuration as the STM32G081 eval board and the partial frame buffer strategy is based on the STM32G0 software ( partialframebuffer_G0 project example)

The SPI DMA method is implemented on the sotware.

Touchgfx is used to draw on the TFT SPI display. Only 50 line can be drawn on the TFT.

if more are drawn, the software crashed and go into hardfault handler.

Does the touchgfx software contain a limitation to 50 lines ?

Can you explain to me why there is such limitation and how to do for drawing 240 lineson TFT display over touchgfx ?

Thanks for you quick answer

Best regards

Philippe IRRIEN

27 REPLIES 27
Alexandre RENOUX
Principal

Hello,

Did you find that the G0-EVAL had such limitation ?

What do you mean by "Only 50 lines can be drawn on the TFT" ? Are you talking about the size of the partial framebuffer ?

/Alexandre

PIRRI.1
Associate II

Hello,

I've only adapted the software on my own STM32F0 platform.

So, I can't tell th G0-EVAL has such limitation because i don't have this eval board to test that.

The configuration in the boardConfiguration.cpp file is :

static STM32F0TouchController stm32Touch;

static NoDMA dma;

static LCD16bpp TFTDisplay;

static ApplicationFontProvider fontProvider;

static Texts texts;

static TouchGFXHAL hal(dma, TFTDisplay, stm32Touch, 320, 240 );

ManyBlockAllocator<640, 4, 2> frameBufferAllocator;

With this configuration, the software crashed on the blitCopyAlphaPerPixel(...) function and only 50 lines are drawing on the SPI TFT display

if i declare 'static TouchGFXHAL hal(dma, TFTDisplay, stm32Touch, 320, 50 );', the software don't crashed and 50 lines are drawing on the SPI TFT display

Does the touchgfx software has a particular mechanism to draw only 50 lines?

Why the touchGFXHAL dont take the configuration of 240 lines ?

Best regards

Philippe

Korry
Associate III

If you use RTOS,maybe you should try to ​increase the task stack.

MM..1
Chief II

Your code seems have any error.

Read https://support.touchgfx.com/docs/development/ui-development/scenarios/lowering-memory-usage-with-partial-framebuffer/

Creating a frame buffer allocator as a global variable:

BoardConfiguration.cpp

Copy

//2 or more blocks of 10*390 pixels, one pixel is 3 bytes

ManyBlockAllocator<10*390*3, 2, 3> frameBufferAllocator;

This frame buffer allocator allocates 2 blocks of each 10 x 390 x 3 bytes = 11.700 bytes.

Configure HAL to use it:

BoardConfiguration.cpp

Copy

void touchgfx_init()

{

HAL& hal = touchgfx_generic_init(dma, display, tc, GUI_DISPLAY_WIDTH,

GUI_DISPLAY_HEIGHT, 0, 0, 0);

hal.setFrameBufferStartAddress((uint16_t*)0, GUI_DISPLAY_BPP, false, false);

hal.setFrameBufferAllocator(&frameBufferAllocator);

hal.setFrameRefreshStrategy(HAL::REFRESH_STRATEGY_PARTIAL_FRAMEBUFFER);

...

With this configuration TouchGFX will allocate small frame buffers and draw the UI in them. What is left now, is to transfer the small frame buffers to the display.

PIRRI.1
Associate II

Dear Korry,

freeRTOS V9.0.0 in is implemented on the software with five task declared.

Each task has a size of 128 x 4 bytes except the display task which has size of 28x128x 4bytes.

the ucHeap size (  configTOTAL_HEAP_SIZE) is configure to 33xx128*4 = 16896bytes.

With this configuration, 152 lines be drawing in the display.

Modifiy the heap size and the task size not allowed to drawn more than 152 lines now.

Did you have another idea to resolve this problem?

thanks for you reply

Philippe

PIRRI.1
Associate II

Dear Korry,,

i have made a mistake on my last reply.

The display stack size is 20x128x4 bytes.

With this siie,if i declare 'static TouchGFXHAL hal(dma, TFTDisplay, stm32Touch, 320, 150 );

All the 150 are drawing on the display. if more than line is declared ( > 150 ), the software crashed and go to hardfault handler.

Did you have another idea to resolve this problem?

thanks for you reply

Philippe

MM..1
Chief II

Why you use only ManyBlockAllocator<640, 4, 2> frameBufferAllocator; one line block buffer?? I mean partial buffering is designed for block mean rectangles...

PIRRI.1
Associate II

I use this to minimize the size take by the framebuffer in the RAM area which i s 32K.

What do you preconize in my case ?

if i change the ManyAllocator parameter to draw rectangle it's possible that resolve my problem ?

thanks for you reply

Dear Philippe

It works, doesn't it?

And being able to go from 50 lines to 150 lines, proves that this works.Now you may need to design your board's memory usage in more detail to give GUI tasks a larger task stack to complete drawing.

Korry