On boards that have multiple SPI buses, the SPI device used is only passed to the Adafruit_EPD object. The Adafruit_MCPSRAM object initializes with a default argument for SPIClass:
Adafruit_MCPSRAM(int16_t cs, SPIClass *spi = &SPI);
This causes issues when trying to use a breakout board with the display and sram on SPI1 or SPI2 as the sram member of Adafruit_EPD is attempting to communicate on the default SPI instead of SPI1 or SPI2, leading to incorrect data being written to the display. The following change in Adafruit_EPD.cpp to the hardware SPI constructor corrects the issue by passing the correct spi device to the sram object constructor:
Hardware used:
Teensy 4.1, Adafruit 2.9" Red/Black/White eInk Display Breakout - Z10 version with IL0373 chipset
Libraries used:
Using library Adafruit EPD at version 4.5.2 in folder: C:\Users\[name]\Arduino\libraries\Adafruit_EPD Using library SPI at version 1.0 in folder: C:\Users\[name]\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.58.1\libraries\SPI Using library Adafruit GFX Library at version 1.11.9 in folder: C:\Users\[name]\Arduino\libraries\Adafruit_GFX_Library Using library Adafruit BusIO at version 1.14.5 in folder: C:\Users\[name]\Arduino\libraries\Adafruit_BusIO Using library Wire at version 1.0 in folder: C:\Users\[name]\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.58.1\libraries\Wire
Example sketch used: Thinkink_tricolor.ino
Display before correction (Aya for encouragement):
On boards that have multiple SPI buses, the SPI device used is only passed to the Adafruit_EPD object. The Adafruit_MCPSRAM object initializes with a default argument for SPIClass:
Adafruit_MCPSRAM(int16_t cs, SPIClass *spi = &SPI);
This causes issues when trying to use a breakout board with the display and sram on SPI1 or SPI2 as the sram member of Adafruit_EPD is attempting to communicate on the default SPI instead of SPI1 or SPI2, leading to incorrect data being written to the display. The following change in Adafruit_EPD.cpp to the hardware SPI constructor corrects the issue by passing the correct spi device to the sram object constructor:Original:
Adafruit_EPD::Adafruit_EPD(int width, int height, int16_t DC, int16_t RST, int16_t CS, int16_t SRCS, int16_t BUSY, SPIClass *spi) : Adafruit_GFX(width, height), sram(SRCS)
New:
Adafruit_EPD::Adafruit_EPD(int width, int height, int16_t DC, int16_t RST, int16_t CS, int16_t SRCS, int16_t BUSY, SPIClass *spi) : Adafruit_GFX(width, height), sram(SRCS, spi)
Hardware used: Teensy 4.1, Adafruit 2.9" Red/Black/White eInk Display Breakout - Z10 version with IL0373 chipset
Libraries used:
Using library Adafruit EPD at version 4.5.2 in folder: C:\Users\[name]\Arduino\libraries\Adafruit_EPD Using library SPI at version 1.0 in folder: C:\Users\[name]\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.58.1\libraries\SPI Using library Adafruit GFX Library at version 1.11.9 in folder: C:\Users\[name]\Arduino\libraries\Adafruit_GFX_Library Using library Adafruit BusIO at version 1.14.5 in folder: C:\Users\[name]\Arduino\libraries\Adafruit_BusIO Using library Wire at version 1.0 in folder: C:\Users\[name]\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.58.1\libraries\Wire
Example sketch used: Thinkink_tricolor.ino
Display before correction (Aya for encouragement):![IMG_0170](https://github.com/adafruit/Adafruit_EPD/assets/148481524/bd802c3e-14e6-4661-8ee8-61216d95c8c1)
Display after correction:![IMG_0169](https://github.com/adafruit/Adafruit_EPD/assets/148481524/c56eb571-8940-495c-9008-cb030a8f5e73)