cancel
Showing results for 
Search instead for 
Did you mean: 

Getting started with TouchGFX and bringing up a board

BWKidd
Associate II

Hi All,

I'm trying to get started with TouchGFX.

I'm currently working with a NUCLEO-L496ZG eval board connected to an NHD-2.8-240320AF-CSXP-FT (320 x 240 TFT LCD with ST7789 internal controller.)

I've successfully connected up the display via FMC and been able to display colors and images and such to the screen, just using statements like 

*(__IO uint16_t *)(0x60000000) = command;

*(__IO uint16_t *)(0x60020000) = data;

to send data to the command and data registers, and everything seems to be working well.

Now I'm trying to bring in TouchGFX into the mix and I'm having a difficult time. I've read through the board bring up process, and where I think I'm having trouble is knowing which functions to modify from the generated code to integrate the ST7789 driver code I've written.

To give you an idea of what I've tried and what my setup is, here's what my TouchGFX setup looks like in the IOC:

BWKidd_0-1709759336646.png

After generating the code, I used TouchGFX designer and opened the ApplicationTemplate.touchgfx.part file and then added a simple splash bitmap to the default screen:

BWKidd_1-1709759709814.png

(I know, I could quit being an electrical engineer and draw pictures in paint for a living, right?)

I then generated code, went back to STM32CubeIDE re built with no errors.

On first debug session, nothing happened on the LCD, which makes sense since I hadn't modified any of the generated code. Based on the example here FMC and SPI Display Interface | TouchGFX Documentation I realized I was probably supposed to modify flushFrameBuffer in the TouchGFXHAL.cpp file, so I did so like this:

void TouchGFXHAL::flushFrameBuffer(const touchgfx::Rect& rect)

{

// Set Cursor

TFT_setAddress_WidthHeight(rect.x, rect.y, rect.width, rect.height);

TFT_flushFrameBuffer(frameBuffer0);

}

That didn't make any difference, and I noticed that setting a breakpoint within this function, the flushFrameBuffer function doesn't seemed to get called anyways, and it was at this point that I realized there is too much I don't know/ don't understand. I don't even know of "frameBuffer0" points to the frame buffer I created in the TouchGFX part of the IOC file. According to a note in there, the framebuffer is supposed to be called "framebuf" but the compiler doesn't recognize that.

I realize that I'm missing a big chunk of knowledge here, so please forgive my ignorance. Could someone point me in the right direction?

11 REPLIES 11

@MM..1 

Thanks, that makes sense, but I'm not sure how and when to trigger a vsync. Should I setup a hardware timer and call HAL::getInstance()->vSync() inside a hardware timer ISR?

GaetanGodart
ST Employee

Hello @BWKidd ,

 

The flashFrameBuffer is used when a certain area of the screen has to be redrawn (basicaly when you invalidate something, change to a different screen, run an animation, etc).

What you should care about is that TouchGFX send a endFrame callback when it is done updating the whole screen. After that you are ready to update a new frame so you should send a vsync signal (do not use a timer for that):

GaetanGodart_0-1713519986236.png

The TouchGFX process is constantly waiting for a vsync signal.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)