How to configure a custom size with ILI9341 LCD ?
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:
- Created new project in STM32CubeIDE, based on my previously tested .ioc file, so that SPI interface with ILI9341 will work fine.
- In CubeMX, I've set Software packs to TouchGFX v4.14, where I set 160x240 resolution, with custom interface and RGB565 pixel format.
- Upon code generation, I opened Aplication Template.touchgfx.part in TouchGFX Designer, and made a very basic screen with a circular shaped button. When the button is pressed, the background color is changed, that's it. Very simple.
- Tested it out in simulator (worked fine), and exported the code into CubeIDE Project.
- Modified functions TouchGFXHAL::flushFrameBuffer and TouchGFXHAL::copyFrameBufferBlockToLCD in TouchGFXHAL.cpp according to your documentation. I have actually used the same code the guy from this thread has been using. The only thing I have changed it the GUI WIDTH to 160 in ili9341.h
- The code builds and flashes succesfully, and I get an image on the screen. Yeah!
- (I didnt mention until now, but I have implemented the touchscreen as well, and it worked - upon button press, the background indeed changes.)
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