Skip to content

Commit cc73f17

Browse files
sparksme-no-dev
authored andcommitted
SPI_MODE2 and SPI_MODE3 configurations inverted (espressif#345)
It appears that the configurations for `ck_out_edge` were inverted for `SPI_MODE2` and `SPI_MODE3`. You can check the technical reference manual on page 76, table 23 "Clock Polarity and Phase, and Corresponding SPI Register Values for SPI Master". I've check with my oscilloscope that the current configuration is wrong and this fix corrects the issue.
1 parent 6006308 commit cc73f17

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: cores/esp32/esp32-hal-spi.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,11 @@ void spiSetDataMode(spi_t * spi, uint8_t dataMode)
332332
break;
333333
case SPI_MODE2:
334334
spi->dev->pin.ck_idle_edge = 1;
335-
spi->dev->user.ck_out_edge = 0;
335+
spi->dev->user.ck_out_edge = 1;
336336
break;
337337
case SPI_MODE3:
338338
spi->dev->pin.ck_idle_edge = 1;
339-
spi->dev->user.ck_out_edge = 1;
339+
spi->dev->user.ck_out_edge = 0;
340340
break;
341341
case SPI_MODE0:
342342
default:

0 commit comments

Comments
 (0)