Xiao Nrf52840 and Waveshare 4.2 inch E-Paper display Success & Solid Display and Low Power

Here is the Demo, Display Library example for SPI e-paper panels for sale on SEEED Studio from Dalian Good Display and boards from Waveshare. Requires HW SPI and Adafruit_GFX.
Adapted from GxEPD2_U8G2_Fonts_Example.ino

Notes, edit the three files , compile , upload and GO!

// mapping of my Seeed Studio for Xiao Nrf52840 Sense (previous default SPI pins)
BUSY → 4, RST → 5, DC → 6, CS-> 8, CLK → 9, DIN → 11

#define GxEPD2_DRIVER_CLASS GxEPD2_420_GDEY042T81 // GDEY042T81 400x300, SSD1683 (no inking)

U8G2_FOR_ADAFRUIT_GFX u8g2Fonts;
GxEPD2_BW<GxEPD2_420_GDEY042T81,GxEPD2_420_GDEY042T81 ::HEIGHT> display(GxEPD2_420_GDEY042T81 (/CS=D8/ 7, /DC=D3/ 5, /RST=D4/ 4, /BUSY=D2/ 3));

Can’t wait to Use this with the IMU to display and power down while it still has an image on it… REALLY Cool , Like the Latest “Temp reading” Dynamically updated and Statically Displayed at the same time.
WOW… :heart_eyes: Menu’s can be displayed while it’s a SLEEEEP! :sleeping: :point_left: :grin:
What about “Touch Screen Wake-UP?” NEXT!!!

Here is the Zip of the above demo code.
GxEPD2_U8G2_Fonts_Example.ino.zip (90.1 KB)

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 1.0 in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.1\libraries\Wire 
Using library SPI at version 1.0 in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.1\libraries\SPI 
Using library U8g2_for_Adafruit_GFX at version 1.8.0 in folder: D:\Arduino_projects\libraries\U8g2_for_Adafruit_GFX 
Using library Adafruit TinyUSB Library at version 1.7.0 in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.1\libraries\Adafruit_TinyUSB_Arduino 
"C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\arm-none-eabi-gcc\\9-2019q4/bin/arm-none-eabi-size" -A "C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\97F2F19BDF35949AB1C5D9C6B2C460F0/GxEPD2_U8G2_Fonts_Example.ino.elf"
Sketch uses 91280 bytes (11%) of program storage space. Maximum is 811008 bytes.
Global variables use 22836 bytes (9%) of dynamic memory, leaving 214732 bytes for local variables. Maximum is 237568 bytes.

Note E-paper requires the use of a frame buffer, in most cases. Microcontrollers with little :grin: :pinching_hand: RAM or SRAM won’t make the Lift. :face_with_peeking_eye: 15K buffer and 15K code, your out-a-space :alien:
All the M4 micros can do the job easy.

HTH
GL :slight_smile: PJ :v:


// Works with Nrf52840 AOK
// Wavshare and Good-Display
// Connect To Arduino
// e-Paper  Xiao Nrf52840 Sense	
//  SIGNAL(color)       NAME      PIN  PORT
//  -------------------------------------------
//  BUSY     Purp	  D3            4    P0.29
//  RST     White     D4  (SDA)     5    P0.05
//  DC      Green	  D5  (SCL)     6    P0.04
//  CS	    Orange	  D7  (RXD)     8    P1.12
//  CLK	    Yellow	  D8  (SCLK)    9    P1.13
//  DIN	    BLUE	  D10 (MOSI)   11    P1.15
//
// GND	BROWN	GND	                13
// VCC	GRAY	3V3 	            12

HAVE fun! :stuck_out_tongue_winking_eye:

2 Likes

Got to get a Color one NOW dangit’ :crazy_face:

Indeed, I manage to drive a massive 9.69" black-white-red e-paper display with the tiny Xiao RP2040. No secret, the MCU provides enough RAM for the 161280 bytes frame-buffer.

Hi there ,
Absolutely :grin: bet that red looks tight.
The samd21 with a poultry 32K can’t hang with the big Dogs without Waving a chicken in the air and spinning around your chair three times , count to forty and Hit compile with your left hand and fingers crossed. Or a page buffer routine or smthg… :crazy_face:
They are the truth :place_of_worship: now with a display and sleeping controller/MCU
GL :slight_smile: PJ

Ah great! I got really confused because I read somewhere you didn’t need the DIN and SCK pins and your sample didn’t work without them. Also the line BUSY → 4, RST → 5, DC → 6, CS-> 8, CLK → 9, DIN → 11 was very confusing because I don’t know what these pins refer to.

Anyways, here’s for future explorers: you DO need to connect all pins. Even though the sketch above doesn’t specify the DIN and SCK pins they are required for the display to do its work.
My display is the 3 color 4.2" variant and I used the same pins as you did. So connect them like this:

(copied from your post)

// Works with Nrf52840 AOK
// Wavshare and Good-Display
// Connect To Arduino
// e-Paper  Xiao Nrf52840 Sense	
//  SIGNAL(color)       NAME      PIN  PORT
//  -------------------------------------------
//  BUSY     Purp	  D3            4    P0.29
//  RST     White     D4  (SDA)     5    P0.05
//  DC      Green	  D5  (SCL)     6    P0.04
//  CS	    Orange	  D7  (RXD)     8    P1.12
//  CLK	    Yellow	  D8  (SCLK)    9    P1.13
//  DIN	    BLUE	  D10 (MOSI)   11    P1.15
//
// GND	BROWN	GND	                13
// VCC	GRAY	3V3 	            12

And my code looks like this:

#include <GxEPD2_3C.h>
#include <Fonts/FreeMonoBold9pt7b.h>
GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT / 2> display(GxEPD2_420c(/*CS=D7*/ D7, /*DC=D5*/ D5, /*RST=D4*/ D4, /*BUSY=D3*/ D3));

I’m using full refresh code and it flickers a lot while painting, but it does work!

Hi there,
Yes, The internet is FULL of Garbage and sorry people, Only non-technical people would dare to post such lunacy LOL Not connect them, maybe read through the text again you’ll see I specified in the text what those pins are (the DEFAuLT SPI),That’s why I put the table together. So folks could just adjust it to fit there scenario.
Glad it helped. :grinning: :+1:
I need to order that color one , looks top Notch
GL :- ) PJ

Makes sense in hindsight :wink: this is the first time I used SPI. I thought “SPI uses 4 pins, there are 4 pins referred to in the sketch, let’s try that.” Took me some debugging with my scope to see that the pins were in fact being used. Anyway, thanks so much for the post, it got me on the right track.

The screen is indeed beautiful. Next up is to get partial updates working because the flickering screen is really too slow for every single draw I have to do.

1 Like