adafruit / Adafruit_EPD

e-paper display driver for Arduino
140 stars 56 forks source link

Device blocking ón ESP32 if hardware SPI (default) is used #35

Closed Hutch67 closed 3 years ago

Hutch67 commented 3 years ago

ESP32 uses a MUTEX to handle SPI transactions. So calling beginTransaction twice in a row will block the device. This happens in current code, if SRAM is used or a display (like 2,7" tricolor IL91874) which uses singleByteTxns = true Both will call beginTransaction twice in a row and then the device will block for ever in cores\esp32\esp32-hal-spi.h SPI_MUTEX_LOCK();

To prevent this, I made some changes in Adafruit_EPD.cpp Adafruit_EPD.cpp.patch.txt to track _isInTransaction properly, which was not used before.

See also https://github.com/adafruit/Adafruit-PN532/issues/53 for a similar bug.

Hutch67 commented 3 years ago

to many changes on master, will check and file a new one if necessary