[HAL][SMARTCARD] Wait for the 'Receive Enabled ACK' flag in the SMARTCARD_CheckIdleState() function
diff --git a/Inc/stm32f7xx_hal_smartcard.h b/Inc/stm32f7xx_hal_smartcard.h
index 45b17b1..cfe4bb4 100644
--- a/Inc/stm32f7xx_hal_smartcard.h
+++ b/Inc/stm32f7xx_hal_smartcard.h
@@ -606,6 +606,7 @@
* @param __FLAG__ specifies the flag to check.
* This parameter can be one of the following values:
* @arg @ref SMARTCARD_FLAG_TCBGT Transmission complete before guard time flag (when flag available)
+ * @arg @ref SMARTCARD_FLAG_REACK Receive enable acknowledge flag
* @arg @ref SMARTCARD_FLAG_TEACK Transmit enable acknowledge flag
* @arg @ref SMARTCARD_FLAG_BUSY Busy flag
* @arg @ref SMARTCARD_FLAG_EOBF End of block flag
diff --git a/Inc/stm32f7xx_hal_smartcard_ex.h b/Inc/stm32f7xx_hal_smartcard_ex.h
index eb05b1c..f70e798 100644
--- a/Inc/stm32f7xx_hal_smartcard_ex.h
+++ b/Inc/stm32f7xx_hal_smartcard_ex.h
@@ -79,6 +79,9 @@
#if defined(USART_TCBGT_SUPPORT)
#define SMARTCARD_FLAG_TCBGT USART_ISR_TCBGT /*!< SMARTCARD transmission complete before guard time completion */
#endif /* USART_TCBGT_SUPPORT */
+#if defined(USART_ISR_REACK)
+#define SMARTCARD_FLAG_REACK USART_ISR_REACK /*!< SMARTCARD receive enable acknowledge flag */
+#endif /* USART_ISR_REACK */
#define SMARTCARD_FLAG_TEACK USART_ISR_TEACK /*!< SMARTCARD transmit enable acknowledge flag */
#define SMARTCARD_FLAG_BUSY USART_ISR_BUSY /*!< SMARTCARD busy flag */
#define SMARTCARD_FLAG_EOBF USART_ISR_EOBF /*!< SMARTCARD end of block flag */
diff --git a/Src/stm32f7xx_hal_smartcard.c b/Src/stm32f7xx_hal_smartcard.c
index 98668b4..8668223 100644
--- a/Src/stm32f7xx_hal_smartcard.c
+++ b/Src/stm32f7xx_hal_smartcard.c
@@ -2425,6 +2425,19 @@
return HAL_TIMEOUT;
}
}
+#if defined(USART_ISR_REACK)
+ /* Check if the Receiver is enabled */
+ if ((hsmartcard->Instance->CR1 & USART_CR1_RE) == USART_CR1_RE)
+ {
+ /* Wait until REACK flag is set */
+ if (SMARTCARD_WaitOnFlagUntilTimeout(hsmartcard, USART_ISR_REACK, RESET, tickstart,
+ SMARTCARD_TEACK_REACK_TIMEOUT) != HAL_OK)
+ {
+ /* Timeout occurred */
+ return HAL_TIMEOUT;
+ }
+ }
+#endif /* USART_ISR_REACK */
/* Initialize the SMARTCARD states */
hsmartcard->gState = HAL_SMARTCARD_STATE_READY;