hideakitai / ESP32DMASPI

SPI library for ESP32 which use DMA buffer to send/receive transactions
MIT License
170 stars 36 forks source link

Shifted bit when using SPI_MODE1 or SPI_MODE3 #5

Closed bakwc closed 3 years ago

bakwc commented 3 years ago

When using SPI_MODE1 or SPI_MODE3 i got all transmitted from master to slave bytes shifted by 1 bit. Eg, when master send: 0 1 2 3 4 5 6 7 8 9 10, the slave get: 0 2 4 6 8 10 12 14 16 18 20

With SPI_MODE0 - everything works fine, but there is a warning in logs. Despite of of the warning - SPI_MODE0 works good. I suggest to remove warning and allow to use SPI_MODE0.

Looks like MODE0 works with DMA: https://github.com/espressif/esp-idf/commit/58955a79a27d3c7331eaec6e464878df42615a36

I was unable to make other modes working.

hideakitai commented 3 years ago

@bakwc Thanks for reporting. What is the difference of settings from #4? Please let me know which change caused it.

I will remove the warning because the limitation does not depend on this library but esp-idf (we can find many issues about it).

hideakitai commented 3 years ago

194d62783fe244fd1d67e621068eeb9294e9127c

bakwc commented 3 years ago

Thank you. For me it is 100% reproducible when connecting esp32cam SPI master with esp32cam SPI slave.

hideakitai commented 3 years ago

@bakwc I've removed the warning and updated README about bit shifting in v0.1.1. Close this issue because this is not the problem of this library. Thank you for reporting.