Skip to content

Commit

Permalink
Merge pull request #256 from Lzw655/bsp/update_s3-lcd-ev-board
Browse files Browse the repository at this point in the history
bsp: update s3-lcd-ev-board
  • Loading branch information
tore-espressif authored Dec 13, 2023
2 parents c92774c + 6697926 commit a966ec3
Show file tree
Hide file tree
Showing 19 changed files with 491 additions and 201 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ description: ESP-BSP SquareLine LVGL Example
targets:
- esp32s3
dependencies:
idf: ">=4.4"
esp32_s3_lcd_ev_board: "*"
4 changes: 2 additions & 2 deletions SquareLine/boards/esp32_s3_lcd_ev_board/manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name":"ESP32-S3-LCD-EV-BOARD",
"version":"1.0.0",
"version":"2.0.0",
"mcu":"ESP32S3",

"screen_width":"800",
"screen_height":"480",
"screen_color_swap":false,

"short_description":"ESP32-S3-LCD-EV-BOARD is a development board for evaluating and verifying ESP32-S3 screen interactive applications. It has the functions of touch screen interaction and voice interaction.",
"long_description":"ESP32-S3-LCD-EV-BOARD has an ESP32-S3-WROOM-1 module with built-in 16 MB Flash and 8 MB PSRAM. It features onboard audio codec + audio amplifier and onboard dual microphone pickup. It uses USB type-C interface for download and debugging. ESP32-S3-LCD-EV-BOARD can be used with different screen sub boards with various screen sizes and resolutions, and supports RGB, 8080, SPI, I2C interface screens.",
"long_description":"ESP32-S3-LCD-EV-BOARD has an ESP32-S3-WROOM-1 module with built-in 16 MB Flash and 8/16 MB PSRAM. It features onboard audio codec + audio amplifier and onboard dual microphone pickup. It uses USB type-C interface for download and debugging. ESP32-S3-LCD-EV-BOARD can be used with different screen sub boards with various screen sizes and resolutions, and supports RGB, 8080, SPI, I2C interface screens.",

"placeholders":
{
Expand Down
11 changes: 8 additions & 3 deletions SquareLine/boards/esp32_s3_lcd_ev_board/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
#
CONFIG_IDF_TARGET="esp32s3"
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF=y
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_COMPILER_OPTIMIZATION_PERF=y
CONFIG_SPIRAM=y
CONFIG_SPIRAM_MODE_OCT=y
CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y
CONFIG_SPIRAM_RODATA=y
CONFIG_SPIRAM_SPEED_80M=y
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
CONFIG_ESP32S3_DATA_CACHE_64KB=y
CONFIG_ESP32S3_DATA_CACHE_LINE_64B=y
CONFIG_FREERTOS_HZ=1000
CONFIG_BSP_LCD_RGB_BUFFER_NUMS=2
CONFIG_BSP_LCD_RGB_BOUNCE_BUFFER_MODE=y
CONFIG_BSP_DISPLAY_LVGL_AVOID_TEAR=y
CONFIG_BSP_DISPLAY_LVGL_DIRECT_MODE=y
CONFIG_LV_MEM_CUSTOM=y
CONFIG_LV_MEMCPY_MEMSET_STD=y
CONFIG_LV_USE_PERF_MONITOR=y
CONFIG_LV_USE_PERF_MONITOR=y
CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM=y
21 changes: 21 additions & 0 deletions bsp/esp32_s3_lcd_ev_board/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,24 @@
* Add new APIs for touch in `bsp/touch.h`
* Add new APIs for spiffs, audio in `bsp/esp32_s3_lcd_ev_board.h`
* Add new APIs for ADC in `bsp/esp32_s3_lcd_ev_board.h`

## v3.0.0 - 2023-12-02

### Bugfix

* Use `on_bounce_frame_finish` instead of `on_vsync` when enabling RGB bounce buffer mode.
* Fix some issues when enabling anti-tearing and rotation

### Features

* Configurations:
* Support to set the pinned core for LVGL task
* Implementations:
* Support ESP32-S3-WROOM-1-N16R16V module
* Add warning for compiling and running when using `ESP-IDF` version `<5.1.2`

### Dependencies

* Update the version of `ESP-IDF` to `>5.0.1`
* Use `esp_lcd_gc9503` version `^1` when using `ESP-IDF` version `<5.1.2`
* Use `esp_lcd_gc9503` version `^3` when using `ESP-IDF` version `>=5.1.2`
2 changes: 1 addition & 1 deletion bsp/esp32_s3_lcd_ev_board/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ idf_component_register(
INCLUDE_DIRS "include"
PRIV_INCLUDE_DIRS "priv_include"
REQUIRES driver esp_lcd esp_adc
PRIV_REQUIRES esp_timer spiffs
PRIV_REQUIRES esp_timer spiffs esp_psram
)
9 changes: 8 additions & 1 deletion bsp/esp32_s3_lcd_ev_board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,21 @@ menu "Board Support Package"
help
The Board Support Package will create a task that will periodically handle LVGL operation in lv_timer_handler().

config BSP_DISPLAY_LVGL_TASK_CORE_ID
int "LVGL task pinned core ID"
default -1
range -1 1
help
Core to pin LVGL task. -1 means no pinning.

config BSP_DISPLAY_LVGL_TASK_DELAY
int "LVGL task minimum delay time (ms)"
default 10
range 1 100
help
Minimum delay time for LVGL task. It should be larger if the task watchdog is triggered frequently.

config BSP_DISPLAY_LVGL_TASK_STACK_SIZE
config BSP_DISPLAY_LVGL_TASK_STACK_SIZE_KB
int "LVGL task stack size (KB)"
default 4
help
Expand Down
16 changes: 14 additions & 2 deletions bsp/esp32_s3_lcd_ev_board/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

ESP32-S3-LCD-EV-Board is a development board for evaluating and verifying ESP32-S3 screen interactive applications. It has the functions of touch screen interaction and voice interaction. The development board has the following characteristics:

* Onboard ESP32-S3-WROOM-1 module, with built-in 16 MB Flash + 8 MB PSRAM
* Onboard ESP32-S3-WROOM-1 module, with built-in 16 MB Flash + 8/16 MB PSRAM
* Onboard audio codec + audio amplifier
* Onboard dual microphone pickup
* USB type-C interface download and debugging
Expand All @@ -30,7 +30,7 @@ Here are some useful configurations in menuconfig that can be customed by user:
* `BSP_LCD_RGB_REFRESH_MODE`: Choose the refresh mode for the RGB LCD.
* `BSP_LCD_RGB_REFRESH_AUTO`: Use the most common method to refresh the LCD.
* `BSP_LCD_RGB_REFRESH_MANUALLY`: Refresh the LCD within a dedicated task. This can help manage PSRAM bandwidth.
* `BSP_LCD_RGB_BOUNCE_BUFFER_MODE`: Enabling bounce buffer mode can lead to a higher PCLK frequency at the expense of increased CPU consumption. **This mode is particularly useful when dealing with screen drift, especially in scenarios involving Wi-Fi usage or writing to Flash memory. For more detailed information, refer to the documentation [here](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/lcd.html#bounce-buffer-with-single-psram-frame-buffer).** This feature should be used in conjunction with `ESP32S3_DATA_CACHE_LINE_64B` configuration.
* `BSP_LCD_RGB_BOUNCE_BUFFER_MODE`: Enabling bounce buffer mode can lead to a higher PCLK frequency at the expense of increased CPU consumption. **This mode is particularly useful when dealing with [screen drift](https://docs.espressif.com/projects/esp-faq/en/latest/software-framework/peripherals/lcd.html#why-do-i-get-drift-overall-drift-of-the-display-when-esp32-s3-is-driving-an-rgb-lcd-screen), especially in scenarios involving Wi-Fi usage or writing to Flash memory.** This feature should be used in conjunction with `ESP32S3_DATA_CACHE_LINE_64B` configuration. For more detailed information, refer to the [documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/lcd.html#bounce-buffer-with-single-psram-frame-buffer).
* `BSP_DISPLAY_LVGL_BUF_CAPS`: Select the memory type for the LVGL buffer. Internal memory offers better performance.
* `BSP_DISPLAY_LVGL_BUF_HEIGHT`: Set the height of the LVGL buffer, with its width aligning with the LCD's width. The default value is 100, decreasing it can lower memory consumption.
* `BSP_DISPLAY_LVGL_AVOID_TEAR`: Avoid tearing effect by using multiple buffers. This requires setting `BSP_LCD_RGB_BUFFER_NUMS` to a value greater than 1.
Expand All @@ -42,3 +42,15 @@ Here are some useful configurations in menuconfig that can be customed by user:
* `BSP_DISPLAY_LVGL_ROTATION_90`: 90-degree rotation.
* `BSP_DISPLAY_LVGL_ROTATION_180`: 180-degree rotation.
* `BSP_DISPLAY_LVGL_ROTATION_270`: 270-degree rotation.

Based on the above configurations, there are three different anti-tearing modes can be used:

* RGB double-buffer + LVGL full-refresh mode:
* Set `BSP_LCD_RGB_BUFFER_NUMS` to `2`
* Enable `BSP_DISPLAY_LVGL_AVOID_TEAR` and `BSP_DISPLAY_LVGL_FULL_REFRESH`
* RGB double-buffer + LVGL direct-mode:
* Set `BSP_LCD_RGB_BUFFER_NUMS` to `2`
* Enable `BSP_DISPLAY_LVGL_AVOID_TEAR` and `BSP_DISPLAY_LVGL_DIRECT_MODE`
* RGB triple-buffer + LVGL full-refresh mode:
* Set `BSP_LCD_RGB_BUFFER_NUMS` to `3`
* Enable `BSP_DISPLAY_LVGL_AVOID_TEAR` and `BSP_DISPLAY_LVGL_FULL_REFRESH`
10 changes: 7 additions & 3 deletions bsp/esp32_s3_lcd_ev_board/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: "2.0.0~2"
version: "2.1.0"
description: Board Support Package for ESP32-S3-LCD-EV-Board
url: https://github.com/espressif/esp-bsp/tree/master/bsp/esp32_s3_lcd_ev_board

targets:
- esp32s3

dependencies:
idf: ">=5.0"
idf: ">=5.0.1"

esp_lcd_touch_gt1151:
version: "^1"
Expand All @@ -29,7 +29,11 @@ dependencies:
public: true

esp_lcd_gc9503:
version: "^1"
matches:
- if: "idf_version <5.1.2"
version: "^1"
- if: "idf_version >=5.1.2"
version: "^3"
public: true

esp_codec_dev:
Expand Down
11 changes: 10 additions & 1 deletion bsp/esp32_s3_lcd_ev_board/include/bsp/esp32_s3_lcd_ev_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#define BSP_I2C_SCL (GPIO_NUM_18)
#define BSP_I2C_SDA (GPIO_NUM_8)

// Pins for board using ESP32-S3-WROOM-1-N16R16V
#define BSP_I2C_SCL_R16 (GPIO_NUM_48)
#define BSP_I2C_SDA_R16 (GPIO_NUM_47)

/* Audio */
#define BSP_I2S_SCLK (GPIO_NUM_16)
#define BSP_I2S_MCLK (GPIO_NUM_5)
Expand Down Expand Up @@ -62,6 +66,10 @@
#define BSP_LCD_SUB_BOARD_2_3_DATA14 (GPIO_NUM_2)
#define BSP_LCD_SUB_BOARD_2_3_DATA15 (GPIO_NUM_1)

// Pins for board using ESP32-S3-WROOM-1-N16R16V
#define BSP_LCD_SUB_BOARD_2_3_DATA6_R16 (GPIO_NUM_8)
#define BSP_LCD_SUB_BOARD_2_3_DATA7_R16 (GPIO_NUM_18)

#define BSP_LCD_SUB_BOARD_2_SPI_CS (IO_EXPANDER_PIN_NUM_1)
#define BSP_LCD_SUB_BOARD_2_SPI_SCK (IO_EXPANDER_PIN_NUM_2)
#define BSP_LCD_SUB_BOARD_2_SPI_SDO (IO_EXPANDER_PIN_NUM_3)
Expand Down Expand Up @@ -282,7 +290,8 @@ esp_err_t bsp_audio_poweramp_enable(bool enable);
#define BSP_LCD_SUB_BOARD_2_H_RES (480)
#define BSP_LCD_SUB_BOARD_2_V_RES (480)

#define SUB_BOARD2_800_480_PANEL_60HZ_RGB_TIMING() GC9503_480_480_PANEL_60HZ_RGB_TIMING()
#define SUB_BOARD2_480_480_PANEL_60HZ_RGB_TIMING() GC9503_480_480_PANEL_60HZ_RGB_TIMING()
#define SUB_BOARD2_480_480_PANEL_SCL_ACTIVE_EDGE (0) // Rising edge, 1: Falling edge

#define BSP_LCD_SUB_BOARD_3_H_RES (800)
#define BSP_LCD_SUB_BOARD_3_V_RES (480)
Expand Down
26 changes: 26 additions & 0 deletions bsp/esp32_s3_lcd_ev_board/priv_include/bsp_lvgl_port.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,36 @@
extern "C" {
#endif

/**
* @brief Initialize LVGL port
*
* @param[in] lcd: LCD panel handle
* @param[in] tp: Touch handle
* @param[out] disp: LVGL display device
* @param[out] indev: LVGL input device
*
* @return
* - ESP_OK: Success
* - ESP_ERR_INVALID_ARG: Invalid argument
* - Others: Fail
*/
esp_err_t bsp_lvgl_port_init(esp_lcd_panel_handle_t lcd, esp_lcd_touch_handle_t tp, lv_disp_t **disp, lv_indev_t **indev);

/**
* @brief Take LVGL mutex
*
* @param[in] timeout_ms: Timeout in [ms]. 0 will block indefinitely.
*
* @return
* - true: Mutex was taken
* - false: Mutex was NOT taken
*/
bool bsp_lvgl_port_lock(uint32_t timeout_ms);

/**
* @brief Give LVGL mutex
*
*/
void bsp_lvgl_port_unlock(void);

#ifdef __cplusplus
Expand Down
46 changes: 46 additions & 0 deletions bsp/esp32_s3_lcd_ev_board/priv_include/bsp_probe.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
MODULE_TYPE_UNKNOW = 0,
MODULE_TYPE_R8, /*!< ESP32-S3-WROOM-1-N16R8 */
MODULE_TYPE_R16, /*!< ESP32-S3-WROOM-1-N16R16V */
} bsp_module_type_t;

typedef enum {
SUB_BOARD_TYPE_UNKNOW = 0,
SUB_BOARD_TYPE_2_480_480, /*!< Sub-board 2 with 480x480 LCD (GC9503), Touch (FT5x06) */
SUB_BOARD_TYPE_3_800_480, /*!< Sub-board 3 with 800x480 LCD (ST7262), Touch (GT1151) */
} bsp_sub_board_type_t;

/**
* @brief Get module type
*
* @return
* - MODULE_TYPE_UNKNOW: Unknow module
* - MODULE_TYPE_R8: ESP32-S3-WROOM-1-N16R8
* - MODULE_TYPE_R16: ESP32-S3-WROOM-1-N16R16V
*/
bsp_module_type_t bsp_probe_module_type(void);

/**
* @brief Get sub-board type
*
* @return
* - SUB_BOARD_TYPE_UNKNOW: Unknow sub-board
* - SUB_BOARD_TYPE_2_480_480: Sub-board 2 with 480x480 LCD (GC9503), Touch (FT5x06)
* - SUB_BOARD_TYPE_3_800_480: Sub-board 3 with 800x480 LCD (ST7262), Touch (GT1151)
*/
bsp_sub_board_type_t bsp_probe_sub_board_type(void);

#ifdef __cplusplus
}
#endif
35 changes: 0 additions & 35 deletions bsp/esp32_s3_lcd_ev_board/priv_include/bsp_sub_board.h

This file was deleted.

Loading

0 comments on commit a966ec3

Please sign in to comment.