cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX with STM32F767ZI, ILI9341 SPI display

EBesh.1
Associate II

Hello,

I am trying to use TouchGFX with STM32F767ZI with a TFT SPI ILI9341 display. I have tried compiling the code using both STM32 Cube IDE and KEIL u5. With Cube IDE, the code does compile but I do not have any output on the screen (I am using the libraries provided for this display that have the functions to draw bit map and set window), whereas with KEIL I get many L6869W warnings and the project doesn't build. I have also tried switching to STM32F411, but I am experiencing the same problem. It would be greatly appreciated if you could assist me with that.

9 REPLIES 9
EBesh.1
Associate II

@Martin KJELDSEN​ please can you help me with that

MM..1
Chief II

TouchGFX and SPI displays is custom mode. You need implement parts code for hw manage.

Read docu and create first clean working code ...

I am following this tutorial https://www.youtube.com/watch?v=suMytEyQTP4&t=662s and I use TouchGFX_DataTransfer.h and TouchGFX_DataTransfer.c for connecting TouchGFX with SPI but still it doesn't work.

The functions are as follows :

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

 * Pero, 2021

 */

#ifndef TOUCHGFX_DATATRANSFER_H

#define TOUCHGFX_DATATRANSFER_H

#include <stdint.h>

#ifdef __cplusplus

 extern "C" {

#endif

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

uint32_t touchgfxDisplayDriverTransmitActive(void);

#ifdef __cplusplus

}

#endif

#endif

__________________________________________________________________________

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

 * Pero, 2021

 */

#include "ili9341.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;

ILI9341_SetWindow(x, y, x+w-1, y+h-1);

ILI9341_DrawBitmap(w, h, pixels);

}

void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi)

{

if (hspi->Instance == SPI1) {

ILI9341_EndOfDrawBitmap();

isTransmittingData = 0;

DisplayDriver_TransferCompleteCallback();

}

}

Have you tested

ILI9341_SetWindow(x, y, x+w-1, y+h-1);
ILI9341_DrawBitmap(w, h, pixels);

work without touchgfx . Scope you SPI and control signals...

Is your pinout config ok in code ?

Trying

ILI9341_SetWindow(0, 0, 319, 239);
ILI9341_DrawBitmap(320, 240, 0x800000CF);

in the while(1) loop doesn't give any output.

I have configured SPI using CubeMX and in main.c I have

SPI_HandleTypeDef hspi1;
DMA_HandleTypeDef hdma_spi1_tx;

I do not know how to check my pinout in the code.

Thank you for all your help!

Hi,

Did you debug the communication to the display with a logic analyzer/scope? Is anything happening over SPIx ?

/Martin

when calling MX_TouchGFX_Process() in while(1), my logic analyzer doesn't show anything at all and the fault might be with my settings.

However, I used an oscilloscope and I see 8 clock cycles ( I am using SPI - 8bit). Still the clock signal is very disturbed ( I m using 25MHz as SPI CLK speed). I checked all other lines and don't know why MOSI is always high.

Hard to help, when your schematics and code isnt ok.

In CubeMX when you clik on SPI1 and gpio part show pins used for MOSI CLK...

Too for LCD is required next pins , better is know what you do.

25 Mhz for an SPI clock speed is high for the ILI9341 chip, I'd suggest somewhere between 5 and 8 Mhz depending on reading or writing (they're different speeds). I'd look up the display chip and see what the exact speeds are.

I've also found that the hardware control of the NSS signal does not work well for this chip because of the need to keep NSS down when writing the registers and then writing data.

The MOSI from the chip ought to be connected to the MOSI on the processor, etc. IF you are using the same interface (SPIx) for both the touch controller and the display, be warned that the Chinese made touch controller does NOT release the MISO line when not selected, and you will need additional buffers (74LS125 style) hooked into the CS lines for each function.

for the MOSI line not being active, unplug the display and run the initialization in a loop, you should see activity. If not, then the SPI settings are incorrect.