From 8f822db28cd97983e7c0214d7daf137c88560dec Mon Sep 17 00:00:00 2001 From: Gustavo Henrique Nihei Date: Mon, 24 May 2021 10:34:41 -0300 Subject: [PATCH] spi: Fix SPI Slave TX/RX bitlen configuring wrong registers The maximum input length for the SPI Slave should be applied to the read buffer configuration, not for the write buffer. Similarly, the output configuration should also target the write buffer. --- components/hal/esp32/include/hal/spi_ll.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/hal/esp32/include/hal/spi_ll.h b/components/hal/esp32/include/hal/spi_ll.h index d26dcab13b..efd5170309 100644 --- a/components/hal/esp32/include/hal/spi_ll.h +++ b/components/hal/esp32/include/hal/spi_ll.h @@ -744,7 +744,7 @@ static inline void spi_ll_set_mosi_bitlen(spi_dev_t *hw, size_t bitlen) */ static inline void spi_ll_slave_set_rx_bitlen(spi_dev_t *hw, size_t bitlen) { - hw->slv_wrbuf_dlen.bit_len = bitlen - 1; + hw->slv_rdbuf_dlen.bit_len = bitlen - 1; } /** @@ -755,7 +755,7 @@ static inline void spi_ll_slave_set_rx_bitlen(spi_dev_t *hw, size_t bitlen) */ static inline void spi_ll_slave_set_tx_bitlen(spi_dev_t *hw, size_t bitlen) { - hw->slv_rdbuf_dlen.bit_len = bitlen - 1; + hw->slv_wrbuf_dlen.bit_len = bitlen - 1; } /**