esp32-s3-st7796-lvgl8
1、先按照文档步骤,将基础框架搭建好
https://blog.csdn.net/qq_20540901/article/details/123608655
2、然后遇到一些花屏、显示不正确等等问题,使用以下的sdkconfig创建默认的配置,能解决大部分的问题,之后遇到颜色不正确的问题
文件名:sdkconfig.defaults
文件内容:
#
# Serial flasher config
#
CONFIG_ESPTOOLPY_FLASHMODE_DIO=y
CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y
CONFIG_ESPTOOLPY_FLASHMODE="dio"
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
CONFIG_ESPTOOLPY_FLASHFREQ="80m"
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
CONFIG_ESPTOOLPY_FLASHSIZE="8MB"
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
CONFIG_ESPTOOLPY_BEFORE_RESET=y
# end of Serial flasher config
#
# Partition Table
#
# CONFIG_PARTITION_TABLE_SINGLE_APP is not set
# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_example.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions_example.csv"
CONFIG_PARTITION_TABLE_OFFSET=0x8000
CONFIG_PARTITION_TABLE_MD5=y
# end of Partition Table
#
# ESP32S3-Specific
#
# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_80 is not set
# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_160 is not set
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=240
#
# Cache config
#
# CONFIG_ESP32S3_INSTRUCTION_CACHE_16KB is not set
CONFIG_ESP32S3_INSTRUCTION_CACHE_32KB=y
CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE=0x8000
# CONFIG_ESP32S3_INSTRUCTION_CACHE_4WAYS is not set
CONFIG_ESP32S3_INSTRUCTION_CACHE_8WAYS=y
CONFIG_ESP32S3_ICACHE_ASSOCIATED_WAYS=8
CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_32B=y
CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_SIZE=32
# CONFIG_ESP32S3_INSTRUCTION_CACHE_WRAP is not set
# CONFIG_ESP32S3_DATA_CACHE_16KB is not set
# CONFIG_ESP32S3_DATA_CACHE_32KB is not set
CONFIG_ESP32S3_DATA_CACHE_64KB=y
CONFIG_ESP32S3_DATA_CACHE_SIZE=0x10000
# CONFIG_ESP32S3_DATA_CACHE_4WAYS is not set
CONFIG_ESP32S3_DATA_CACHE_8WAYS=y
CONFIG_ESP32S3_DCACHE_ASSOCIATED_WAYS=8
# CONFIG_ESP32S3_DATA_CACHE_LINE_32B is not set
CONFIG_ESP32S3_DATA_CACHE_LINE_64B=y
CONFIG_ESP32S3_DATA_CACHE_LINE_SIZE=64
# CONFIG_ESP32S3_DATA_CACHE_WRAP is not set
# end of Cache config
CONFIG_ESP32S3_SPIRAM_SUPPORT=y
#
# SPI RAM config
#
CONFIG_SPIRAM_MODE_OCT=y
CONFIG_SPIRAM_TYPE_AUTO=y
#
# PSRAM Clock and CS IO for ESP32S3
#
CONFIG_DEFAULT_PSRAM_CLK_IO=30
CONFIG_DEFAULT_PSRAM_CS_IO=26
# end of PSRAM Clock and CS IO for ESP32S3
CONFIG_SPIRAM_SPEED_80M=y
CONFIG_SPIRAM=y
CONFIG_SPIRAM_BOOT_INIT=y
CONFIG_SPIRAM_USE_CAPS_ALLOC=y
CONFIG_SPIRAM_MEMTEST=y
# end of SPI RAM config
#
# FreeRTOS
#
CONFIG_FREERTOS_HZ=1000
# end of FreeRTOS
#
# Log output
#
CONFIG_LOG_DEFAULT_LEVEL_INFO=y
CONFIG_LOG_DEFAULT_LEVEL=3
CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y
CONFIG_LOG_MAXIMUM_LEVEL=3
CONFIG_LOG_COLORS=y
CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM=y
# end of Log output
#
# LVGL configuration
#
#
# Color settings
#
CONFIG_LV_COLOR_DEPTH_16=y
CONFIG_LV_COLOR_DEPTH=16
CONFIG_LV_COLOR_16_SWAP=y
# end of Color settings
#
# HAL Settings
#
CONFIG_LV_DISP_DEF_REFR_PERIOD=10
# end of HAL Settings
#
# Others
#
CONFIG_LV_USE_PERF_MONITOR=y
CONFIG_LV_PERF_MONITOR_ALIGN_BOTTOM_RIGHT=y
CONFIG_LV_USE_MEM_MONITOR=y
CONFIG_LV_MEM_MONITOR_ALIGN_BOTTOM_LEFT=y
CONFIG_LV_USE_USER_DATA=y
# end of Others
#
# Enable built-in fonts
#
CONFIG_LV_FONT_MONTSERRAT_12=y
CONFIG_LV_FONT_MONTSERRAT_14=y
CONFIG_LV_FONT_MONTSERRAT_16=y
CONFIG_LV_FONT_MONTSERRAT_22=y
CONFIG_LV_FONT_MONTSERRAT_32=y
# end of Enable built-in fonts
#
# Demos
#
CONFIG_LV_USE_DEMO_BENCHMARK=y
# end of Demos
# end of LVGL configuration
#
# LVGL TFT Display controller
#
CONFIG_LV_PREDEFINED_DISPLAY_NONE=y
CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7796S=y
CONFIG_LV_TFT_DISPLAY_PROTOCOL_SPI=y
CONFIG_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED=y
CONFIG_LV_DISPLAY_ORIENTATION=3
CONFIG_LV_PREDEFINED_PINS_NONE=y
CONFIG_LV_TFT_DISPLAY_USER_CONTROLLER_ST7796S=y
CONFIG_CUSTOM_DISPLAY_BUFFER_SIZE=y
CONFIG_CUSTOM_DISPLAY_BUFFER_BYTES=16384
CONFIG_LV_TFT_DISPLAY_SPI_HSPI=y
CONFIG_LV_TFT_DISPLAY_SPI_TRANS_MODE_SIO=y
CONFIG_LV_TFT_DISPLAY_SPI_HALF_DUPLEX=y
CONFIG_LV_TFT_USE_CUSTOM_SPI_CLK_DIVIDER=y
CONFIG_LV_TFT_SPI_CLK_DIVIDER_1=y
CONFIG_LV_TFT_CUSTOM_SPI_CLK_DIVIDER=1
#
# Display Pin Assignments
#
CONFIG_LV_DISP_SPI_MOSI=39
CONFIG_LV_DISPLAY_USE_SPI_MISO=y
CONFIG_LV_DISP_SPI_MISO=38
CONFIG_LV_DISP_SPI_INPUT_DELAY_NS=20
CONFIG_LV_DISP_SPI_CLK=42
CONFIG_LV_DISPLAY_USE_SPI_CS=y
CONFIG_LV_DISP_SPI_CS=46
CONFIG_LV_DISPLAY_USE_DC=y
CONFIG_LV_DISP_PIN_DC=45
CONFIG_LV_DISP_PIN_RST=48
# end of Display Pin Assignments
# end of LVGL TFT Display controller
#
# LVGL Touch controller
#
CONFIG_LV_TOUCH_CONTROLLER=2
CONFIG_LV_TOUCH_CONTROLLER_FT6X06=y
CONFIG_LV_TOUCH_DRIVER_PROTOCOL_I2C=y
CONFIG_LV_TOUCH_I2C_PORT_0=y
# CONFIG_LV_TOUCH_I2C_PORT_1 is not set
#
# Touchpanel (FT6X06) Pin Assignments
#
CONFIG_LV_TOUCH_I2C_SDA=40
CONFIG_LV_TOUCH_I2C_SCL=0
# end of Touchpanel (FT6X06) Pin Assignments
#
# Touchpanel Configuration (FT6X06)
#
CONFIG_LV_FT6X36_SWAPXY=y
CONFIG_LV_FT6X36_INVERT_Y=y
# end of Touchpanel Configuration (FT6X06)
# end of LVGL Touch controller
# end of Component config
3、都设置好后,编译烧录应该就能正常显示和触摸了,但是遇到颜色反色的问题,一般是配置 LV_TFT_DISPLAY_CONTROLLER_ST7796S 的判断,即可在配置选项里面开启这个选项了,选中后显示就正常了。
在st7796s的驱动里面有对这一选项的判断,判断后发送0x21指令给屏幕进行颜色的翻转设置。