Seeeduino Xiao SAMD21 and Waveshare 4.2 inch E-ink display not working

Hi there,
So I don’t see the include of the #include <SPI.h> :bulb:in the code posted ?
Can you add that?
GL :slight_smile: PJ

I added it. Same result as before.

#include <SPI.h>
#include <GxEPD2_BW.h>
#include <Fonts/FreeMonoBold9pt7b.h>

// Pin configuration for Seeeduino Xiao SAMD21
// Display   Seeeduino Xiao SAMD21 Pin
//   BUSY  ->  1
//   RST   ->  2
//   DC    ->  3
//   CS    ->  4
//   CLK   ->  8
//   DIN   ->  10
//   GND   ->  GND
//   VCC   ->  3V3
#define CS_PIN    D4
#define DC_PIN    D3
#define RST_PIN   D2
#define BUSY_PIN  D1
GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(CS_PIN, DC_PIN, RST_PIN, BUSY_PIN));

void setup() {
  Serial.begin(9600);
  display.init();
}

void loop() {
  // For debugging.
  Serial.println("First line of super loop.");

  display.fillScreen(GxEPD_WHITE);
  display.setTextColor(GxEPD_BLACK);
  display.setFont(&FreeMonoBold9pt7b);

  display.setCursor(10, 50);
  display.print("Hello, World!");
  display.display();
  delay(5000);

  display.fillScreen(GxEPD_WHITE);
  display.display();
  delay(5000);

  // For debugging.
  Serial.println("Last line of super loop.");
}

Hi there, Can you post the compiler output you get?
Which GxEPD2_BW.h are you using?
THX
PJ :wink: :v:

GxEPD2 version 1.5.3

Hi there, Can you turn on the verbose output on compile in the file; prefs.
It will show what it’s loading
GL :slight_smile: PJ

what’s important is the first part

FQBN: esp32:esp32:XIAO_ESP32C3
Using board 'XIAO_ESP32C3' from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11
Using core 'esp32' from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11

and the last part.

Using library SPI at version 2.0.0 in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\SPI 
Using library GxEPD2 at version 1.5.3 in folder: D:\Arduino_projects\libraries\GxEPD2 
Using library Adafruit GFX Library at version 1.11.9 in folder: D:\Arduino_projects\libraries\Adafruit_GFX_Library 
Using library Adafruit BusIO at version 1.14.5 in folder: D:\Arduino_projects\libraries\Adafruit_BusIO 
Using library Wire at version 2.0.0 in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\Wire 
"C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\riscv32-esp-elf-gcc\\esp-2021r2-patch5-8.4.0/bin/riscv32-esp-elf-size" -A "C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\7A57673B604F0595FA44B508A76D8A90/sketch_dec31a.ino.elf"
Sketch uses 247294 bytes (18%) of program storage space. Maximum is 1310720 bytes.
Global variables use 28972 bytes (8%) of dynamic memory, leaving 298708 bytes for local variables. Maximum is 327680 bytes.

Also you may only want the one GxEPD2.h installed. i don’t have the 3.3 one installed
HTH
GL :slight_smile: PJ

FQBN: Seeeduino:samd:seeed_XIAO_m0
Using board 'seeed_XIAO_m0' from platform in folder: C:\Users\user\AppData\Local\Arduino15\packages\Seeeduino\hardware\samd\1.8.5
Using core 'arduino' from platform in folder: C:\Users\user\AppData\Local\Arduino15\packages\Seeeduino\hardware\samd\1.8.5
Using library SPI at version 1.0 in folder: C:\Users\user\AppData\Local\Arduino15\packages\Seeeduino\hardware\samd\1.8.5\libraries\SPI 
Using library Adafruit Zero DMA Library at version 1.0.4 in folder: C:\Users\user\AppData\Local\Arduino15\packages\Seeeduino\hardware\samd\1.8.5\libraries\Adafruit_ZeroDMA 
Using library GxEPD2 at version 1.5.3 in folder: C:\Users\user\Documents\Arduino\libraries\GxEPD2 
Using library Adafruit GFX Library at version 1.11.9 in folder: C:\Users\user\Documents\Arduino\libraries\Adafruit_GFX_Library 
Using library Adafruit BusIO at version 1.14.5 in folder: C:\Users\user\Documents\Arduino\libraries\Adafruit_BusIO 
Using library Wire at version 1.0 in folder: C:\Users\user\AppData\Local\Arduino15\packages\Seeeduino\hardware\samd\1.8.5\libraries\Wire 
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-size" -A "C:\\Users\\user\\AppData\\Local\\Temp\\arduino\\sketches\\4D0E698B055FB5E0710727091825CEF5/sketch_dec31a.ino.elf"
Sketch uses 49392 bytes (18%) of program storage space. Maximum is 262144 bytes.

Hi there,
So I see there are some updates to the samd21 Boards. BSP is at 1.8.13
I see your using 1.8.5 , I would try rolling back to 1.8.4 and or Update to the latest and try it.
The SPI may update with the BSP picked I see it’s 1.0 also.
HTH
GL :slight_smile: PJ

I tried version 1.8.4, and a few other older versions. Nothing. I even tried an older version of the IDE. 1.8.19
Also, I don’t see 1.8.13 available

In the Operating Voltage column of the parameter, it says “5V is required for power supply and signal”.
XIAO’s input/output signal is 3.3V. Is this not a problem?

Yes, thanks for the tip. I plugged the VCC into 5V and it partially solved the problem. The Xiao shows up on the serial monitor and I can upload code to it while the display is connected. The partial solution is to power on the Xiao with the display attached, then unplug the display connector and plug it back in again. Then it works as intended. But unfortunately, that’s not practical.
Might be something to do with the 3.3V signal

Maybe a level shifter is needed between XIAO and the display.

1 Like

Just ordered a few. I’ll see how that goes.

Edit: A level shifter may not be the solution since the esp32 also has a 3.3v signal output and I had no trouble running the display with it.

Do you have a data sheet or schematic of the board in the photo in post 20/32?

edit:
I found the schematic.
It appears that when powering the display from the 3V3 pin of the XIAO, the on-board level shifter works to keep the IO voltage level at 3.3 V.
Do not power the display using the 5V pin of the XIAO.

I do not understand what this line describes. Is there an example somewhere?

I have the pin definitions in epdif.h. I don’t have E-ink so I could only check it up to compile. Does this sketch work?
The pin connections are

Display      XIAO samd21
  VCC            3V3
  GND            GND
  DIN(MOSI)      A10
  SCK             A8
  CS              A7
  D/C             A5
  RST             A4
  BUSY            A3

epd4in2.zip (46.8 KB)

I don’t recall exactly which file I took it from but it’s from the GxEPD2 GitHub.
I was at the “throw shit at a wall and see what sticks” stage when I originally wrote it. I stuck with it since it worked with zero issues on my ESP32 (and then I decided to test it with the Xiao). From what I understand, it’s defining where the BUSY, RST, DC, and CS lines are assigned. Along with specifying the Waveshare display.

Same as before except I can upload to it while the display is attached.
Thanks anyway.

I made a mistake in defining the pins in epdif.h. A corrected version is attached.
epd4in2.zip (46.8 KB)

Still nothing.
And now it’s not showing up on any COM port with the display attached :man_facepalming:

In my environment, the attached code compiles and uploads without problems.

Does the COM port show up on a double reset as in the video in post 7?