当前位置:网站首页>Using STM32 DMA to drive 4-wire SPI interface OLED high-speed display

Using STM32 DMA to drive 4-wire SPI interface OLED high-speed display

2022-06-13 00:17:00 csaaa2005

The solution to this problem comes from a common OLED display , It uses SSD13XX Serial interface , Can pass 8080,8086,I2C,3/4 wire SPI Transmit display .

Developing SPI Found during the display ,3 Linear SPI,DC Line uses data frame transmission , Then data transmission becomes 9 position , If you use 4 Linear SPI (DC,CS,MOSI,CLK( among CS Omission )) have access to 8 Bit data , But need D/C The level of the line determines the command or data to be transmitted .

In most of the routines provided by the manufacturer , Is to use IO To control DC Line , With the efforts of individuals , Use STM32F0 Series of chips , Use 9 Bit DMA Data transmission succeeded . But for STM32 Other series of chips , Only support 8 Bit or 16 Bit SPI.

After some research efforts , Found something to use DMA +8 position SPI A reliable method of transmitting data .

Implementation process :

1. Initialize hardware SPI

2. Use SPI Yes OLED Do initialization work , And set specific OLED Row and column parameters

3. initialization DMA->SP

That's all . The core here is the 2 Step , Because the initialization process needs to be controlled DC The line level is CMD state , So you need to operate the corresponding IO mouth .

During initialization, you need to set OLED Working in row and column mode ( Address auto increment ), Instead of the page patterns shown in those examples ( Because page mode needs to be set frequently CMD Page command ).

After setting up DC The line can be kept in DATA On the level . And open DMA transmission , In this way, a memory area can be used to OLED The memory area of .

I tested , stay F401 Upper use 72M At the kernel frequency of ,SPI Of CLK At least... Can be achieved 12M, Is much higher than F0 Series of 4M about .( The simulations used by those routines SPI Can achieve 100K It's good , It also takes up resources )

原网站

版权声明
本文为[csaaa2005]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202280601484992.html