ST7565 Driver for esp-idf
ESP-IDF V4.4/V5.x.
ESP-IDF V5.0 is required when using ESP32-C2.
ESP-IDF V5.1 is required when using ESP32-C6.
ST7565 Graphic LCD Module with SPI interface.
I bought it on AliExpress.
You can change the interface to Parallel and SPI by changing the chip resistor on the back, but for this project we will use SPI.
git clone https://github.com/nopnop2002/esp-idf-st7565
cd esp-idf-st7565/
idf.py set-target {esp32/esp32s2/esp32s3/esp32c2/esp32c3/esp32c6}
idf.py menuconfig
idf.py flash
Note for ESP32-C3
For some reason, there are development boards that cannot use GPIO06, GPIO08, GPIO09, GPIO19 for SPI clock pins.
According to the ESP32C3 specifications, these pins can also be used as SPI clocks.
I used a raw ESP-C3-13 to verify that these pins could be used as SPI clocks.
You have to set this config value with menuconfig.
- CONFIG_WIDTH
- CONFIG_HEIGHT
- CONFIG_MOSI_GPIO
- CONFIG_SCLK_GPIO
- CONFIG_CS_GPIO
- CONFIG_DC_GPIO
- CONFIG_RESET_GPIO
- CONFIG_BL_GPIO
- CONFIG_FLIP
- CONFIG_INVERSION
# | ST7565 | ESP32 | ESP32S2/S3 | ESP32C2/C3/C6 | |
---|---|---|---|---|---|
1 | DB0 | -- | N/C | N/C | N/C |
2 | DB1 | -- | N/C | N/C | N/C |
3 | DB2 | -- | N/C | N/C | N/C |
4 | DB3 | -- | N/C | N/C | N/C |
5 | DB4 | -- | N/C | N/C | N/C |
6 | DB5 | -- | N/C | N/C | N/C |
7 | DB6(=SCLK) | -- | GPIO18(*) | GPIO36(*) | GPIO1(*) |
8 | DB7(=MOSI) | -- | GPIO23(*) | GPIO35(*) | GPIO0(*) |
9 | VDD | -- | 3.3V | 3.3V | 3.3V |
10 | VSS | -- | GND | GND | GND |
11 | LEDA | -- | GPIO32(*) | GPIO33(*) | GPIO4(*) |
12 | /CS | -- | GPIO5(*) | GPIO34(*) | GPIO5(*) |
13 | /RES | -- | GPIO33(*) | GPIO41(*) | GPIO3(*) |
14 | A0 | -- | GPIO27(*) | GPIO40(*) | GPIO2(*) |
15 | /WR | -- | N/C | N/C | N/C |
16 | /RD | -- | N/C | N/C | N/C |
For SPI interfaces, DB6 is the SPI CLOCK.
For SPI interfaces, DB7 is the SPI MOSI.
(*) You can change any GPIO using menuconfig.
I am using this font.