Difference between revisions of "2inch LCD Module"
Line 42: | Line 42: | ||
|} | |} | ||
==Hardware description== | ==Hardware description== | ||
+ | ST7789V supports RGB444, RGB565 and RGB666 three formats. This LCD uses RGB565.<br /> | ||
+ | For most of the LCD controller, there are several interfaces for choosing, this module we use SPI interface which is fast and simple. | ||
+ | ===Communication protocol=== | ||
+ | :[[File:2inch_LCD_Module_manual_1.png|700px]] | ||
+ | Note: It is not like the tradition SPI protocol, it only uses MOSI to send data from master to slave for LCD display. For details please refer to Datasheet Page 105. | ||
+ | |||
+ | RESX: Reset, should be pull-down when power on, set to 1 other time. | ||
+ | |||
+ | CSX: Slave chip select. The chip is enabled only CS is set Low | ||
+ | |||
+ | D/CX: Data/Command selection; DC=0, write command; DC=1, write data | ||
+ | |||
+ | SDA: Data transmitted. (RGB data) | ||
+ | |||
+ | SCL: SPI clock | ||
+ | |||
+ | The SPI communication protocol of the data transmission uses control bits: clock phase (CPHA) and clock polarity (CPOL): | ||
+ | |||
+ | CPOL defines the level while the synchronization clock is idle. If CPOL=0, then it is LOW. | ||
+ | |||
+ | CPHA defines at whish clock’s tick the data transmission starts. CPHL=0 – at the first one, otherwise at the second one | ||
+ | |||
+ | This combination of two bits provides 4 modes of SPI data transmission. The commonly used is SPI0 mode, i.e. GPHL=0 and CPOL=0. | ||
+ | |||
+ | According to the figure above, data transmitting begins at the first falling edge, 8bit data are transmitted at one clock cycle. It is SPI0. MSB. | ||
+ | |||
+ | ==Raspberry Pi examples== | ||
+ | For Raspberry Pi we provide examples based on C and python | ||
+ | ===Enable SPI=== | ||
+ | Open terminal and run commands to enable SPI interface | ||
+ | sudo raspi-config | ||
+ | Choose Interfacing Options -> SPI -> Yes | ||
+ | |||
+ | Then reboot Raspberry Pi | ||
+ | |||
+ | ===Libraries installation=== | ||
+ | *BCM2835 | ||
+ | <pre> | ||
+ | wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz | ||
+ | tar zxvf bcm2835-1.60.tar.gz | ||
+ | cd bcm2835-1.60/ | ||
+ | sudo ./configure | ||
+ | sudo make | ||
+ | sudo make check | ||
+ | sudo make install | ||
+ | </pre> | ||
+ | *WiringPi | ||
+ | <pre> | ||
+ | sudo apt-get install wiringpi | ||
+ | cd /tmp | ||
+ | wget https://project-downloads.drogon.net/wiringpi-latest.deb | ||
+ | sudo dpkg -i wiringpi-latest.deb | ||
+ | gpio -v | ||
+ | </pre> | ||
+ | *Python2 | ||
+ | <pre> | ||
+ | sudo apt-get updata | ||
+ | sudo apt-get install python-pip | ||
+ | sudo pip install RPi.GPIO | ||
+ | sudo pip install spidev | ||
+ | sudo apt-get install python-imaging | ||
+ | </pre> | ||
+ | *Python3 | ||
+ | <pre> | ||
+ | sudo apt-get update | ||
+ | sudo apt-get install python3-pip | ||
+ | sudo pip3 install RPi.GPIO | ||
+ | sudo pip3 install spidev | ||
+ | sudo apt-get install python3-imaging | ||
+ | </pre> | ||
+ | ===Hardware connection=== | ||
+ | :[[File:2inch-LCD-Module-3.jpg|600px]] | ||
+ | {|border="1" style="text-align:center; width:600px" | ||
+ | |-style="background:green; color:white" | ||
+ | |'''2inch LCD'''|| '''Board number'''||'''BCM number''' | ||
+ | |- | ||
+ | |VCC||5V||5V | ||
+ | |- | ||
+ | |GND||GND||GND | ||
+ | |- | ||
+ | |DIN||19||MOSI | ||
+ | |- | ||
+ | |CLK||23||SCLK | ||
+ | |- | ||
+ | |CS||24||CE0 | ||
+ | |- | ||
+ | |DC||22||P25 | ||
+ | |- | ||
+ | |RST||13||P27 | ||
+ | |- | ||
+ | |BL||12||P18 | ||
+ | |} | ||
==Resources== | ==Resources== |
Revision as of 03:51, 18 November 2019
| ||
Instruction
This is a general LCD display Module, IPS screen, 2inch diagonal, 240×320 resolution, with embedded controller, communicating via SPI interface
Feature
- SPI interface, requires minimum GPIO for controlling
- Comes with development resources and manual
Specifications
- Driver: ST7789
- Interface: SPI
- Display color: RGB, 262K color
- Resolution: 240×320
- Backlight: LED
- Operating voltage: 3.3V
Interface
SYMBOL | Description |
VCC | Power (3.3V input) |
GND | Ground |
DIN | SPI data input |
CLK | SPI clock input |
CS | Chip selection, low active |
DC | Data/Command selection (high for data, low for command) |
RST | Reset, low active |
BL | Backlight |
Hardware description
ST7789V supports RGB444, RGB565 and RGB666 three formats. This LCD uses RGB565.
For most of the LCD controller, there are several interfaces for choosing, this module we use SPI interface which is fast and simple.
Communication protocol
Note: It is not like the tradition SPI protocol, it only uses MOSI to send data from master to slave for LCD display. For details please refer to Datasheet Page 105.
RESX: Reset, should be pull-down when power on, set to 1 other time.
CSX: Slave chip select. The chip is enabled only CS is set Low
D/CX: Data/Command selection; DC=0, write command; DC=1, write data
SDA: Data transmitted. (RGB data)
SCL: SPI clock
The SPI communication protocol of the data transmission uses control bits: clock phase (CPHA) and clock polarity (CPOL):
CPOL defines the level while the synchronization clock is idle. If CPOL=0, then it is LOW.
CPHA defines at whish clock’s tick the data transmission starts. CPHL=0 – at the first one, otherwise at the second one
This combination of two bits provides 4 modes of SPI data transmission. The commonly used is SPI0 mode, i.e. GPHL=0 and CPOL=0.
According to the figure above, data transmitting begins at the first falling edge, 8bit data are transmitted at one clock cycle. It is SPI0. MSB.
Raspberry Pi examples
For Raspberry Pi we provide examples based on C and python
Enable SPI
Open terminal and run commands to enable SPI interface
sudo raspi-config
Choose Interfacing Options -> SPI -> Yes
Then reboot Raspberry Pi
Libraries installation
- BCM2835
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz tar zxvf bcm2835-1.60.tar.gz cd bcm2835-1.60/ sudo ./configure sudo make sudo make check sudo make install
- WiringPi
sudo apt-get install wiringpi cd /tmp wget https://project-downloads.drogon.net/wiringpi-latest.deb sudo dpkg -i wiringpi-latest.deb gpio -v
- Python2
sudo apt-get updata sudo apt-get install python-pip sudo pip install RPi.GPIO sudo pip install spidev sudo apt-get install python-imaging
- Python3
sudo apt-get update sudo apt-get install python3-pip sudo pip3 install RPi.GPIO sudo pip3 install spidev sudo apt-get install python3-imaging
Hardware connection
2inch LCD | Board number | BCM number |
VCC | 5V | 5V |
GND | GND | GND |
DIN | 19 | MOSI |
CLK | 23 | SCLK |
CS | 24 | CE0 |
DC | 22 | P25 |
RST | 13 | P27 |
BL | 12 | P18 |
Resources
Document
Demo codes
FAQ
...
Supports
Support
If you require technical support, please go to the Support page and open a ticket.