-
Notifications
You must be signed in to change notification settings - Fork 7.6k
SPI mode inconsistency #1094
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
Comments
In my tests with an AD7124-4 device, that uses SPI in mode 3, I got the following results: 1 - Without transactions, using the It is working with modes 0 and 3. 2 - With transactions: It is working with modes 0 and 2. So I concluded that the This property of working on 2 modes makes sense when we check the SPI modes operation: Both modes 0 and 3 sample in the rising edge of the clock pulse. Notice also that mode 2 shifts out the bit in the rising edge (1) and mode 3 shifts out in the falling edge (0). *image taken from https://www.allaboutcircuits.com/technical-articles/spi-serial-peripheral-interface/ |
Hi!
I guess there is an inconsistency in the SPI mode assignment.
In the function
spiSetDataMode
we have:arduino-esp32/cores/esp32/esp32-hal-spi.c
Lines 333 to 340 in a153f6a
And in the function
spiTransaction
we have:arduino-esp32/cores/esp32/esp32-hal-spi.c
Lines 714 to 721 in a153f6a
The
user.ck_out_edge
value is different.Here is the
spiGetDataMode
function:arduino-esp32/cores/esp32/esp32-hal-spi.c
Lines 308 to 319 in a153f6a
The text was updated successfully, but these errors were encountered: