communication with device failed
I'm using the 7.5inch display, https://www.waveshare.com/wiki/7.5inch_HD_e-Paper_HAT. I've browsed through similar issues (e.g. https://github.com/GregDMeyer/IT8951/issues/18) and tried the following:
- lower spi_hz
- turn spi on and off
- reboot
- check the cables, plug and unplug
However I'm still getting "communication with device failed" when running
python3.8 test.py
in IT8951/test/integration
For what it's worth, the C WaveShare code from https://www.waveshare.com/wiki/7.5inch_HD_e-Paper_HAT works fine.
Is there something I might be missing here? I've also read that using the Waveshare code might leave the display in a weird state - is there any way I can completely reset the display? Not sure why rebooting does not work here.
Appreciate any pointers :) thank you!
Same here. Using a Raspberry Pi Zero worked fine, but with my new Pi 5 I have this issue, so sad. Using https://www.waveshare.com/wiki/9.7inch_e-Paper_HAT (Works fine with demo sample of Waveshare)
Same issue with a Pi 4 (again, works fine with demo code)
Please let me know if you have any luck figuring out what is going on---unfortunately since I cannot reproduce the issue I don't have a good way of debugging what is happening. I am certainly open to pull requests if you figure out a fix!
Having the same issue. Here's what I know:
- Does not seem related to running as root / sudo or not. I set up a whole install as root, same problem
- Waveshare demo files work. I've rebooted after running them
- The error is in interface.py:105, where SPI is initialized and apparently the read function just gets zeros back
I am testing on a RPI 4B / 8GB, running the latest 64-bit Lite OS, and python 3.12.4.
I'm at a loss, but commenting in the hopes someone solves it.
Dove deeper -- no solution but leaving notes in case anyone else runs across this.
The example file in the waveshare repo works when compiled. I've double-checked everything I can find to align implementations between this repo and that one. I confirmed that all constants for pins and message values are the same.
There are a couple of differences between the two. The waveshare version:
- Implements reset with high for 200ms, low for 10ms, high for 200ms
- Sets CS low at beginning of write() command and high after write
- Waits for HRDY / ready between sending preamble and payload
I've aligned my local copy of this repro with the waveshare implementations... and still no luck.
While the example file in IT8951-ePaper does work when compiled with the default BCM driver, it DOES NOT work when compiled to use GPIOD (make -j4 LIB=GPIOD). The program starts but it does not successfully control the display at all.
Similarly, manually accessing the SPI ports using pigpiod / pigs also fails the same way: no errors, but all read bytes are returned as zero.
So I'm pretty confident that this issue is not in this IT8951 library at all, but something at the GPIOD level.
@brookstalley did you have any luck? I'm having what appears to be the same issue. Waveshare examples work when using GPIOD but I end up with a 'communication with device failed' error as well.
Dove deeper -- no solution but leaving notes in case anyone else runs across this.
The example file in the waveshare repo works when compiled. I've double-checked everything I can find to align implementations between this repo and that one. I confirmed that all constants for pins and message values are the same.
There are a couple of differences between the two. The waveshare version:
- Implements reset with high for 200ms, low for 10ms, high for 200ms
- Sets CS low at beginning of write() command and high after write
- Waits for HRDY / ready between sending preamble and payload
I've aligned my local copy of this repro with the waveshare implementations... and still no luck.
Do you happen to have these changes available that you can push? I also noticed a few differences in the startup sequence. It looks like gpiod works for me but not for you so maybe your changes will work on my side?
Well a small update, I just tried refreshing with a new image and not installing or following any of the waveshare instructions. The same hardware with the new image works fine. So something leads to an incompatibility here
🤷
Having the same issue.
With 13.3inch e-Paper Module
line 105, in update_system_info raise RuntimeError("communication with device failed")
My Raspberry have BCM2835 SPI
Maybe this will help? Waveshare write some info about BCM2835
BCM2835 bcm2835_spi_begin(); // Start SPI operations. Forces RPi SPI0 pins P1-19 (MOSI), P1-21 (MISO), P1-23 (CLK), P1-24 (CE0) and P1-26 (CE1) to alternate function ALT0, which enables those pins for SPI interface. You should call bcm2835_spi_end() when all SPI funcitons are complete to return the pins to their default functions. See: http://www.airspayce.com/mikem/bcm2835/group__spi.html bcm2835_spi_setBitOrder(BCM2835_SPI_BIT_ORDER_MSBFIRST); // Set bit order as MSB First bcm2835_spi_setDataMode(BCM2835_SPI_MODE0); // Sets the SPI data mode, CPOL = 0, CPHA = 0 bcm2835_spi_setClockDivider(BCM2835_SPI_CLOCK_DIVIDER_128); // Sets the SPI clock divider bcm2835_spi_chipSelect(BCM2835_SPI_CS0); // Sets the chip select pin(s) When an bcm2835_spi_transfer() is made, bcm2835_spi_setChipSelectPolarity(BCM2835_SPI_CS0, LOW); // Sets the chip select pin CS0 polarity as active LOW. bcm2835_spi_transfer(uint_t value); // Transfers one byte bcm2835_spi_transfernb(char *tbuf,char *rbuf,uint32_t len); // Transfers any number of bytes
I had the same issue with a rasp4. The Waveshare tutorial states to change a value in /boot/firmware/config.txt

Restoring the default value (so dtparam=spi=on) solved the issue for me