当前位置:网站首页>3-wire SPI screen driving mode
3-wire SPI screen driving mode
2022-06-27 00:50:00 【NULL_ one thousand nine hundred and sixty-nine】
Preface
Recently, I studied 3 Line spi The driving mode of the screen . The driving chip of the screen is ILI9488, Compared with 4 Line ,3 Line spi The screen does not use DC Write orders / Write data control line .DC=0 To write an order ,DC=1 Write data .
3 Line spi data format

3 Line spi Will be DC The command is placed on every 8 The highest bit of bit data . It's still boring to say so , Take a look at specific examples .
If spi send out 0x55, Generally used MSB, The way that the high position comes first .
that SDA(MOSI) The data line is like this :
01010101
If you want to suppose dc command , be 0x55 To be sent in two bytes , hypothesis DC=1, be SDA(MOSI) The data are as follows :
10101010 1
Low byte High byte
Equivalent to 0x55 Convert to :0x80AA. At the same time, it should be set in the single chip microcomputer spi The data is 9 position . After many explorations , The conversion formula is :
uint16_t data = (0x8000&(cmd<<15))|(0x7f&(cmd>>1)) ;
Specific in esp32 In, you need to change the sending function to the following :
static void lcd_cmd(spi_device_handle_t spi, const uint8_t cmd)
{
esp_err_t ret;
spi_transaction_t t;
uint16_t data=0;
data = (0x8000&(cmd<<15))|(0x7f&(cmd>>1)) ;
memset(&t, 0, sizeof(t)); //Zero out the transaction
t.length=9; //Command is 8 bits
t.tx_buffer=&data; //The data is the cmd itself
ret=spi_device_polling_transmit(spi, &t); //Transmit!
assert(ret==ESP_OK); //Should have had no issues.
}
static void lcd_data_byte(spi_device_handle_t spi, const uint8_t cmd)
{
esp_err_t ret;
spi_transaction_t t;
uint16_t data=0;
data = (0x8000&(cmd<<15))|(0x80|cmd>>1) ;
memset(&t, 0, sizeof(t)); //Zero out the transaction
t.length=8; //Command is 8 bits
t.tx_buffer=&data; //The data is the cmd itself
ret=spi_device_polling_transmit(spi, &t); //Transmit!
assert(ret==ESP_OK); //Should have had no issues.
}
Only in this way can we communicate with the screen normally . This causes the communication speed to decrease , Difficult to adopt dma Transfer a lot of data . The reason is that each byte must be disassembled and put together 2 Bytes and then send . It's so inconvenient , It took a lot of time to adjust this .
Personally feel 3 Line spi Communication methods and their bullshit , Extremely inefficient , It's still honest and practical 4 Line spi Or SCM 8080 Interface to drive the screen . Some screens DC Pin use RS To represent the , The author did not understand at the beginning , Did you find this screen DC Pin , To study 3 Line spi, Later, I found that the screen refresh rate was too low , Refreshing a full screen requires 10s The clock . Finally found RS=DC, Immediately change to 4 Line spi, Cool, dropping .
however ILI9488 The most important thing about this driver chip is that it uses spi The way , Only support 8bit and 18bit The color format of , I won't support it 16bit. This is the result of the experiment , The specification states that 4 Line spi when , Can support 16bit Color ,
But will 0x3A write in 0x05(16bit) The screen is not displayed , Only will 0x3A write in 0x06(18bit) when , To show the color . This is very stupid .
ILI9488 18 Bit color format

Usually used 16 Bit color , So we're using 18 Bit color needs to be replaced . And then through spi send out . The specific conversion method is
colors[0] = (color>>8)&0xf8;
colors[1] = (color>>3)&0xfc;
colors[2] = (color<<3)&0xfc;
Put red in the first byte , Green in the second byte , Put blue three bytes lower , And they are all high aligned . Low vacancy . After conversion, the screen can be displayed normally .
边栏推荐
- 【Vscode】预览md文件
- JS library for number formatting
- 【leetcode】275. H index II
- 从位图到布隆过滤器,C#实现
- Simple and fast digital network (network dolls in the network)
- 冲刺强基计划数学物理专题二
- Employment prospect of GIS and remote sensing specialty and ranking selection of universities in 2022
- 墨者学院-SQL注入漏洞测试(报错盲注)
- Hit the point! The largest model training collection!
- Com. Faster XML. Jackson. DataBind. Exc.mismatchedinputexception: tableau ou chaîne attendu. At [Source: X
猜你喜欢

05 | 規範設計(下):commit 信息風格迥异、難以閱讀,如何規範?

Batch generate folders based on file names

CPU exception handling

Using physical information neural network to solve hydrodynamics equations

Live review | Ziya &ccf TF: Discussion on software supply chain risk management technology under cloud native scenario

Central Limit Theorem

Hit the point! The largest model training collection!

滑环安装有哪些技巧和方法
![统计无向图中无法互相到达点对数[经典建邻接表+DFS统计 -> 并查集优化][并查集手册/写的详细]](/img/cc/a0be58eddc72c22a9a6ee5c61eb81a.png)
统计无向图中无法互相到达点对数[经典建邻接表+DFS统计 -> 并查集优化][并查集手册/写的详细]

Skills needing attention in selection and purchase of slip ring
随机推荐
Special topic II on mathematical physics of the sprint strong foundation program
Simple and fast digital network (network dolls in the network)
从位图到布隆过滤器,C#实现
用代码生成流程图,Markdown的使用方法
万字详解-MindArmour 小白教程!
At present, which securities company is the best and safest to open an account for stock speculation?
Le principe le plus complet de formation à la précision hybride pour l'ensemble du réseau
寻找旋转排序数组中的最小值 II[经典抽象二分 + 如何破局左中右三者相等]
Kubeadm create kubernetes cluster
数字格式化的 js 库
其他服务注册与发现
运用物理信息神经网络求解流体力学方程
MySQL之账号管理、建库以及四大引擎+案例
05 | 规范设计(下):commit 信息风格迥异、难以阅读,如何规范?
Understanding of "the eigenvectors corresponding to different eigenvalues cannot be orthogonalized"
find_circ详细使用指南
XML learning notes
Technical dry goods | what is a big model? Oversized model? Foundation Model?
Technical dry goods | top speed, top intelligence and minimalist mindspore Lite: help Huawei watch become more intelligent
Review the old and know the new -- constant renewal at normal temperature