Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JLipinski-K opened this issue Oct 19, 2023 · 0 comments

Comments

@JLipinski-K
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant