大家好。 我将 EK-TM4C1294XL 与 TFT 2.8 SPI 模块 ILI9341 LCD 配合使用(http://www.lcdwiki.com/2.8inch_SPI_Module_ILI9341_SKU:MSP2807)、遇到了一个问题:FPS 过低。
我正在 EK-TM4C1294XL 模块上使用 SYS-BIOS。 我创建了一个小 API、以便于使用 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);
如果(!SPI_H)
{
system_abort ("尝试配置模块\"SPI\"失败!");
}
}
unsigned char SPI_Send (unsigned char *数据_ ptr、unsigned int 数据_长度)
{
unsigned char 应答= 0x0;
SPI_Message_Data.count =数据长度;
SPI_Message_Data.txBuf = Data_ptr;
应答= SPI_TRANSFER (SPI_H、&SPI_Message_Data);
返回答案
;}
对于 LCD、我也创建了一个 API
void TFT_Send_Command (unsigned char Command) { GPIO_WRITE (TFT_DC、0); SPI_Send (&Command、1); } void TFT_Send_parameter (unsigned char 参数) { GPIO_WRITE (TFT_DC、1); SPI_Send (¶meter、1); } void TFT_Send_Word (无符号短字) { GPIO_WRITE (TFT_DC、1); SPI_Send ((unsigned char*)&Word、2); } void TFT_Select_Workspace (TFT_Point_Structt Start_Point、TFT_Point_StructStop) { 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 (无符号短颜色) { int i = 0; TFT_Select_Workspace (TFT_Start_Point、TFT_Stop_Point); TFT_Send_Command (0x2C); 对于(I = 0;I < TFT_Resolution _X * TFT_Resolution _Y;I++) { TFT_Send_Word (颜色); } } 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); //颜色格式 TFT_Send_Command (0x3A); TFT_Send_Parameter (0x55); //伽马3 TFT_Send_Command (0xF2); TFT_Send_Parameter (0x00); //伽马选择 TFT_Send_Command (0x26); TFT_Send_Parameter (0x01); //正电流 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); //负伽马 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); }
在主任务中、我将配置 SPI 和 LCD、并在超循环中填充1种颜色
SPI_Configuration (); TFT_TFT_TON_ON (); while (1) { 如果(i ==0) { TFT_FACK_ALL_Display (TFT_GET_color (0、0、0))); } 如果(i = 1)则为其他值 { TFT_FACK_ALL_Display (TFT_GET_color (255、0、0))); } 如果(i == 2)则为其他值 { TFT_FACK_ALL_Display (TFT_GET_color (0、255、0)); } 如果(i ==3)则为其他值 { TFT_FACK_ALL_Display (TFT_GET_color (0、0、255)); } I ==3? I = 0:i++; }
问题在于 LCD 在1.6秒内充满。 即我有0.6 FPS。 我不知道是什么问题(但 SPI 很好、它实际上是可配置的60 MHz。 我用示波器检查了这一点)。
我的代码中有问题,因为有些人在 Ard*ino 上的这个显示屏上达到了10个以上 FPS (证明: https://www.youtube.com/watch?v=WapdjBnF7tQ&t=0s)
我遇到了这个问题。 请帮帮我。

