当前位置:网站首页>STM32F4-TFT-SPI时序逻辑分析仪调试记录
STM32F4-TFT-SPI时序逻辑分析仪调试记录
2022-07-01 15:16:00 【请叫我常思聪】
调试TFT时不知道数据是否写入了TFT
连接逻辑分析仪看看,
因为不确定软件SPI是否能用,因此先用硬件的SPI测试
之后换到 软件SPI
测试下了时序是对的,正常显示
代码如下
之后打开逻辑分析仪 我用的是 logic2,设置如下,注意红框内的设置,(改为 CPHA=1显示出来的数据是对不上的)
可以看到写入的数据全部是0xF800,宏定义里RGB565红色是0xF800


看下这个写入填充的函数里还写了哪些东西,
void LCD_direction(u8 direction)
{
lcddev.setxcmd=0x2A;
lcddev.setycmd=0x2B;
lcddev.wramcmd=0x2C;
switch(direction){
case 0:
lcddev.width=LCD_W;
lcddev.height=LCD_H;
lcddev.xoffset=52;
lcddev.yoffset=40;
LCD_WriteReg(0x36,0);//BGR==1,MY==0,MX==0,MV==0
break;
case 1: //select direction=1
lcddev.width=LCD_H;
lcddev.height=LCD_W;
lcddev.xoffset=40;
lcddev.yoffset=53;
LCD_WriteReg(0x36,(1<<6)|(1<<5));//BGR==1,MY==1,MX==0,MV==1
break;
case 2:
lcddev.width=LCD_W;
lcddev.height=LCD_H;
lcddev.xoffset=53;
lcddev.yoffset=40;
LCD_WriteReg(0x36,(1<<6)|(1<<7));//BGR==1,MY==0,MX==0,MV==0
break;
case 3:
lcddev.width=LCD_H;
lcddev.height=LCD_W;
lcddev.xoffset=40;
lcddev.yoffset=52;
LCD_WriteReg(0x36,(1<<7)|(1<<5));//BGR==1,MY==1,MX==0,MV==1
break;
default:break;
}
}
void LCD_WriteRAM_Prepare(void)
{
LCD_WR_REG(lcddev.wramcmd); //lcddev.wramcmd=0x2C
}
lcddev.setxcmd参数在void LCD_direction(u8 direction)内有更新,lcddev.setxcmd=0x2A
#define LCD_W 135 //TFT 1.14
#define LCD_H 240
void LCD_Fill(u16 sx,u16 sy,u16 ex,u16 ey,u16 color)
{
u16 i,j;
u16 width=ex-sx+1; //得到填充的宽度
u16 height=ey-sy+1; //高度
LCD_SetWindows(sx,sy,ex,ey);//设置显示窗口
for(i=0;i<height;i++)
{
for(j=0;j<width;j++)
Lcd_WriteData_16Bit(color); //写入数据
}
LCD_SetWindows(0,0,lcddev.width-1,lcddev.height-1);//恢复窗口设置为全屏
}
void LCD_SetWindows(u16 xStar, u16 yStar,u16 xEnd,u16 yEnd)
{
LCD_WR_REG(lcddev.setxcmd); //0x2A
LCD_WR_DATA((xStar+lcddev.xoffset)>>8); //(0+40)>>8=0x00
LCD_WR_DATA(xStar+lcddev.xoffset); //0x28
LCD_WR_DATA((xEnd+lcddev.xoffset)>>8); //(240+40)>>8=0x01
LCD_WR_DATA(xEnd+lcddev.xoffset); //0x18
LCD_WR_REG(lcddev.setycmd); //0x2B
LCD_WR_DATA((yStar+lcddev.yoffset)>>8); //0+53 >>8=0x00
LCD_WR_DATA(yStar+lcddev.yoffset); //0x35
LCD_WR_DATA((yEnd+lcddev.yoffset)>>8); //135+53 >>8=0x00
LCD_WR_DATA(yEnd+lcddev.yoffset); //0xBC
LCD_WriteRAM_Prepare(); //开始写入GRAM //lcddev.wramcmd=0x2C
}
因此数据开头的应该为:
0x2A–0x00–0x28–0x01–0x18------0x2B–0x00–0x35–0x00–0x35–0x00–0xBC-----0x2C-----0xF8-0x00–0xF8-0x00…
逻辑分析仪抓取出的数据:
抓取的数据与计算一致。
边栏推荐
- SQL常用的四个排序函数梳理
- The last picture is seamlessly connected with the first picture in the swiper rotation picture
- 《QT+PCL第六章》点云配准icp系列6
- It's settled! 2022 Hainan secondary cost engineer examination time is determined! The registration channel has been opened!
- go-zero实战demo(一)
- Ensure production safety! Guangzhou requires hazardous chemical enterprises to "not produce in an unsafe way, and keep constant communication"
- The difference between arrow function and ordinary function in JS
- [Cloudera][ImpalaJDBCDriver](500164)Error initialized or created transport for authentication
- 这3款在线PS工具,得试试
- Qt+pcl Chapter 6 point cloud registration ICP Series 2
猜你喜欢

In hot summer, please put away this safe gas use guide!

A unifying review of deep and shallow anomaly detection

An intrusion detection model

Wechat applet 02 - Implementation of rotation map and picture click jump

Wechat applet 03 - text is displayed from left to right, and the block elements in the line are centered

Skywalking 6.4 distributed link tracking usage notes

Task. Run(), Task. Factory. Analysis of behavior inconsistency between startnew() and new task()
SQL常用的四个排序函数梳理
Implementation of deploying redis sentry in k8s

How to realize clock signal frequency division?
随机推荐
三十之前一定要明白的职场潜规则
Filter & (login interception)
保证生产安全!广州要求危化品企业“不安全不生产、不变通”
Opencv Learning Notes 6 -- image feature [harris+sift]+ feature matching
这3款在线PS工具,得试试
leetcode:329. Longest increasing path in matrix
职场太老实,总被欺负怎么办?
【天线】【3】CST一些快捷键
网速、宽带、带宽、流量三者之间的关系是什么?
【LeetCode】16、最接近的三数之和
【目标跟踪】|模板更新 时间上下文信息(UpdateNet)《Learning the Model Update for Siamese Trackers》
如何实现时钟信号分频?
Tableapi & SQL and Kafka message insertion in Flink
In hot summer, please put away this safe gas use guide!
Basic operations of SQL database
Ensure production safety! Guangzhou requires hazardous chemical enterprises to "not produce in an unsafe way, and keep constant communication"
leetcode:329. 矩阵中的最长递增路径
What if you are always bullied because you are too honest in the workplace?
《QT+PCL第九章》点云重建系列2
The first word of JVM -- detailed introduction to JVM and analysis of runtime data area