2022-07-21 10:48 AM
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
2022-07-21 11:10 PM
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.
2022-07-22 09:31 PM
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?
2022-07-22 10:29 PM
Try 6 blocks and variate SPI speeds
2022-07-23 08:59 AM
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!
2022-07-23 08:58 PM
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.
2022-07-24 12:06 AM
Is your mbps bits or bytes per sec?
Work your code with one LCD?
2022-07-24 07:29 AM
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.
2022-07-24 08:35 AM
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.
2022-07-24 08:29 PM
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?