esp32spi_master驱动ips液晶屏失败

Moderator: ESP_Bob

killerp
Posts: 9
Joined: Sat Nov 21, 2020 5:17 am

esp32spi_master驱动ips液晶屏失败

Postby killerp » Thu Apr 22, 2021 4:01 am

目前我用esp32 idf v3.4的examples/periperals/sp_master/lcd例程,芯片引脚连接正确,代码中也修改为相应的引脚。我使用的是以st7789为控制芯片的液晶屏。在menuconfig->examples_configuration/LCD module type 选择 st7789V 编译烧录后,打印如下信息:

Code: Select all

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x12 (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:4
load:0x3fff0034,len:6916
load:0x40078000,len:14336
load:0x40080400,len:3672
entry 0x40080678
[0;32mI (28) boot: ESP-IDF v4.3-dev-2940-g6e776946d 2nd stage bootloader[0m
[0;32mI (28) boot: compile time 11:01:01[0m
[0;32mI (29) boot: chip revision: 1[0m
[0;32mI (33) boot_comm: chip revision: 1, min. bootloader chip revision: 0[0m
[0;32mI (40) boot.esp32: SPI Speed      : 40MHz[0m
[0;32mI (45) boot.esp32: SPI Mode       : DIO[0m
[0;32mI (49) boot.esp32: SPI Flash Size : 4MB[0m
[0;32mI (54) boot: Enabling RNG early entropy source...[0m
[0;32mI (59) boot: Partition Table:[0m
[0;32mI (63) boot: ## Label            Usage          Type ST Offset   Length[0m
[0;32mI (70) boot:  0 nvs              WiFi data        01 02 00009000 00006000[0m
[0;32mI (77) boot:  1 phy_init         RF data          01 01 0000f000 00001000[0m
[0;32mI (85) boot:  2 factory          factory app      00 00 00010000 00100000[0m
[0;32mI (92) boot: End of partition table[0m
[0;32mI (96) boot_comm: chip revision: 1, min. application chip revision: 0[0m
[0;32mI (104) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=18c58h (101464) map[0m
[0;32mI (148) esp_image: segment 1: paddr=00028c80 vaddr=3ffb0000 size=02a88h ( 10888) load[0m
[0;32mI (152) esp_image: segment 2: paddr=0002b710 vaddr=40080000 size=00404h (  1028) load[0m
[0;32mI (154) esp_image: segment 3: paddr=0002bb1c vaddr=40080404 size=044fch ( 17660) load[0m
[0;32mI (169) esp_image: segment 4: paddr=00030020 vaddr=400d0020 size=185a0h ( 99744) map[0m
[0;32mI (206) esp_image: segment 5: paddr=000485c8 vaddr=40084900 size=07b84h ( 31620) load[0m
[0;32mI (226) boot: Loaded app from partition at offset 0x10000[0m
[0;32mI (226) boot: Disabling RNG early entropy source...[0m
[0;32mI (237) cpu_start: Pro cpu up.[0m
[0;32mI (237) cpu_start: Starting app cpu, entry point is 0x40081010[0m
[0;32mI (0) cpu_start: App cpu up.[0m
[0;32mI (252) cpu_start: Pro cpu start user code[0m
[0;32mI (252) cpu_start: cpu freq: 160000000[0m
[0;32mI (252) cpu_start: Application information:[0m
[0;32mI (256) cpu_start: Project name:     spi_master[0m
[0;32mI (261) cpu_start: App version:      v4.3-dev-2940-g6e776946d[0m
[0;32mI (268) cpu_start: Compile time:     Apr 22 2021 11:02:26[0m
[0;32mI (274) cpu_start: ELF file SHA256:  07e622b42a06ba98...[0m
[0;32mI (280) cpu_start: ESP-IDF:          v4.3-dev-2940-g6e776946d[0m
[0;32mI (287) heap_init: Initializing. RAM available for dynamic allocation:[0m
[0;32mI (294) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM[0m
[0;32mI (300) heap_init: At 3FFB3830 len 0002C7D0 (177 KiB): DRAM[0m
[0;32mI (306) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM[0m
[0;32mI (312) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
[0;32mI (319) heap_init: At 4008C484 len 00013B7C (78 KiB): IRAM[0m
[0;32mI (326) spi_flash: detected chip: generic[0m
[0;32mI (330) spi_flash: flash io: dio[0m
[0;32mI (335) cpu_start: Starting scheduler on PRO CPU.[0m
[0;32mI (0) cpu_start: Starting scheduler on APP CPU.[0m
LCD ID: 00000000
ILI9341 detected.
kconfig: force CONFIG_LCD_TYPE_ST7789V.
LCD ST7789V initialization.
可以看到esp32读取到的芯片id是000000,说明应该是spi通信出问题了。我用stm32的开发板驱动同一块显示屏,显示屏可以正常显示,说明不是显示屏出问题,可能是idf例程的问题。各位有没有说明调试的方法?

killerp
Posts: 9
Joined: Sat Nov 21, 2020 5:17 am

Re: esp32spi_master驱动ips液晶屏失败

Postby killerp » Thu Apr 22, 2021 4:35 am

已经解决了,在devcfg结构体变量中添加标志位 flags=SPI_DEVICE_3WIRE 因为设备的通信方式是三线spi

Code: Select all

    spi_device_interface_config_t devcfg={
#ifdef CONFIG_LCD_OVERCLOCK
        .clock_speed_hz=26*1000*1000,           //Clock out at 26 MHz
#else
        .clock_speed_hz=10*1000*1000,           //Clock out at 10 MHz
#endif
        .mode=0,                                //SPI mode 0
        .spics_io_num=PIN_NUM_CS,               //CS pin
        .queue_size=7,                          //We want to be able to queue 7 transactions at a time
        .pre_cb=lcd_spi_pre_transfer_callback,  //Specify pre-transfer callback to handle D/C line

        .flags=SPI_DEVICE_3WIRE,//!
    };

qixin123
Posts: 15
Joined: Tue Jul 20, 2021 4:13 pm

Re: esp32spi_master驱动ips液晶屏失败

Postby qixin123 » Sun Aug 01, 2021 2:55 am

我也出现了相同的问题 参考您的解决方式并没有解决,能否提供一些其他的思路。

Who is online

Users browsing this forum: No registered users and 26 guests