Showing results for 
Search instead for 
Did you mean: 

Basic TouchGFX Project with Monochrome SPI E-Paper Display

Associate II


I`m trying to get TouchGFX run on a Nucleo Board and with a monochrome E-Paper Display via SPI. For the first "Hello World" I want to use the full refresh from the E-Paper Display to show the Single Framebuffer. Maybe only refreshed when Button is clicked or periodically with a Timer Interrupt. I used mostly this Tutorial as a Guide.

In order to do that I did the following Steps:

  1. Start a new Project with TouchGFX, SPI and working E-Paper Driver
  2. Created "Hello World " in the Designer (white Box in the Background and a black Label)
  3. Setting up Timer with Interrupt ~ every 4 sec (tried with LED, so this is working)
  4. Ive put the following Code in the TouchGFXGeneratedHAL.cpp (not perfect but otherwise I got the error that the function touchgfxSignalVSync is unknown) and called it from the interrupt 


extern "C"
void touchgfxSignalVSync(void)
/* VSync has occurred, increment TouchGFX engine vsync counter */
/* VSync has occurred, signal TouchGFX engine */

----- Code Interrupt main.c -----

extern void touchgfxSignalVSync(void);
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
if (htim->Instance == TIM16) {


  • After that I just took the data transfer files from the tutorial. Ive commented the Callback out, because my Driver is blocking right now (I want to change that when minimum setup is working). And I just ignored the blocks, because I want to do only full refresh. 


the data transfer File:

/* Functions called by the TouchGFX HAL to invoke the actual data transfer to ILI9341.
 * Pero, 2021

#include "../EPD_GD42_HW_SPI_DRIVER/epd_gd42_hw_spi_driver.h"
#include "TouchGFX_DataTransfer.h"

extern void DisplayDriver_TransferCompleteCallback();

static uint8_t isTransmittingData = 0;

uint32_t touchgfxDisplayDriverTransmitActive(void)
	return isTransmittingData;

void touchgfxDisplayDriverTransmitBlock(uint8_t* pixels, uint16_t x, uint16_t y, uint16_t w, uint16_t h)
	isTransmittingData = 1;

	isTransmittingData = 0;


#if 0
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi)
	if (hspi->Instance == SPI1) {
		isTransmittingData = 0;

//----------- Header file is like in the Tutorial -----------


#ifdef __cplusplus
 extern "C" {

void touchgfxDisplayDriverTransmitBlock(uint8_t* pixels, uint16_t x, uint16_t y, uint16_t w, uint16_t h);
uint32_t touchgfxDisplayDriverTransmitActive(void);




So right now the Project is running, but nothing really happens. The code is in a loop between isVSyncAvailable and the Hal.backPorchExited(); in the touchgfx_taskEntry();

What are the right steps to implement just a flush for the complete Display? And did I implemented the signalVSync right?

Maybe I should implement only the flushDisplay Function? But how and where in the DataTransfer/TouchGFXHAL File? And if u have some ideas on how to implement both full and partial refresh I would like to hear some advice. But first I want to figure out how I can get this to work.

Ive verified that the Timer Interrupt and the Display Driver and Connections are working in this project.

I'm new to TouchGFX and still trying to get the Basics. The Documentation is good, but I didn't understood it completely for SPI and this special case. Thank you so much in advance!

Associate II

So I've checked more and the V-Sync Signal is working. There is a call to 


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


In this function i can call the display function for full update with the framebuffer from touchgfx. So the Main program is working now. But I want to implement partial refresh as well.

I can determine the size for the partial refresh from "Rect", but how can I tell whether I am doing a partial refresh or whether the whole screen needs to be refreshed with a full refresh. These are two different calls in my e-paper driver. Does anyone have any ideas?

Right now i get the right coordinates, but when I Update the area it`s just updating with white instead of the text. I think i need to figure out, how the framebuffer from TouchGFX looks like. I need one for my update function thats as big, as the area is thats needed to refresh.