-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Closed
Description
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
case SPI_MODE2: | |
spi->dev->pin.ck_idle_edge = 1; | |
spi->dev->user.ck_out_edge = 1; | |
break; | |
case SPI_MODE3: | |
spi->dev->pin.ck_idle_edge = 1; | |
spi->dev->user.ck_out_edge = 0; | |
break; |
And in the function spiTransaction
we have:
arduino-esp32/cores/esp32/esp32-hal-spi.c
Lines 714 to 721 in a153f6a
case SPI_MODE2: | |
spi->dev->pin.ck_idle_edge = 1; | |
spi->dev->user.ck_out_edge = 0; | |
break; | |
case SPI_MODE3: | |
spi->dev->pin.ck_idle_edge = 1; | |
spi->dev->user.ck_out_edge = 1; | |
break; |
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
bool idleEdge = spi->dev->pin.ck_idle_edge; | |
bool outEdge = spi->dev->user.ck_out_edge; | |
if(idleEdge) { | |
if(outEdge) { | |
return SPI_MODE3; | |
} | |
return SPI_MODE2; | |
} | |
if(outEdge) { | |
return SPI_MODE1; | |
} | |
return SPI_MODE0; |
Metadata
Metadata
Assignees
Labels
No labels