type
status
date
slug
summary
tags
category
icon
password
 

System Analysis

notion image
 
 

lcd reset module

Analysis

最重要的信号是lcd_rst信号,用来重置lcd,我们需要知道rst的所需波形
因此我们需要看到lcd 驱动的driver ic 文档,这里是ST7735S,reset timing部分
需要长于10us,取消即
NVM 是存储设备。
notion image
💡
It is necessary to wait 5msec after releasing RESX before sending commands. Also Sleep Out command cannot be sent for 120msec.
第一部分
第二部分 最少为10us
第三部分 至少120ms
notion image
我们需要生成这个波形来控制lcd reset
 

code

notion image
 
各部分的时间控制,这里他的fpga板载晶振是50
Hz,因此除了20。
notion image
 
三种状态
notion image
 
状态机部分
 
always1:将next_state切换
notion image
always2:描述状态切换条件
notion image
always3:通过task描述各个状态的功能
notion image
 
idle_task:初始化变量
notion image
 
lcd_rst_task 生成时钟序列
notion image
notion image
notion image
进入完成态
notion image
 
完成态只传输完成
notion image

simulate

notion image
notion image
notion image
notion image
符合规格书的要求
 

SPI DRIVER

analysis

串行写接口

CSX select pin,低电平有效,高电平忽略SDA和D/CX
SCL低电平的中间 SDA改变,其他时间保持稳定
D/CX 对应 data and command DC,最后一clk接受黄色的bit,最后一clk需要保持稳定,0是command,1是data(D7~D0)
notion image

timing

对150ns的读最短时间,最大频率6.667MHz
notion image
因此,需要5MHz的时钟

code

notion image
notion image

simulation

串行将数据输出给sda口,从而传输给lcd,并且sda数据改变在scl时钟的中间。
首先初始化状态,随后使en_i为1,开始状态切换
随后即开始进行IDLE、LCD_WR、DONE三个状态的切换
在LCD_WR状态,根据analysis,在negedge将cs置为0,并将额外1位数据给到dc,并减少bit_id以读取下一位,切换到将数据编码到SDA的flow
数据被编码到DC,每当SCL在中间时。
notion image
 
完成后发送done_o
notion image
 

lcd_driver module

第一个function为lcd_rst
第二个function为lcd_init,通过spi_driver模块来初始化lcd
第三个为disp_rgb,通过spi_driver来在LCD上显示像素
第四个为disp_pic,通过spi_driver来在LCD上显示图片
notion image

lcd_rst

初始化LCD,包括fpga的变量。
init_reg_task;用于初始化LCD 参数
lcd_dc告诉lcd ic发送的是command 还是 data
 

输入文件格式转换

 

性能

理论传输带宽
6.25MHz时钟,9clk一个byte,0.694MBps?
帧刷新时间计算
共有128*160像素,每个像素为2byte数据,=40960byte
每byte需要9个时钟,每个时钟周期160ns = 1440ns
理论速度(不含指令)为58ms,挺接近的。
仿真显示约为62ms,即16.1FPS

debug

屏幕不显示

notion image
尝试通过仿真查看情况,发现仿真速度较慢,尝试Linux虚拟机发现速度类似,修改代码减少等待时间
  1. 发现代码逻辑问题,每次信号传输时长均为120ms
  1. 使用不同SCL频率,MID POS忘记修改
  1. Linux虚拟机并不更加高效

仿真与规格书

notion image
notion image
 
问题可能是:第一位data/command分辨位没有传输

长时间(9s)rst_n花屏

状态机控制错误,修改后120ms花屏
花屏不发生改变—屏幕没有被刷新
一条command被当作数据
 

delay无效

3s数据超过了28位,不会达到条件,因此不刷新
 

图片变形

像素尺寸不匹配
 

开发已有单片机的FPGA版本trick

比如这个init指令,可以翻一翻arduino库的代码。
notion image
notion image
 
学习观 学习认识程序性能分析之 Vtune and Advisor
Loading...