From bda6656eca29a77fec964bf6387d21c17c69a9a2 Mon Sep 17 00:00:00 2001 From: Martin Kiepfer Date: Thu, 24 Aug 2023 21:34:56 +0200 Subject: [PATCH] bugfix: esp32: spi: correct idle polarity and mode configuration Possible fix for incorrection spi mode configuration on esp32 (#61866) Signed-off-by: Martin Kiepfer --- drivers/spi/spi_esp32_spim.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi_esp32_spim.c b/drivers/spi/spi_esp32_spim.c index f1febb7512..a6ace4f263 100644 --- a/drivers/spi/spi_esp32_spim.c +++ b/drivers/spi/spi_esp32_spim.c @@ -331,11 +331,10 @@ static int IRAM_ATTR spi_esp32_configure(const struct device *dev, /* SPI mode */ hal_dev->mode = 0; - if (SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_CPOL) { + if (SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_CPHA) { hal_dev->mode = BIT(0); } - - if (SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_CPHA) { + if (SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_CPOL) { hal_dev->mode |= BIT(1); }