2020-10-10 03:05 AM
Dear TouchGFX Team,
first of all, thank you for providing a great tool for top notch graphics. I'm happy to play with it, and learning about gfx basics from your resources was definitely most valuable input for me.
Since I don't have any demo boards at my disposal, I decided to play with some items I already have: an STM32F411RE based Nucleo and SPI ILI9341 based LCD. The problem number one in this project is a RAM size: a full 320x240 ILI9341 compatible framebuffer requires cca 150 kB, while STM32F411RE has 128kB. But for the sake of learning, I decided to go with it, and split the screen area in half. That means, I configure my LCD to 160x240 resolution, which in RGB565 requires only 75 kB framebuffer. My ili9341 library didn't have any problems with it and all the test functions worked, displaying images at half the screen only. So far so good.
But then, when I decided to integrate TouchGFX into my basic projects, it started behaving funny. Here's what I did:
But, the image is a bit weird. First, the button, that is supposed to be centerd is offset, and duplicated. Is there something in TouchGFX that would make such an image detoriation?
Best regarsd,
Pero
2020-10-12 05:41 PM
Hello,
For your case, I highly recommend to use the partial framebuffer feature (https://support.touchgfx.com/docs/development/scenarios/lowering-memory-usage-with-partial-framebuffer). This will allow you to have a full screen instead of trying to apply some graphics to only half of the screen.
For this you can refer to the documention website, link above, as well as the G0-NUCLEO Application Template available in TouchGFX Designer 4.15.0.
This project uses SPI display along with SPI external Flash and uses the partial framebuffer feature because the internal RAM is too small for an entire FB.
/Alexandre
2020-10-13 02:22 AM
Hello Alexandre, thanks for the help, I really appreciate the advice. I'm going to study the topic and implement it for sure.
But before that, I want to get a better grip on how TouchGFX works, and how to adapt existing examples onto the custom board, in this case half the screen :). Do you, as a person familiar with internals of TouchGFX, have an idea why would the image look so funny in the end (a button of center, and duplicated)?
2020-10-13 10:16 PM
Could you provide some images of the simulator and what you see on your actual display to have a better understanding ?
/Alexandre
2020-10-14 06:37 AM
Of course, Here is both the screenshot from TGFXDesigner and photo of my actual screen .
Thanks for your interest in helping me, Alexandre!
2020-10-14 10:15 PM
It seems your UI in Designer is different from what you are trying to display. What I mean by this is that the orientation as well as the size in pixels of your canvas look wrong.
What is the setting in the Designer width x height for your UI ? And then what is the dimension of the the half screen ?
The orientation of your "half screen" needs to match the one on your display as well.
Anyway, I will repeat myself but you need to implement partial framebuffer. Doing this won't lead you anywhere (from my point of view).
/Alexandre
2020-10-15 10:22 AM
I'm sure you're right, and I will go play with the partial framebuffer. But before that, I need to learn what's going on with the current setup. So you'd say that issue is in UI settings, not in the wrong usage of touchGFX HAL?
Thanks for the help!
2020-10-16 01:57 AM
If the UI settings are wrong it will also impact how the TouchGFX HAL behaves. I don't know your code so I cannot really state something and only guess.
/Alexandre
2020-10-16 10:07 AM
Hello Alexandre,
I think it might have been it. I modified orientation in the TGX designer from "landscape" to "portrait" and it did the job properly. However, I also needed to mofify @Martin KJELDSEN's original copyFrameBufferBlockToLCD function from the Documentation to this:
void TouchGFXHAL::copyFrameBufferBlockToLCD(const touchgfx::Rect rect)
{
__IO uint16_t* ptr;
int16_t height;
// Use default implementation (CPU copy!).
// This can be accelerated using regular DMA hardware
for (height = 0; height < rect.height ; height++)
{
//ptr = getClientFrameBuffer() + rect.x + (height + rect.y) * BSP_LCD_GetXSize();
ptr = getClientFrameBuffer() + rect.x + (height + rect.y)*(rect.width);
LCD_IO_WriteMultipleData((uint8_t*)ptr, rect.width+1);
}
}
I think the reason for bad rendering was the wrong size of the framebuffer part I was feeding into the SPI DMA. Since the SPI only works with data lengths of 8 bits, while the framebuffer has 16-bit data points, I need to send twice the amount of pixels needed for single line. This "+1" at line 12 makes sure all of it sent, so that skew is avoided. Sweet.
However, another topic that might be for you, Alex. Check the video in the attachment (mp4 file in zip), please. When I press the button there is a glitch, when colors get completely messed up in the button area. This is when image of "pressed button" should appear according to the TGFX Designer. I don't think it has anything to do with my setup, but might be the actual HAL issue. What do you think?
Best regards,
Pero
2020-11-21 10:10 AM
Hello @Alexandre RENOUX , could you please look into it? I am really curious about what could be the source of the glitch...