cancel
Showing results for 
Search instead for 
Did you mean: 

Using TouchGFX to drive multiple LCD displays

MVart.2
Associate II

Hi All,

Are there any TouchGFX examples driving multiple displays over SPI using ILI9341 controller? I am able to drive a single 320x240 display no problem but run into issues when extending to two displays.

I'm guessing I am sending too much data over SPI but I am assuming that each SPI controller is independent so data sent over SPI1 should not affect data sent over SPI2?

I am using the following components:

ST NUCLEO-F767ZI

STM32CubeIDE v1.10.0

TouchGFX Designer 4.20.0

2.4" DisplayTech TFT (DT024CTFT) using ILI9341 Controller

Thanks,

Mike

13 REPLIES 13
MM..1
Chief II

When you use DMA for both SPI your bottleneck maybe is RAM and bus. If you prepare hw drivers for LCD ok i mean TouchGFX will not have issue.

MVart.2
Associate II

Thanks for the reply. This could definitely be the bottleneck. I set up the code using CubeMX to have two independent SPIs connected to DMA. I configured the partial frame buffer to use 3 blocks of size 1920 bytes. Any suggestions on what I should change?

MM..1
Chief II

Try 6 blocks and variate SPI speeds

MVart.2
Associate II

Thanks for the suggestion on changing the number of blocks. I will give that a try. The fastest I could drive the SPI is 6.25 mbps with 3 blocks so I will let you know if that improves with 6 blocks. Thanks!

MVart.2
Associate II

So I tried changing the blocks from 3 to 6 to 9 but it did not appear to improve performance. The code still appears to crash when I try to drive the SPI > 6mbps. I have seen videos where the displays are being driven way faster. Any other thoughts or suggestions to try? I really appreciate your help.

MM..1
Chief II

Is your mbps bits or bytes per sec?

Work your code with one LCD?

bits per second

The code works fine with one LCD. I can even drive the LCD faster... I can set the SPI to 25mbps and the display appears to work fine...

The 2 LCD application takes the same pixel buffer and send to both screens inside the touchgfxDisplayDriverTransmitBlock() function.

MM..1
Chief II

If you use two DMA SPI , you have two tranfer complete sources. But touchGFX system isnt prepared for this, you need change some code. Try show here how you do it now.

MVart.2
Associate II

Thanks for the reply... Here is what I do... I override the two functions below...

void touchgfxDisplayDriverTransmitBlock(uint8_t* pixels, uint16_t x, uint16_t y, uint16_t w, uint16_t h)
 {
 	isTransmittingData = 1;
 
 	ILI9341_SetWindow(x, y, x+w-1, y+h-1, 0, &hspi1);
 	ILI9341_SetWindow(x, y, x+w-1, y+h-1, 1, &hspi2);
 
	ILI9341_DrawBitmap(w, h, pixels, 0, &hspi1);
 	ILI9341_DrawBitmap(w, h, pixels, 1, &hspi2); 
}
  
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi) 
{ 
	if (hspi->Instance == SPI1) {
 		spi1done = 1; 
	}
 
	if (hspi->Instance == SPI2) {
 		spi2done = 1;
 	}
 
	if (spi1done + spi2done == 2) {
		spi1done = 0; 
		spi2done = 0;
 
		ILI9341_EndOfDrawBitmap();
 		isTransmittingData = 0;
 		DisplayDriver_TransferCompleteCallback(); 
	}
}

I can share my project with you if that makes it easier?