Skip to content

Commit 04fe4d2

Browse files
author
Laurent MEUNIER
committed
[STM32F4 HAL] Avoid SPI spurious interrupt
If SPI TXE is not disabled at the end of transfer, MBED application callback that is registered for transfer completion might be called twice
1 parent 00086a6 commit 04fe4d2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/stm32f4xx_hal_spi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,6 +2450,7 @@ static void SPI_TxISR_8BIT(struct __SPI_HandleTypeDef *hspi)
24502450
SET_BIT(hspi->Instance->CR1, SPI_CR1_CRCNEXT);
24512451
}
24522452
#endif /* USE_SPI_CRC */
2453+
__HAL_SPI_DISABLE_IT(hspi, (SPI_IT_TXE));
24532454
SPI_CloseTx_ISR(hspi);
24542455
}
24552456
}
@@ -2476,6 +2477,7 @@ static void SPI_TxISR_16BIT(struct __SPI_HandleTypeDef *hspi)
24762477
SET_BIT(hspi->Instance->CR1, SPI_CR1_CRCNEXT);
24772478
}
24782479
#endif /* USE_SPI_CRC */
2480+
__HAL_SPI_DISABLE_IT(hspi, (SPI_IT_TXE));
24792481
SPI_CloseTx_ISR(hspi);
24802482
}
24812483
}

0 commit comments

Comments
 (0)