Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more
Interrupts and flags management functions
[USART_Private_Functions]
Interrupts and flags management functions. More...
Functions | |
void | USART_ITConfig (USART_TypeDef *USARTx, uint32_t USART_IT, FunctionalState NewState) |
Enables or disables the specified USART interrupts. | |
void | USART_RequestCmd (USART_TypeDef *USARTx, uint32_t USART_Request, FunctionalState NewState) |
Enables the specified USART's Request. | |
void | USART_OverrunDetectionConfig (USART_TypeDef *USARTx, uint32_t USART_OVRDetection) |
Enables or disables the USART's Overrun detection. | |
FlagStatus | USART_GetFlagStatus (USART_TypeDef *USARTx, uint32_t USART_FLAG) |
Checks whether the specified USART flag is set or not. | |
void | USART_ClearFlag (USART_TypeDef *USARTx, uint32_t USART_FLAG) |
Clears the USARTx's pending flags. | |
ITStatus | USART_GetITStatus (USART_TypeDef *USARTx, uint32_t USART_IT) |
Checks whether the specified USART interrupt has occurred or not. | |
void | USART_ClearITPendingBit (USART_TypeDef *USARTx, uint32_t USART_IT) |
Clears the USARTx's interrupt pending bits. |
Detailed Description
Interrupts and flags management functions.
=============================================================================== ##### Interrupts and flags management functions ##### =============================================================================== [..] This subsection provides a set of functions allowing to configure the USART Interrupts sources, Requests and check or clear the flags or pending bits status. The user should identify which mode will be used in his application to manage the communication: Polling mode, Interrupt mode. *** Polling Mode *** ==================== [..] In Polling Mode, the SPI communication can be managed by these flags: (#) USART_FLAG_REACK: to indicate the status of the Receive Enable acknowledge flag (#) USART_FLAG_TEACK: to indicate the status of the Transmit Enable acknowledge flag. (#) USART_FLAG_WUF: to indicate the status of the Wake up flag. (#) USART_FLAG_RWU: to indicate the status of the Receive Wake up flag. (#) USART_FLAG_SBK: to indicate the status of the Send Break flag. (#) USART_FLAG_CMF: to indicate the status of the Character match flag. (#) USART_FLAG_BUSY: to indicate the status of the Busy flag. (#) USART_FLAG_ABRF: to indicate the status of the Auto baud rate flag. (#) USART_FLAG_ABRE: to indicate the status of the Auto baud rate error flag. (#) USART_FLAG_EOBF: to indicate the status of the End of block flag. (#) USART_FLAG_RTOF: to indicate the status of the Receive time out flag. (#) USART_FLAG_nCTSS: to indicate the status of the Inverted nCTS input bit status. (#) USART_FLAG_TXE: to indicate the status of the transmit buffer register. (#) USART_FLAG_RXNE: to indicate the status of the receive buffer register. (#) USART_FLAG_TC: to indicate the status of the transmit operation. (#) USART_FLAG_IDLE: to indicate the status of the Idle Line. (#) USART_FLAG_CTS: to indicate the status of the nCTS input. (#) USART_FLAG_LBD: to indicate the status of the LIN break detection. (#) USART_FLAG_NE: to indicate if a noise error occur. (#) USART_FLAG_FE: to indicate if a frame error occur. (#) USART_FLAG_PE: to indicate if a parity error occur. (#) USART_FLAG_ORE: to indicate if an Overrun error occur. [..] In this Mode it is advised to use the following functions: (+) FlagStatus USART_GetFlagStatus(USART_TypeDef* USARTx, uint16_t USART_FLAG). (+) void USART_ClearFlag(USART_TypeDef* USARTx, uint16_t USART_FLAG). *** Interrupt Mode *** ====================== [..] In Interrupt Mode, the USART communication can be managed by 8 interrupt sources and 10 pending bits: (+) Pending Bits: (##) USART_IT_WU: to indicate the status of the Wake up interrupt. (##) USART_IT_CM: to indicate the status of Character match interrupt. (##) USART_IT_EOB: to indicate the status of End of block interrupt. (##) USART_IT_RTO: to indicate the status of Receive time out interrupt. (##) USART_IT_CTS: to indicate the status of CTS change interrupt. (##) USART_IT_LBD: to indicate the status of LIN Break detection interrupt. (##) USART_IT_TC: to indicate the status of Transmission complete interrupt. (##) USART_IT_IDLE: to indicate the status of IDLE line detected interrupt. (##) USART_IT_ORE: to indicate the status of OverRun Error interrupt. (##) USART_IT_NE: to indicate the status of Noise Error interrupt. (##) USART_IT_FE: to indicate the status of Framing Error interrupt. (##) USART_IT_PE: to indicate the status of Parity Error interrupt. (+) Interrupt Source: (##) USART_IT_WU: specifies the interrupt source for Wake up interrupt. (##) USART_IT_CM: specifies the interrupt source for Character match interrupt. (##) USART_IT_EOB: specifies the interrupt source for End of block interrupt. (##) USART_IT_RTO: specifies the interrupt source for Receive time-out interrupt. (##) USART_IT_CTS: specifies the interrupt source for CTS change interrupt. (##) USART_IT_LBD: specifies the interrupt source for LIN Break detection interrupt. (##) USART_IT_TXE: specifies the interrupt source for Transmit Data Register empty interrupt. (##) USART_IT_TC: specifies the interrupt source for Transmission complete interrupt. (##) USART_IT_RXNE: specifies the interrupt source for Receive Data register not empty interrupt. (##) USART_IT_IDLE: specifies the interrupt source for Idle line detection interrupt. (##) USART_IT_PE: specifies the interrupt source for Parity Error interrupt. (##) USART_IT_ERR: specifies the interrupt source for Error interrupt (Frame error, noise error, overrun error) -@@- Some parameters are coded in order to use them as interrupt source or as pending bits. [..] In this Mode it is advised to use the following functions: (+) void USART_ITConfig(USART_TypeDef* USARTx, uint16_t USART_IT, FunctionalState NewState). (+) ITStatus USART_GetITStatus(USART_TypeDef* USARTx, uint16_t USART_IT). (+) void USART_ClearITPendingBit(USART_TypeDef* USARTx, uint16_t USART_IT).
Function Documentation
void USART_ClearFlag | ( | USART_TypeDef * | USARTx, |
uint32_t | USART_FLAG | ||
) |
Clears the USARTx's pending flags.
- Parameters:
-
USARTx,: Select the USART peripheral. This parameter can be one of the following values: USART1 or USART2 or USART3 or UART4 or UART5. USART_FLAG,: specifies the flag to clear. This parameter can be any combination of the following values: - USART_FLAG_WUF: Wake up flag.
- USART_FLAG_CMF: Character match flag.
- USART_FLAG_EOBF: End of block flag.
- USART_FLAG_RTOF: Receive time out flag.
- USART_FLAG_CTS: CTS Change flag.
- USART_FLAG_LBD: LIN Break detection flag.
- USART_FLAG_TC: Transmission Complete flag.
- USART_FLAG_IDLE: IDLE line detected flag.
- USART_FLAG_ORE: OverRun Error flag.
- USART_FLAG_NE: Noise Error flag.
- USART_FLAG_FE: Framing Error flag.
- USART_FLAG_PE: Parity Errorflag.
- Note:
- RXNE pending bit is cleared by a read to the USART_RDR register (USART_ReceiveData()) or by writing 1 to the RXFRQ in the register USART_RQR (USART_RequestCmd()).
- TC flag can be also cleared by software sequence: a read operation to USART_SR register (USART_GetFlagStatus()) followed by a write operation to USART_TDR register (USART_SendData()).
- TXE flag is cleared by a write to the USART_TDR register (USART_SendData()) or by writing 1 to the TXFRQ in the register USART_RQR (USART_RequestCmd()).
- SBKF flag is cleared by 1 to the SBKRQ in the register USART_RQR (USART_RequestCmd()).
- Return values:
-
None
Definition at line 1959 of file stm32f30x_usart.c.
void USART_ClearITPendingBit | ( | USART_TypeDef * | USARTx, |
uint32_t | USART_IT | ||
) |
Clears the USARTx's interrupt pending bits.
- Parameters:
-
USARTx,: Select the USART peripheral. This parameter can be one of the following values: USART1 or USART2 or USART3 or UART4 or UART5. USART_IT,: specifies the interrupt pending bit to clear. This parameter can be one of the following values: - USART_IT_WU: Wake up interrupt.
- USART_IT_CM: Character match interrupt.
- USART_IT_EOB: End of block interrupt.
- USART_IT_RTO: Receive time out interrupt.
- USART_IT_CTS: CTS change interrupt.
- USART_IT_LBD: LIN Break detection interrupt.
- USART_IT_TC: Transmission complete interrupt.
- USART_IT_IDLE: IDLE line detected interrupt.
- USART_IT_ORE: OverRun Error interrupt.
- USART_IT_NE: Noise Error interrupt.
- USART_IT_FE: Framing Error interrupt.
- USART_IT_PE: Parity Error interrupt.
- Note:
- RXNE pending bit is cleared by a read to the USART_RDR register (USART_ReceiveData()) or by writing 1 to the RXFRQ in the register USART_RQR (USART_RequestCmd()).
- TC pending bit can be also cleared by software sequence: a read operation to USART_SR register (USART_GetITStatus()) followed by a write operation to USART_TDR register (USART_SendData()).
- TXE pending bit is cleared by a write to the USART_TDR register (USART_SendData()) or by writing 1 to the TXFRQ in the register USART_RQR (USART_RequestCmd()).
- Return values:
-
None
Definition at line 2062 of file stm32f30x_usart.c.
FlagStatus USART_GetFlagStatus | ( | USART_TypeDef * | USARTx, |
uint32_t | USART_FLAG | ||
) |
Checks whether the specified USART flag is set or not.
- Parameters:
-
USARTx,: Select the USART peripheral. This parameter can be one of the following values: USART1 or USART2 or USART3 or UART4 or UART5. USART_FLAG,: specifies the flag to check. This parameter can be one of the following values: - USART_FLAG_REACK: Receive Enable acknowledge flag.
- USART_FLAG_TEACK: Transmit Enable acknowledge flag.
- USART_FLAG_WUF: Wake up flag.
- USART_FLAG_RWU: Receive Wake up flag.
- USART_FLAG_SBK: Send Break flag.
- USART_FLAG_CMF: Character match flag.
- USART_FLAG_BUSY: Busy flag.
- USART_FLAG_ABRF: Auto baud rate flag.
- USART_FLAG_ABRE: Auto baud rate error flag.
- USART_FLAG_EOBF: End of block flag.
- USART_FLAG_RTOF: Receive time out flag.
- USART_FLAG_nCTSS: Inverted nCTS input bit status.
- USART_FLAG_CTS: CTS Change flag.
- USART_FLAG_LBD: LIN Break detection flag.
- USART_FLAG_TXE: Transmit data register empty flag.
- USART_FLAG_TC: Transmission Complete flag.
- USART_FLAG_RXNE: Receive data register not empty flag.
- USART_FLAG_IDLE: Idle Line detection flag.
- USART_FLAG_ORE: OverRun Error flag.
- USART_FLAG_NE: Noise Error flag.
- USART_FLAG_FE: Framing Error flag.
- USART_FLAG_PE: Parity Error flag.
- Return values:
-
The new state of USART_FLAG (SET or RESET).
Definition at line 1908 of file stm32f30x_usart.c.
ITStatus USART_GetITStatus | ( | USART_TypeDef * | USARTx, |
uint32_t | USART_IT | ||
) |
Checks whether the specified USART interrupt has occurred or not.
- Parameters:
-
USARTx,: Select the USART peripheral. This parameter can be one of the following values: USART1 or USART2 or USART3 or UART4 or UART5. USART_IT,: specifies the USART interrupt source to check. This parameter can be one of the following values: - USART_IT_WU: Wake up interrupt.
- USART_IT_CM: Character match interrupt.
- USART_IT_EOB: End of block interrupt.
- USART_IT_RTO: Receive time out interrupt.
- USART_IT_CTS: CTS change interrupt.
- USART_IT_LBD: LIN Break detection interrupt.
- USART_IT_TXE: Transmit Data Register empty interrupt.
- USART_IT_TC: Transmission complete interrupt.
- USART_IT_RXNE: Receive Data register not empty interrupt.
- USART_IT_IDLE: Idle line detection interrupt.
- USART_IT_ORE: OverRun Error interrupt.
- USART_IT_NE: Noise Error interrupt.
- USART_IT_FE: Framing Error interrupt.
- USART_IT_PE: Parity Error interrupt.
- Return values:
-
The new state of USART_IT (SET or RESET).
Definition at line 1990 of file stm32f30x_usart.c.
void USART_ITConfig | ( | USART_TypeDef * | USARTx, |
uint32_t | USART_IT, | ||
FunctionalState | NewState | ||
) |
Enables or disables the specified USART interrupts.
- Parameters:
-
USARTx,: Select the USART peripheral. This parameter can be one of the following values: USART1 or USART2 or USART3 or UART4 or UART5. USART_IT,: specifies the USART interrupt sources to be enabled or disabled. This parameter can be one of the following values: - USART_IT_WU: Wake up interrupt.
- USART_IT_CM: Character match interrupt.
- USART_IT_EOB: End of block interrupt.
- USART_IT_RTO: Receive time out interrupt.
- USART_IT_CTS: CTS change interrupt.
- USART_IT_LBD: LIN Break detection interrupt.
- USART_IT_TXE: Transmit Data Register empty interrupt.
- USART_IT_TC: Transmission complete interrupt.
- USART_IT_RXNE: Receive Data register not empty interrupt.
- USART_IT_IDLE: Idle line detection interrupt.
- USART_IT_PE: Parity Error interrupt.
- USART_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
NewState,: new state of the specified USARTx interrupts. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 1779 of file stm32f30x_usart.c.
void USART_OverrunDetectionConfig | ( | USART_TypeDef * | USARTx, |
uint32_t | USART_OVRDetection | ||
) |
Enables or disables the USART's Overrun detection.
- Parameters:
-
USARTx,: Select the USART peripheral. This parameter can be one of the following values: USART1 or USART2 or USART3 or UART4 or UART5. USART_OVRDetection,: specifies the OVR detection status in case of OVR error. This parameter can be any combination of the following values: - USART_OVRDetection_Enable: OVR error detection enabled when the USART OVR error is asserted.
- USART_OVRDetection_Disable: OVR error detection disabled when the USART OVR error is asserted.
- Return values:
-
None
Definition at line 1866 of file stm32f30x_usart.c.
void USART_RequestCmd | ( | USART_TypeDef * | USARTx, |
uint32_t | USART_Request, | ||
FunctionalState | NewState | ||
) |
Enables the specified USART's Request.
- Parameters:
-
USARTx,: Select the USART peripheral. This parameter can be one of the following values: USART1 or USART2 or USART3 or UART4 or UART5. USART_Request,: specifies the USART request. This parameter can be any combination of the following values: - USART_Request_TXFRQ: Transmit data flush ReQuest
- USART_Request_RXFRQ: Receive data flush ReQuest
- USART_Request_MMRQ: Mute Mode ReQuest
- USART_Request_SBKRQ: Send Break ReQuest
- USART_Request_ABRRQ: Auto Baud Rate ReQuest
NewState,: new state of the DMA interface when reception error occurs. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 1833 of file stm32f30x_usart.c.
Generated on Tue Jul 12 2022 17:34:46 by
