From 6fb126657a7fc0f6c52c81f85b9dd0287ec204fa 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 942eecd428..7fc15bcedf 100644 --- a/components/hal/esp32/include/hal/spi_ll.h +++ b/components/hal/esp32/include/hal/spi_ll.h @@ -746,7 +746,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; } /** @@ -757,7 +757,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; } /**