Skip to content

SPI bus not passed to SRAM during declaration; leads to problems when using SPI1 or SPI2 instead of SPI #79

@JLipinski-K

Description

@JLipinski-K

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

Display after correction:
IMG_0169

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions