STM32 SPIv2 v2 driver reset
Posted: Wed May 21, 2025 10:43 am
For the STM32F7 I noticed that the v2 driver didn't function properly, when the lld_disable was called from the lld_start and the state was not SPI_STOP. This is because both CR1 and CR2 are fully reset, which somehow leads to wrong clock pulses being send.
In order to fix this only the SPE should be reset (os/hal/ports/STM32/LLD/SPIv2/hal_spi_v2_lld.c):
In order to fix this only the SPE should be reset (os/hal/ports/STM32/LLD/SPIv2/hal_spi_v2_lld.c):
Code: Select all
static void spi_lld_disable(SPIDriver *spip) {
.....
- /* Clearing SPE and the rest.*/
- spip->spi->CR1 = 0U;
- spip->spi->CR2 = 0U;
.....
+ /* Clearing SPE */
+ spip->spi->CR1 &= ~SPI_CR1_SPE;
.....