Skip to content

Commit

Permalink
bsp: support s3-lcd-ev-board with ESP32-S3-WROOM-1-N16R16V
Browse files Browse the repository at this point in the history
  • Loading branch information
Lzw655 committed Dec 2, 2023
1 parent ba557d9 commit 57ccd1e
Show file tree
Hide file tree
Showing 13 changed files with 383 additions and 173 deletions.
19 changes: 19 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,22 @@
* 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

### Dependencies

* Update the version of `ESP-IDF` to `>5.0.4,!=5.1.1`
* Update the version of `esp_lcd_gc9503` to `^3`
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`
6 changes: 3 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: "3.0.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.4,!=5.1.1"

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

esp_lcd_gc9503:
version: "^1"
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 57ccd1e

Please sign in to comment.