From 5d9cfbaceef675738b3ba2680ee0603d8f528256 Mon Sep 17 00:00:00 2001 From: Andrew Dunai Date: Mon, 4 Mar 2024 17:00:25 +0200 Subject: [PATCH] fix(hal): force spiTransaction to update clock line immediately (#9221) --- cores/esp32/esp32-hal-spi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cores/esp32/esp32-hal-spi.c b/cores/esp32/esp32-hal-spi.c index 26cb5c873ee..db2b13fa7e2 100644 --- a/cores/esp32/esp32-hal-spi.c +++ b/cores/esp32/esp32-hal-spi.c @@ -1115,6 +1115,11 @@ void spiTransaction(spi_t * spi, uint32_t clockDiv, uint8_t dataMode, uint8_t bi spi->dev->ctrl.wr_bit_order = 1; spi->dev->ctrl.rd_bit_order = 1; } +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 + // Sync new config with hardware, fixes https://github.com/espressif/arduino-esp32/issues/9221 + spi->dev->cmd.update = 1; + while (spi->dev->cmd.update); +#endif } void spiSimpleTransaction(spi_t * spi)