@@ -1133,6 +1133,15 @@ HAL_StatusTypeDef HAL_SPI_Receive(SPI_HandleTypeDef *hspi, uint8_t *pData, uint1
11331133 hspi -> pRxBuffPtr += sizeof (uint32_t );
11341134 hspi -> RxXferCount -- ;
11351135 }
1136+ /* Check if transfer is locked because of a suspend */
1137+ else if (HAL_IS_BIT_SET (temp_sr_reg , SPI_SR_SUSP ))
1138+ {
1139+ /* Verify suspend is triggered by hardware and not software */
1140+ if (HAL_IS_BIT_SET (hspi -> Instance -> CR1 , SPI_CR1_CSTART ))
1141+ {
1142+ __HAL_SPI_CLEAR_SUSPFLAG (hspi );
1143+ }
1144+ }
11361145 else
11371146 {
11381147 /* Timeout management */
@@ -1200,6 +1209,15 @@ HAL_StatusTypeDef HAL_SPI_Receive(SPI_HandleTypeDef *hspi, uint8_t *pData, uint1
12001209 hspi -> pRxBuffPtr += sizeof (uint16_t );
12011210 hspi -> RxXferCount -- ;
12021211 }
1212+ /* Check if transfer is locked because of a suspend */
1213+ else if (HAL_IS_BIT_SET (temp_sr_reg , SPI_SR_SUSP ))
1214+ {
1215+ /* Verify suspend is triggered by hardware and not software */
1216+ if (HAL_IS_BIT_SET (hspi -> Instance -> CR1 , SPI_CR1_CSTART ))
1217+ {
1218+ __HAL_SPI_CLEAR_SUSPFLAG (hspi );
1219+ }
1220+ }
12031221 else
12041222 {
12051223 /* Timeout management */
@@ -1255,6 +1273,15 @@ HAL_StatusTypeDef HAL_SPI_Receive(SPI_HandleTypeDef *hspi, uint8_t *pData, uint1
12551273 hspi -> pRxBuffPtr += sizeof (uint8_t );
12561274 hspi -> RxXferCount -- ;
12571275 }
1276+ /* Check if transfer is locked because of a suspend */
1277+ else if (HAL_IS_BIT_SET (temp_sr_reg , SPI_SR_SUSP ))
1278+ {
1279+ /* Verify suspend is triggered by hardware and not software */
1280+ if (HAL_IS_BIT_SET (hspi -> Instance -> CR1 , SPI_CR1_CSTART ))
1281+ {
1282+ __HAL_SPI_CLEAR_SUSPFLAG (hspi );
1283+ }
1284+ }
12581285 else
12591286 {
12601287 /* Timeout management */
0 commit comments