8000 立创实战派esp32s3 在arduino ide上使用此库自带的lvgl历程时,程序运行但屏幕无法显示,请大佬帮帮忙 · Issue #129 · esp-arduino-libs/ESP32_Display_Panel · GitHub
[go: up one dir, main page]

Skip to content

立创实战派esp32s3 在arduino ide上使用此库自带的lvgl历程时,程序运行但屏幕无法显示,请大佬帮帮忙 #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
chunyu-just opened this issue Nov 26, 2024 · 3 comments

Comments

@chunyu-just
Copy link
chunyu-just commented Nov 26, 2024

程序编译下载完后的串口信息为

22:38:59.682 -> D (88) ESP_Panel: Begin IO expander
22:38:59.682 -> D (92) ESP_Panel: Begin LCD
22:38:59.682 -> D (94) ESP_PanelBus_SPI: Create panel io @0x3fcecc70
22:38:59.682 -> D (98) st7789: new st7789 panel @0x3fced248
22:38:59.682 -> I (102) st7789: LCD panel create success, version: 0.0.1
22:38:59.727 -> D (128) ESP_PanelLcd: Begin start
22:38:59.803 -> D (229) st7789: send init commands success
22:38:59.803 -> D (229) ESP_PanelLcd: Begin end
22:38:59.803 -> D (230) ESP_Panel: Begin backlight
22:38:59.803 -> D (230) ESP_PanelBacklight: begin start
22:38:59.803 -> D (231) ESP_PanelBacklight: Use PWM(LEDC) to control
22:38:59.803 -> D (236) ESP_PanelBacklight: begin end
22:38:59.835 -> D (240) ESP_PanelBacklight: Set brightness to 0%
22:38:59.835 -> D (244) ESP_Panel: Panel begin end
22:38:59.835 -> Initialize LVGL
22:38:59.881 -> Create UI
22:38:59.881 -> LVGL porting example end
22:38:59.881 -> IDLE loop
22:39:00.921 -> IDLE loop
22:39:01.882 -> IDLE loop
22:39:02.898 -> IDLE loop

应该是程序能够运行了,但是我的开发板的屏幕不显示,黑屏,背光也没有
立创实战派s3版本的tft屏幕(使用st7789驱动)的原理图为
image

image
对应引脚的配置代码为

#define ESP_PANEL_USE_CUSTOM_BOARD       (1)         // 0/1

#if ESP_PANEL_USE_CUSTOM_BOARD

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////// Please update the following macros to configure the LCD panel /////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Set to 1 when using an LCD panel */
#define ESP_PANEL_USE_LCD           (1)     // 0/1

#if ESP_PANEL_USE_LCD
/**
 * LCD Controller Name. Choose one of the following:
 *      - EK9716B
 *      - GC9A01, GC9B71, GC9503
 *      - ILI9341
 *      - NV3022B
 *      - SH8601
 *      - SPD2010
 *      - ST7262, ST7701, ST7789, ST7796, ST77916, ST77922
 */
#define ESP_PANEL_LCD_NAME          ST7789

/* LCD resolution in pixels */
#define ESP_PANEL_LCD_WIDTH         (240)
#define ESP_PANEL_LCD_HEIGHT        (320)

/* LCD Bus Settings */
/**
 * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance.
 * It is useful if other devices use the same host. Please ensure that the host is initialized only once.
 *
 * Set to 1 if only the RGB interface is used without the 3-wire SPI interface,
 */
#define ESP_PANEL_LCD_BUS_SKIP_INIT_HOST    (0)     // 0/1
/**
 * LCD Bus Type. Choose one of the following:
 *      - ESP_PANEL_BUS_TYPE_I2C (not ready)
 *      - ESP_PANEL_BUS_TYPE_SPI
 *      - ESP_PANEL_BUS_TYPE_QSPI
 *      - ESP_PANEL_BUS_TYPE_I80 (not ready)
 *      - ESP_PANEL_BUS_TYPE_RGB (only supported for ESP32-S3)
 */
#define ESP_PANEL_LCD_BUS_TYPE      (ESP_PANEL_BUS_TYPE_SPI)
/**
 * LCD Bus Parameters.
 *
 * Please refer to https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/lcd.html and
 * https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/index.html for more details.
 *
 */
#if ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI

    #define ESP_PANEL_LCD_BUS_HOST_ID           (1)     // Typically set to 1
    #define ESP_PANEL_LCD_SPI_IO_CS             (-1)
#if !ESP_PANEL_LCD_BUS_SKIP_INIT_HOST
    #define ESP_PANEL_LCD_SPI_IO_SCK            (41)
    #define ESP_PANEL_LCD_SPI_IO_MOSI           (40)
    #define ESP_PANEL_LCD_SPI_IO_MISO           (-1)    // -1 if not used
#endif
    #define ESP_PANEL_LCD_SPI_IO_DC             (39)
    #define ESP_PANEL_LCD_SPI_MODE              (0)     // 0/1/2/3, typically set to 0
    #define ESP_PANEL_LCD_SPI_CLK_HZ            (40 * 1000 * 1000)
                                                        // Should be an integer divisor of 80M, typically set to 40M
    #define ESP_PANEL_LCD_SPI_TRANS_QUEUE_SZ    (10)    // Typically set to 10
    #define ESP_PANEL_LCD_SPI_CMD_BITS          (8)     // Typically set to 8
    #define ESP_PANEL_LCD_SPI_PARAM_BITS        (8)     // Typically set to 8

// 拓展io芯片配置
/* Set to 0 if not using IO Expander */
#define ESP_PANEL_USE_EXPANDER          (1)         // 0/1
#if ESP_PANEL_USE_EXPANDER
/**
 * IO expander name. Choose one of the following:
 *      - CH422G
 *      - HT8574
 *      - TCA95xx_8bit
 *      - TCA95xx_16bit
 */
#define ESP_PANEL_EXPANDER_NAME         TCA95xx_8bit

/* IO expander Settings */
/**
 * If set to 1, the driver will skip to initialize the corresponding host. Users need to initialize the host in advance.
 * It is useful if other devices use the same host. Please ensure that the host is initialized only once.
 */
#define ESP_PANEL_EXPANDER_SKIP_INIT_HOST       (0)     // 0/1
/* IO expander parameters */
#define ESP_PANEL_EXPANDER_HOST_ID              (0)     // Typically set to 0
#define ESP_PANEL_EXPANDER_I2C_ADDRESS          (0x19)  // The actual I2C address. Even for the same model of IC,
                                                        // the I2C address may be different, and confirmation based on
                                                        // the actual hardware connection is required
#if !ESP_PANEL_EXPANDER_SKIP_INIT_HOST
    #define ESP_PANEL_EXPANDER_I2C_CLK_HZ       (400 * 1000)
                                                        // Typically set to 400K
    #define ESP_PANEL_EXPANDER_I2C_SCL_PULLUP   (1)     // 0/1
    #define ESP_PANEL_EXPANDER_I2C_SDA_PULLUP   (1)     // 0/1
    #define ESP_PANEL_EXPANDER_I2C_IO_SCL       (2)
    #define ESP_PANEL_EXPANDER_I2C_IO_SDA       (1)
#endif

他的屏幕的片选引脚使用拓展io来控制(这里我不会在配置文件中设置了,所以我片选引脚设置的 -1)
arduino上的下载方式能是设置为
image
esp32核心版本为
image
相关库版本为
image
image
我将代码上传到此处
Porting_test.zip

我想使用arduino来点亮这个开发板的屏幕已经好多天了,试了很多方法都没成功,希望有朋友能够看看我的代码配置,提供些建议或者解决方法,非常感谢

@Lzw655
Copy link
Collaborator
Lzw655 commented Nov 27, 2024

@chunyu-just 你好!

我看了下附件里的工程(Porting_test.zip),关于背光没有亮的问题,是因为在文件 ESP_Panel_Board_Custom.h 中设置了 ESP_PANEL_BACKLIGHT_IDLE_OFF1,它会使得开发板驱动初始化时默认关闭背光,在如下 LOG 中可以看到相关信息:22:38:59.835 -> D (240) ESP_PanelBacklight: Set brightness to 0%

请将 ESP_PANEL_BACKLIGHT_IDLE_OFF 设置为 0,然后再看下显示是否正常。

@chunyu-just
Copy link
Author
chunyu-just commented Nov 27, 2024

@Lzw655

@chunyu-just 你好!

我看了下附件里的工程(Porting_test.zip),关于背光没有亮的问题,是因为在文件 ESP_Panel_Board_Custom.h 中设置了 ESP_PANEL_BACKLIGHT_IDLE_OFF1,它会使得开发板驱动初始化时默认关闭背光,在如下 LOG 中可以看到相关信息:22:38:59.835 -> D (240) ESP_PanelBacklight: Set brightness to 0%

请将 ESP_PANEL_BACKLIGHT_IDLE_OFF 设置为 0,然后再看下显示是否正常。

谢谢你的建议,我修改了对应的参数后,背光可以亮了,但是屏幕还是没有显示

17:50:24.659 -> Initialize panel device
17:50:24.659 -> D (6) ESP_Panel: Panel init start
17:50:24.693 -> D (7) ESP_Panel: Use LCD
17:50:24.747 -> D (57) ESP_Panel: Use SPI bus
17:50:24.747 -> D (57) ESP_Panel: Create LCD bus
17:50:24.747 -> D (57) ESP_PanelHost: Add host SPI[1]
17:50:24.747 -> D (57) ESP_Panel: Create LCD device
17:50:24.747 -> D (58) ESP_Panel: Use backlight
17:50:24.747 -> D (61) ESP_Panel: Create backlight device
17:50:24.747 -> D (64) ESP_Panel: Use IO expander
17:50:24.747 -> D (67) ESP_PanelHost: Add host I2C[0]
17:50:24.747 -> D (71) ESP_Panel: Initialize host
17:50:24.765 -> D (74) ESP_PanelHost: Initialize host I2C[0]
17:50:24.765 -> D (78) ESP_PanelHost: Initialize host SPI[1]
17:50:24.765 -> D (82) ESP_Panel: Panel init end
17:50:24.765 -> D (85) ESP_Panel: Panel begin start
17:50:24.765 -> D (88) ESP_Panel: Begin IO expander
17:50:24.810 -> D (92) ESP_Panel: Begin LCD
17:50:24.810 -> D (94) ESP_PanelBus_SPI: Create panel io @0x3fcecc70
17:50:24.810 -> D (94) ESP_PanelBus_SPI: Create panel io @0x3fcecc70
17:50:24.810 -> D (98) st7789: new st7789 panel @0x3fced248
17:50:24.810 -> I (102) st7789: LCD panel create success, version: 0.0.1
17:50:24.810 -> D (128) ESP_PanelLcd: Begin start
17:50:25.028 -> D (229) st7789: send init commands success
17:50:25.028 -> D (229) ESP_PanelLcd: Begin end
17:50:25.028 -> D (230) ESP_Panel: Begin backlight
17:50:25.028 -> D (230) ESP_PanelBacklight: begin start
17:50:25.028 -> D (231) ESP_PanelBacklight: Use PWM(LEDC) to control
17:50:25.028 -> D (236) ESP_PanelBacklight: begin end
17:50:25.028 -> D (240) ESP_PanelBacklight: Set brightness to 100%
17:50:25.028 -> D (244) ESP_Panel: Panel begin end
17:50:25.028 -> Initialize LVGL
17:50:25.028 -> Create UI
17:50:25.028 -> LVGL porting example end
17:50:25.028 -> IDLE loop
17:50:25.949 -> IDLE loop
17:50:26.985 -> IDLE loop

@Lzw655
Copy link
Collaborator
Lzw655 commented Nov 27, 2024

可能的原因:LCD 的 CS 由 IO 扩展芯片的引脚控制且默认拉高,但是主程序并未控制 IO 扩展芯片将 CS 引脚拉低(LCD 的 SPI 通信要求)

请在文件 ESP_Panel_Board_Custom.h 设置 ESP_PANEL_USE_EXPANDER0,并在 panel->begin(); 之前参考示例 (https://github.com/esp-arduino-libs/ESP32_IO_Expander/blob/master/README.md#examples) 来控制 IO 扩展芯片 CS 引脚

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0