본문 바로가기
IT/Platform

[아두이노] ESP32-2423: #1 PlatformIO & TFT_eSPI

by 블랙오닉스 2024. 11. 23.

2024.11.23

ESP32 + 2.4" LCD 보드가 며칠전 도착

업체 설명 페이지에 있던 링크에서 파일 다운로드

http://pan.jczn1688.com/pd/1/ESP32%20module/2.4inch_ESP32-2432S024.zip?signature=805908560078de8ef3afa0a055ba59a3c7b9495102fd022798b1ec12abfd403f7481b6101a9bcf1d8667c6c1516b45139cd42b9627deb179acce7fe93eead9cf

압축 풀면 예제, 문서가 있다

데모에서 TFT_RAINBOW를 PlatformIO로 빌드 시도

PlatformIO에서 아두이노 프로젝트 임포트

빌드 -> TFT_eSPI 못찾는 에러

platformio.ini에 extra include path 추가 -> FS.h를 못찾는 에러 발생

build_flags = -I"C:\Users\user\Desktop\Dev\2.4inch_ESP32-2432S024\2.4inch_ESP32-2432S024\1-Demo\Demo_Arduino\libraries\TFT_eSPI"

library 디렉토리에서 문서 발견

[env:esp32dev]
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
board = esp32dev
framework = arduino
lib_deps = bodmer/TFT_eSPI@^2.4.31

build_flags =
...

그래도 여러 문제 발생

https://docs.platformio.org/en/latest/projectconf/sections/env/options/library/lib_deps.html

 

lib_deps — PlatformIO latest documentation

© Copyright 2014-present, PlatformIO.

docs.platformio.org

드디어 빌드가 되었으나 화면 안나옴

시리얼 모니터에는 반응있음

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13232
load:0x40080400,len:3028
entry 0x400805e4

LVGL 프로젝트에서 생겼던 TFT_eSPI 버전 문제인가 싶어 데모 library 버전과 platformio에 인스톨된 버전 확인 후 수정

-> 그래도 화면 안나옴

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200

유저 메뉴얼 디렉토리 문서 확인

User_Setup.h를 수정하라고 한다.

#define ILI9341_2_DRIVER
#define TFT_WIDTH  240
#define TFT_HEIGHT 320
#define TFT_MISO 12
#define TFT_MOSI 13
#define TFT_SCLK 14
#define TFT_CS   15  // Chip select control pin
#define TFT_DC    2  // Data Command control pin
// #define TFT_RST   4  // Reset pin (could connect to RST pin)
#define TFT_RST  -1  // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
#define TOUCH_CS  33
#define TFT_BL    21
#define TFT_BACKLIGHT_ON HIGH

다시 빌드 화면 나온다.

정리

  • PlatformIO에서 Arduino Demo 프로젝트 임포트
  • platformio.ini 를 수정
    • lib_deps
    • monitor_speed
  • TFT_eSPI/User_Setup.h 수정
    • ILI9488_2
    • TFT_WIDTH, HEIGHT
    • TFT_PINs, TOUCH, TFT_BL