Skip to content

Commit 9b5af21

Browse files
committed
[HAL][SPI] Ensure DMA RX aborts after DMA TX in HAL_SPI_Abort_IT()
1 parent 64687ba commit 9b5af21

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Src/stm32h7xx_hal_spi.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2781,6 +2781,15 @@ HAL_StatusTypeDef HAL_SPI_Abort_IT(SPI_HandleTypeDef *hspi)
27812781
/* If DMA Tx and/or DMA Rx Handles are associated to SPI Handle, DMA Abort complete callbacks should be initialized
27822782
before any call to DMA Abort functions */
27832783

2784+
if (hspi->hdmarx != NULL)
2785+
{
2786+
if (HAL_IS_BIT_SET(hspi->Instance->CFG1, SPI_CFG1_RXDMAEN))
2787+
{
2788+
/* Set DMA Abort Complete callback if SPI DMA Rx request if enabled */
2789+
hspi->hdmarx->XferAbortCallback = SPI_DMARxAbortCallback;
2790+
}
2791+
}
2792+
27842793
if (hspi->hdmatx != NULL)
27852794
{
27862795
if (HAL_IS_BIT_SET(hspi->Instance->CFG1, SPI_CFG1_TXDMAEN))

0 commit comments

Comments
 (0)