Hi everyone. I'm using EK-TM4C1294XL with TFT 2.8 SPI Module ILI9341 LCD (http://www.lcdwiki.com/2.8inch_SPI_Module_ILI9341_SKU:MSP2807) and i've got a problem: low FPS.
I'm using SYS-BIOS on EK-TM4C1294XL module. I created a little API for easy using SPI
void SPI_Configuration() { SPI_Params_init(&SPI_Parameters); SPI_Parameters.mode = SPI_MASTER; SPI_Parameters.bitRate = 60000000; SPI_Parameters.dataSize = 8; SPI_Parameters.transferMode = SPI_MODE_BLOCKING; SPI_H = SPI_open(0, &SPI_Parameters); if (!SPI_H) { System_abort("An attempt to configurate module \"SPI\" was unsuccessful!"); } } unsigned char SPI_Send(unsigned char *Data_Ptr, unsigned int Data_Length) { unsigned char Answer = 0x0; SPI_Message_Data.count = Data_Length; SPI_Message_Data.txBuf = Data_Ptr; Answer = SPI_transfer(SPI_H, &SPI_Message_Data); return Answer; }
For LCD i created an API too
void TFT_Send_Command(unsigned char Command) { GPIO_write(TFT_DC, 0); SPI_Send(&Command, 1); } void TFT_Send_Parameter(unsigned char Parameter) { GPIO_write(TFT_DC, 1); SPI_Send(&Parameter, 1); } void TFT_Send_Word(unsigned short Word) { GPIO_write(TFT_DC, 1); SPI_Send((unsigned char*)&Word, 2); } void TFT_Select_Workspace(TFT_Point_Struct Start_Point, TFT_Point_Struct Stop_Point) { TFT_Send_Command(0x2A); TFT_Send_Parameter((Start_Point.X & 0xFF00) >> 8); TFT_Send_Parameter( Start_Point.X & 0xFF); TFT_Send_Parameter(( Stop_Point.X & 0xFF00) >> 8); TFT_Send_Parameter( Stop_Point.X & 0xFF); TFT_Send_Command(0x2B); TFT_Send_Parameter((Start_Point.Y & 0xFF00) >> 8); TFT_Send_Parameter(Start_Point.Y & 0xFF); TFT_Send_Parameter((Stop_Point.Y & 0xFF00) >> 8); TFT_Send_Parameter(Stop_Point.Y & 0xFF); } void TFT_Fill_All_Display(unsigned short Color) { int i = 0; TFT_Select_Workspace(TFT_Start_Point, TFT_Stop_Point); TFT_Send_Command(0x2C); for (i = 0; i < TFT_RESOLUTION_X * TFT_RESOLUTION_Y; i++) { TFT_Send_Word(Color); } } void TFT_Turn_On(void) { TFT_Start_Point.X = 0; TFT_Start_Point.Y = 0; TFT_Stop_Point.X = 240; TFT_Stop_Point.Y = 320; GPIO_write(TFT_LED_LIGHT, 1); GPIO_write(TFT_RESET, 0); Task_sleep(150); GPIO_write(TFT_RESET, 1); Task_sleep(150); TFT_Send_Command(0x11); Task_sleep(150); TFT_Send_Command(0x29); Task_sleep(150); // Color format TFT_Send_Command(0x3A); TFT_Send_Parameter(0x55); // Gamma 3 TFT_Send_Command(0xF2); TFT_Send_Parameter(0x00); // Gamma select TFT_Send_Command(0x26); TFT_Send_Parameter(0x01); // Positive gammga TFT_Send_Command(0xE0); TFT_Send_Parameter(0x0F); TFT_Send_Parameter(0x2A); TFT_Send_Parameter(0x28); TFT_Send_Parameter(0x08); TFT_Send_Parameter(0x0E); TFT_Send_Parameter(0x08); TFT_Send_Parameter(0x54); TFT_Send_Parameter(0xA9); TFT_Send_Parameter(0x43); TFT_Send_Parameter(0x0A); TFT_Send_Parameter(0x0F); TFT_Send_Parameter(0x00); TFT_Send_Parameter(0x00); TFT_Send_Parameter(0x00); TFT_Send_Parameter(0x00); // Negative gamma TFT_Send_Command(0xE1); TFT_Send_Parameter(0x00); TFT_Send_Parameter(0x15); TFT_Send_Parameter(0x17); TFT_Send_Parameter(0x07); TFT_Send_Parameter(0x11); TFT_Send_Parameter(0x06); TFT_Send_Parameter(0x2B); TFT_Send_Parameter(0x56); TFT_Send_Parameter(0x3C); TFT_Send_Parameter(0x05); TFT_Send_Parameter(0x10); TFT_Send_Parameter(0x0F); TFT_Send_Parameter(0x3F); TFT_Send_Parameter(0x3F); TFT_Send_Parameter(0x0F); }
In main task i'm configurating SPI and LCD and filling it up 1 color in hypercycle
SPI_Configuration(); TFT_Turn_On(); while (1) { if (i == 0) { TFT_Fill_All_Display(TFT_GET_COLOR(0, 0, 0)); } else if (i == 1) { TFT_Fill_All_Display(TFT_GET_COLOR(255, 0, 0)); } else if (i == 2) { TFT_Fill_All_Display(TFT_GET_COLOR(0, 255, 0)); } else if (i == 3) { TFT_Fill_All_Display(TFT_GET_COLOR(0, 0, 255)); } i == 3 ? i = 0 : i++; }
Problem is what LCD is filling up in 1.6 secs. i.e. i've got 0.6 FPS. I don't know what's wrong (But SPI is fine, it's really configurated 60 MHz. I checked this out by my oscilloscope).
Problem exactly in my code because of some guys reached 10+ FPS on this displays on Ard*ino (Proof: https://www.youtube.com/watch?v=WapdjBnF7tQ&t=0s)
I'm stumped with this problem. Please, help me...