esp32无法驱动墨水屏

esp32基于arduinoIDE下编程无法驱动SPI墨水屏,运用的库是GxEPD2库,感觉程序那啥的也没问题,换了好多种程序了都不行
这是其中的代码部分,我自己改的

#include <GxEPD2.h>
//#include <GxEPD2_3C.h>
//#include <GxEPD2_7C.h>
#include <GxEPD2_BW.h>
#include <GxEPD2_EPD.h>
#include <GxEPD2_GFX.h>
#define MAX_DISPLAY_BUFFER_SIZE 65536ul // e.g.
#define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8))
GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH029A1 128x296, SSD1608 (IL3820)
const char HelloWorld[] = "Hello World!";
void setup() 
{
  // put your setup code here, to run once:
  display.init(115200);  // 初始化屏幕
  display.setRotation(1);  // 设置屏幕旋转方向,分别有0,1,2,3这四个方向
  display.setTextWrap(false); // 设置文本是否自动换行,false则为不自动换行,如果文本溢出则显示异常或者不显示
  int16_t tbx, tby;  // 文本框的x,y坐标
  uint16_t tbw, tbh; // 文本框的宽度,高度
  display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);// 计算渲染后的文本框的长度和宽度,用于居中
  uint16_t x = ((display.width() - tbw) / 2) - tbx; // 文本框的x坐标
  uint16_t y = ((display.height() - tbh) / 2) - tby; // 文本框的y坐标
  display.setFullWindow(); 
  display.firstPage();
  do
  {
    display.fillScreen(GxEPD_WHITE);
    display.setCursor(x, y);
    display.print(HelloWorld);
  }
  while (display.nextPage());
}

void loop() {
  // put your main code here, to run repeatedly:

}

程序应该没问题,引脚也是按照指示接的DIN-23,CLK-18,CS-5,DC-17,RST-16,busy-4,应该没问题啊

img

编译上传之后串口感觉就不对劲了

img

开发板配置

img


到底是哪个环节出了问题,研究了好久

建议先跑个厂家提供的例程确定 硬件好坏


void ds_screen_gpio_init(){
    gpio_config_t io_conf;
    //disable interrupt
    io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
    //set as output mode
    io_conf.mode = GPIO_MODE_OUTPUT;
    //bit mask of the pins that you want to set,e.g.GPIO18/19
    io_conf.pin_bit_mask = SCREEN_GPIO_OUTPUT_CS_SEL;
    //disable pull-down mode
    io_conf.pull_down_en = 0;
    //disable pull-up mode
    io_conf.pull_up_en = 0;
    //configure GPIO with the given settings
    gpio_config(&io_conf);//初始化片选
 
    //bit mask of the pins that you want to set,e.g.GPIO18/19
    io_conf.pin_bit_mask = SCREEN_GPIO_OUTPUT_DC_SEL;
    //configure GPIO with the given settings
    gpio_config(&io_conf);//初始化D/C
 
    //bit mask of the pins that you want to set,e.g.GPIO18/19
    io_conf.pin_bit_mask = SCREEN_GPIO_OUTPUT_RES_SEL;
    //configure GPIO with the given settings
    gpio_config(&io_conf);//复位
 
    io_conf.intr_type = GPIO_INTR_NEGEDGE;//这里为啥要用下降沿来进行中断触发,存疑
    //bit mask of the pins, use GPIO4/5 here
    io_conf.pin_bit_mask = SCREEN_GPIO_INTPUT_BUSY_SEL;
    //set as input mode    
    io_conf.mode = GPIO_MODE_INPUT;
    //enable pull-up mode
    io_conf.pull_up_en = 1;
    gpio_config(&io_conf);
   
}

esp32按理是可以驱动墨水屏的。主要参考厂家给的源码,不过就是STM32的程序就是,基本逻辑差不了,拿过来改一下就可以了,其次就是仔细查看芯片手册。现在你的程序不行,说明代码还是存在问题的,建议根据具体的错误和现象,对照手册进行检查。其次可以再次检查下你使用的引脚是否正确。
具体的实例代码,你网上找下其他博文看下:
ESP32开发——SPI驱动水墨屏:https://blog.csdn.net/weixin_59288228/article/details/129711173

检查一下驱动版本是否匹配,引脚是否连接正确

要保证ESP32 开发板和串口设置对了才行,顺便检查下 ESP32 有没有连接到 USB 线