Template: 1.28inch LCD Module Interface
Interface Description
Raspberry Pi
Please connect the LCD to your Raspberry Pi by the 8PIN cable according to the table below
Use the pin header or PH2.0 8PIN interface, you need to connect according to the following table
LCD | Raspberry Pi | |
BCM2835 | Board | |
VCC | 3.3V | 3.3V |
GND | GND | GND |
DIN | MOSI | 19 |
CLK | SCLK | 23 |
CS | CE0 | 24 |
DS | 25 | 22 |
RST | 27 | 13 |
BL | 18 | 12 |
The 1.28inch LCD uses the PH2.0 8PIN interface, which can be connected to the Raspberry Pi according to the above table: (Please connect according to the pin definition table. The color of the wiring in the picture is for reference only, and the actual color shall prevail.)
STM32
The example we provide is based on STM32F103RBT6, and the connection method provided is also the corresponding pin of STM32F103RBT6. If you need to transplant the program, please connect according to the actual pin.
LCD | STM32 |
VCC | 3.3V |
GND | GND |
DIN | PA7 |
CLK | PA5 |
CS | PB6 |
DC | PA8 |
RST | PA9 |
BL | PC7 |
Take the XNUCLEO-F103RB development board developed by our company as an example, the connection is as follows:
Arduino
LCD | UNO |
VCC | 5V |
GND | GND |
DIN | D11 |
CLK | D13 |
CS | D10 |
DC | D7 |
RST | D8 |
BL | D9 |
The connection diagram is as follows (click to enlarge):
LCD & Controller
The built-in driver used in this LCD is GC9A01, with a resolution of 240RGB×240 dots, 129,600 bytes of GRAM inside. This LCD supports 12/16/18-bit data bus MCU interface, namely the formats of RGB444, RGB565, RGB666, which are commonly used.
Most of the LCD controllers can debug their communication ways such as by 8080 parallel interfaces, three-wire SPI, four-wire SPI, and so on. This LCD adopts a four-wire SPI communication interface, which can greatly save the GPIO port, and the communication speed will be faster.
- Maybe you have doubts that as the screen is circular, which point is the first pixel? How to determine the coordinates?
- In fact, you can presume that a square screen draws an inscribed circle in it. We only display the content in this inscribed circle, and the pixels beside the square are deleted. The same is true for most of the circular LCDs on the market.
- In fact, you can presume that a square screen draws an inscribed circle in it. We only display the content in this inscribed circle, and the pixels beside the square are deleted. The same is true for most of the circular LCDs on the market.
Communication Protocol
Note: Different from the traditional SPI protocol: the data line sent from the slave to the host is hidden as the LCD only needs to be displayed. Please refer to the table on Datasheet Page 105.
RESX: reset, it is pulled low when the module is powered on, and it is usually set to 1.
CSX: the slave chip selection and the chip will be enabled only when CS is low.
D/CX: the data/command control pin of the chip, write command when DC = 0, write data when DC = 1
SDA: the transmitted data, that is, RGB data;
SCL: the SPI communication clock.
For SPI communication, data is transmitted with timing, that is, the combination of clock phase (CPHA) and clock polarity (CPOL):
The level of CPHA determines whether the data of the serial synchronization clock is collected on the first clock transition edge or the second clock transition edge. When CPHA = 0, data acquisition is performed on the first transition edge;
The level of CPOL determines the idle state level of the serial synchronous clock. CPOL = 0, which is a low level.
As can be seen from the figure, when the first falling edge of SCLK starts to transmit data, 8bit data is transmitted in one clock cycle, using SPI0, bit-by-bit transmission, high-order first, and low-order at last.