Skip to main content
IHei?
Visitor II
Oct 14, 2021 12:28 PM UTC
Solved

TouchGFX - SPI - PartialBuffer: Can I set the Position/Width/Height to a multiple of 2?

Hello,

I have a STM32F723 Application with TouchGFX (4.16.1) Graphics over SPI and a Display with RM69330 Controler (454x454x2Bpp).

I use PartitialBuffer Configuration, because internal RAM is too small for whole Framebuffer. I've implemented the Transmit Function ("touchgfxDisplayDriverTransmitBlock( uint8_t* pixels, uint16_t x, uint16_t y, uint16_t w, uint16_t h)") where I set Position Rectangle in Display Controler and write Pixels to the Display. That works fine if x/y/w/h are a multiple of 2 otherwise it looks weired.

Problem is: In RM69330 DataSheet it says that Column and Row Startaddress and Width / Height "must can be divisible by 2".

Question: Is there any way to tell TouchGFX to only supply framebuffer parts with x/y/w/h as a multiple of 2? Or is there any other Known solution?

This topic has been closed for replies.
Alexandre RENOUX
Alexandre RENOUXBest answer
Visitor II
Oct 19, 2021 7:54 AM UTC

Hello IHei?,

This problem can happen and we discovered this is a common limitation for several SPI displays.

To fix it, you have to modify FrontendApplication.hpp and .cpp as below :

FrontendApplication.hpp

virtual void draw(Rect& rect);

FrontendApplication.cpp

void FrontendApplication::draw(Rect& rect)
{
 if (drawCacheEnabled)
 {
 Rect even(rect);
 //ensure start x is even number, or move left
 if (even.x&1)
 {
 even.x--;
 even.width++;
 }
 //ensure width is even number of pixels
 even.width = (even.width+1)&~0x01;
 
 //ensure start y is even number, or move up
 if (even.y&1)
 {
 even.y--;
 even.height++;
 }
 //ensure height is even number of pixels
 even.height = (even.height+1)&~0x01;
 
 Application::draw(even);
 }
 else
 {
 Application::draw(rect);
 }
}

You basically overwrite the draw function to ensure even numbers for the rectangle to draw.

When your question is answered, please close this topic by choosing Select as Best.

/Alexandre

2 replies

MM..1
Super User
Oct 14, 2021 3:29 PM UTC

Maybe you can in your transmit function extend x,y,w,h to multiple 2 with read data from display , but yes this is more overhead as send only.

Alexandre RENOUX
Alexandre RENOUXBest answer
Visitor II
Oct 19, 2021 7:54 AM UTC

Hello IHei?,

This problem can happen and we discovered this is a common limitation for several SPI displays.

To fix it, you have to modify FrontendApplication.hpp and .cpp as below :

FrontendApplication.hpp

virtual void draw(Rect& rect);

FrontendApplication.cpp

void FrontendApplication::draw(Rect& rect)
{
 if (drawCacheEnabled)
 {
 Rect even(rect);
 //ensure start x is even number, or move left
 if (even.x&1)
 {
 even.x--;
 even.width++;
 }
 //ensure width is even number of pixels
 even.width = (even.width+1)&~0x01;
 
 //ensure start y is even number, or move up
 if (even.y&1)
 {
 even.y--;
 even.height++;
 }
 //ensure height is even number of pixels
 even.height = (even.height+1)&~0x01;
 
 Application::draw(even);
 }
 else
 {
 Application::draw(rect);
 }
}

You basically overwrite the draw function to ensure even numbers for the rectangle to draw.

When your question is answered, please close this topic by choosing Select as Best.

/Alexandre