STM32F439xx HAL User Manual
|
UART Transmit and Receive functions. More...
Functions | |
HAL_StatusTypeDef | HAL_UART_Transmit (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout) |
Sends an amount of data in blocking mode. | |
HAL_StatusTypeDef | HAL_UART_Receive (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout) |
Receives an amount of data in blocking mode. | |
HAL_StatusTypeDef | HAL_UART_Transmit_IT (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size) |
Sends an amount of data in non blocking mode. | |
HAL_StatusTypeDef | HAL_UART_Receive_IT (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size) |
Receives an amount of data in non blocking mode. | |
HAL_StatusTypeDef | HAL_UART_Transmit_DMA (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size) |
Sends an amount of data in non blocking mode. | |
HAL_StatusTypeDef | HAL_UART_Receive_DMA (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size) |
Receives an amount of data in non blocking mode. | |
HAL_StatusTypeDef | HAL_UART_DMAPause (UART_HandleTypeDef *huart) |
Pauses the DMA Transfer. | |
HAL_StatusTypeDef | HAL_UART_DMAResume (UART_HandleTypeDef *huart) |
Resumes the DMA Transfer. | |
HAL_StatusTypeDef | HAL_UART_DMAStop (UART_HandleTypeDef *huart) |
Stops the DMA Transfer. | |
HAL_StatusTypeDef | HAL_UART_Abort (UART_HandleTypeDef *huart) |
Abort ongoing transfers (blocking mode). | |
HAL_StatusTypeDef | HAL_UART_AbortTransmit (UART_HandleTypeDef *huart) |
Abort ongoing Transmit transfer (blocking mode). | |
HAL_StatusTypeDef | HAL_UART_AbortReceive (UART_HandleTypeDef *huart) |
Abort ongoing Receive transfer (blocking mode). | |
HAL_StatusTypeDef | HAL_UART_Abort_IT (UART_HandleTypeDef *huart) |
Abort ongoing transfers (Interrupt mode). | |
HAL_StatusTypeDef | HAL_UART_AbortTransmit_IT (UART_HandleTypeDef *huart) |
Abort ongoing Transmit transfer (Interrupt mode). | |
HAL_StatusTypeDef | HAL_UART_AbortReceive_IT (UART_HandleTypeDef *huart) |
Abort ongoing Receive transfer (Interrupt mode). | |
void | HAL_UART_IRQHandler (UART_HandleTypeDef *huart) |
This function handles UART interrupt request. | |
__weak void | HAL_UART_TxCpltCallback (UART_HandleTypeDef *huart) |
Tx Transfer completed callbacks. | |
__weak void | HAL_UART_TxHalfCpltCallback (UART_HandleTypeDef *huart) |
Tx Half Transfer completed callbacks. | |
__weak void | HAL_UART_RxCpltCallback (UART_HandleTypeDef *huart) |
Rx Transfer completed callbacks. | |
__weak void | HAL_UART_RxHalfCpltCallback (UART_HandleTypeDef *huart) |
Rx Half Transfer completed callbacks. | |
__weak void | HAL_UART_ErrorCallback (UART_HandleTypeDef *huart) |
UART error callbacks. | |
__weak void | HAL_UART_AbortCpltCallback (UART_HandleTypeDef *huart) |
UART Abort Complete callback. | |
__weak void | HAL_UART_AbortTransmitCpltCallback (UART_HandleTypeDef *huart) |
UART Abort Complete callback. | |
__weak void | HAL_UART_AbortReceiveCpltCallback (UART_HandleTypeDef *huart) |
UART Abort Receive Complete callback. |
UART Transmit and Receive functions.
============================================================================== ##### IO operation functions ##### ============================================================================== [..] This subsection provides a set of functions allowing to manage the UART asynchronous and Half duplex data transfers. (#) There are two modes of transfer: (++) Blocking mode: The communication is performed in polling mode. The HAL status of all data processing is returned by the same function after finishing transfer. (++) Non blocking mode: The communication is performed using Interrupts or DMA, these APIs return the HAL status. The end of the data processing will be indicated through the dedicated UART IRQ when using Interrupt mode or the DMA IRQ when using DMA mode. The HAL_UART_TxCpltCallback(), HAL_UART_RxCpltCallback() user callbacks will be executed respectively at the end of the transmit or receive process. The HAL_UART_ErrorCallback() user callback will be executed when a communication error is detected. (#) Blocking mode APIs are: (++) HAL_UART_Transmit() (++) HAL_UART_Receive() (#) Non Blocking mode APIs with Interrupt are: (++) HAL_UART_Transmit_IT() (++) HAL_UART_Receive_IT() (++) HAL_UART_IRQHandler() (#) Non Blocking mode functions with DMA are: (++) HAL_UART_Transmit_DMA() (++) HAL_UART_Receive_DMA() (#) A set of Transfer Complete Callbacks are provided in non blocking mode: (++) HAL_UART_TxCpltCallback() (++) HAL_UART_RxCpltCallback() (++) HAL_UART_ErrorCallback() [..] (@) In the Half duplex communication, it is forbidden to run the transmit and receive process in parallel, the UART state HAL_UART_STATE_BUSY_TX_RX can't be useful.
HAL_StatusTypeDef HAL_UART_Abort | ( | UART_HandleTypeDef * | huart | ) |
Abort ongoing transfers (blocking mode).
huart | UART handle. |
HAL | status |
Definition at line 1127 of file stm32f4xx_hal_uart.c.
References UART_HandleTypeDef::ErrorCode, UART_HandleTypeDef::gState, HAL_DMA_Abort(), HAL_UART_ERROR_NONE, HAL_UART_STATE_READY, UART_HandleTypeDef::hdmarx, UART_HandleTypeDef::hdmatx, UART_HandleTypeDef::Instance, UART_HandleTypeDef::RxState, UART_HandleTypeDef::RxXferCount, UART_HandleTypeDef::TxXferCount, and __DMA_HandleTypeDef::XferAbortCallback.
HAL_StatusTypeDef HAL_UART_Abort_IT | ( | UART_HandleTypeDef * | huart | ) |
Abort ongoing transfers (Interrupt mode).
huart | UART handle. |
HAL | status |
Definition at line 1278 of file stm32f4xx_hal_uart.c.
References UART_HandleTypeDef::ErrorCode, UART_HandleTypeDef::gState, HAL_DMA_Abort_IT(), HAL_UART_AbortCpltCallback(), HAL_UART_ERROR_NONE, HAL_UART_STATE_READY, UART_HandleTypeDef::hdmarx, UART_HandleTypeDef::hdmatx, UART_HandleTypeDef::Instance, UART_HandleTypeDef::RxState, UART_HandleTypeDef::RxXferCount, UART_HandleTypeDef::TxXferCount, UART_DMARxAbortCallback(), UART_DMATxAbortCallback(), and __DMA_HandleTypeDef::XferAbortCallback.
void HAL_UART_AbortCpltCallback | ( | UART_HandleTypeDef * | huart | ) |
UART Abort Complete callback.
huart | UART handle. |
None |
Definition at line 1724 of file stm32f4xx_hal_uart.c.
Referenced by HAL_UART_Abort_IT(), UART_DMARxAbortCallback(), and UART_DMATxAbortCallback().
HAL_StatusTypeDef HAL_UART_AbortReceive | ( | UART_HandleTypeDef * | huart | ) |
Abort ongoing Receive transfer (blocking mode).
huart | UART handle. |
HAL | status |
Definition at line 1233 of file stm32f4xx_hal_uart.c.
References HAL_DMA_Abort(), HAL_UART_STATE_READY, UART_HandleTypeDef::hdmarx, UART_HandleTypeDef::Instance, UART_HandleTypeDef::RxState, UART_HandleTypeDef::RxXferCount, and __DMA_HandleTypeDef::XferAbortCallback.
HAL_StatusTypeDef HAL_UART_AbortReceive_IT | ( | UART_HandleTypeDef * | huart | ) |
Abort ongoing Receive transfer (Interrupt mode).
huart | UART handle. |
HAL | status |
Definition at line 1465 of file stm32f4xx_hal_uart.c.
References HAL_DMA_Abort_IT(), HAL_UART_AbortReceiveCpltCallback(), HAL_UART_STATE_READY, UART_HandleTypeDef::hdmarx, UART_HandleTypeDef::Instance, UART_HandleTypeDef::RxState, UART_HandleTypeDef::RxXferCount, UART_DMARxOnlyAbortCallback(), and __DMA_HandleTypeDef::XferAbortCallback.
void HAL_UART_AbortReceiveCpltCallback | ( | UART_HandleTypeDef * | huart | ) |
UART Abort Receive Complete callback.
huart | UART handle. |
None |
Definition at line 1753 of file stm32f4xx_hal_uart.c.
Referenced by HAL_UART_AbortReceive_IT(), and UART_DMARxOnlyAbortCallback().
HAL_StatusTypeDef HAL_UART_AbortTransmit | ( | UART_HandleTypeDef * | huart | ) |
Abort ongoing Transmit transfer (blocking mode).
huart | UART handle. |
HAL | status |
Definition at line 1191 of file stm32f4xx_hal_uart.c.
References UART_HandleTypeDef::gState, HAL_DMA_Abort(), HAL_UART_STATE_READY, UART_HandleTypeDef::hdmatx, UART_HandleTypeDef::Instance, UART_HandleTypeDef::TxXferCount, and __DMA_HandleTypeDef::XferAbortCallback.
HAL_StatusTypeDef HAL_UART_AbortTransmit_IT | ( | UART_HandleTypeDef * | huart | ) |
Abort ongoing Transmit transfer (Interrupt mode).
huart | UART handle. |
HAL | status |
Definition at line 1400 of file stm32f4xx_hal_uart.c.
References UART_HandleTypeDef::gState, HAL_DMA_Abort_IT(), HAL_UART_AbortTransmitCpltCallback(), HAL_UART_STATE_READY, UART_HandleTypeDef::hdmatx, UART_HandleTypeDef::Instance, UART_HandleTypeDef::TxXferCount, UART_DMATxOnlyAbortCallback(), and __DMA_HandleTypeDef::XferAbortCallback.
void HAL_UART_AbortTransmitCpltCallback | ( | UART_HandleTypeDef * | huart | ) |
UART Abort Complete callback.
huart | UART handle. |
None |
Definition at line 1738 of file stm32f4xx_hal_uart.c.
Referenced by HAL_UART_AbortTransmit_IT(), and UART_DMATxOnlyAbortCallback().
HAL_StatusTypeDef HAL_UART_DMAPause | ( | UART_HandleTypeDef * | huart | ) |
Pauses the DMA Transfer.
huart | pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. |
HAL | status |
Definition at line 1005 of file stm32f4xx_hal_uart.c.
References UART_HandleTypeDef::gState, HAL_UART_STATE_BUSY_RX, HAL_UART_STATE_BUSY_TX, UART_HandleTypeDef::Instance, and UART_HandleTypeDef::RxState.
HAL_StatusTypeDef HAL_UART_DMAResume | ( | UART_HandleTypeDef * | huart | ) |
Resumes the DMA Transfer.
huart | pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. |
HAL | status |
Definition at line 1040 of file stm32f4xx_hal_uart.c.
References __HAL_UART_CLEAR_OREFLAG, UART_HandleTypeDef::gState, HAL_UART_STATE_BUSY_RX, HAL_UART_STATE_BUSY_TX, UART_HandleTypeDef::Instance, and UART_HandleTypeDef::RxState.
HAL_StatusTypeDef HAL_UART_DMAStop | ( | UART_HandleTypeDef * | huart | ) |
Stops the DMA Transfer.
huart | pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. |
HAL | status |
Definition at line 1075 of file stm32f4xx_hal_uart.c.
References UART_HandleTypeDef::gState, HAL_DMA_Abort(), HAL_UART_STATE_BUSY_RX, HAL_UART_STATE_BUSY_TX, UART_HandleTypeDef::hdmarx, UART_HandleTypeDef::hdmatx, UART_HandleTypeDef::Instance, UART_HandleTypeDef::RxState, UART_EndRxTransfer(), and UART_EndTxTransfer().
void HAL_UART_ErrorCallback | ( | UART_HandleTypeDef * | huart | ) |
UART error callbacks.
huart | pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. |
None |
Definition at line 1710 of file stm32f4xx_hal_uart.c.
Referenced by HAL_UART_IRQHandler(), UART_DMAAbortOnError(), and UART_DMAError().
void HAL_UART_IRQHandler | ( | UART_HandleTypeDef * | huart | ) |
This function handles UART interrupt request.
huart | pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. |
None |
Definition at line 1523 of file stm32f4xx_hal_uart.c.
References UART_HandleTypeDef::ErrorCode, HAL_DMA_Abort_IT(), HAL_UART_ERROR_FE, HAL_UART_ERROR_NE, HAL_UART_ERROR_NONE, HAL_UART_ERROR_ORE, HAL_UART_ERROR_PE, HAL_UART_ErrorCallback(), UART_HandleTypeDef::hdmarx, UART_HandleTypeDef::Instance, UART_DMAAbortOnError(), UART_EndRxTransfer(), UART_EndTransmit_IT(), UART_Receive_IT(), UART_Transmit_IT(), and __DMA_HandleTypeDef::XferAbortCallback.
HAL_StatusTypeDef HAL_UART_Receive | ( | UART_HandleTypeDef * | huart, |
uint8_t * | pData, | ||
uint16_t | Size, | ||
uint32_t | Timeout | ||
) |
Receives an amount of data in blocking mode.
huart | pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. |
pData | Pointer to data buffer |
Size | Amount of data to be received |
Timeout | Timeout duration |
HAL | status |
Definition at line 698 of file stm32f4xx_hal_uart.c.
References UART_HandleTypeDef::ErrorCode, HAL_GetTick(), HAL_UART_ERROR_NONE, HAL_UART_STATE_BUSY_RX, HAL_UART_STATE_READY, UART_HandleTypeDef::Init, UART_HandleTypeDef::Instance, UART_InitTypeDef::Parity, UART_HandleTypeDef::RxState, UART_HandleTypeDef::RxXferCount, UART_HandleTypeDef::RxXferSize, UART_FLAG_RXNE, UART_PARITY_NONE, UART_WaitOnFlagUntilTimeout(), UART_WORDLENGTH_9B, and UART_InitTypeDef::WordLength.
HAL_StatusTypeDef HAL_UART_Receive_DMA | ( | UART_HandleTypeDef * | huart, |
uint8_t * | pData, | ||
uint16_t | Size | ||
) |
Receives an amount of data in non blocking mode.
huart | pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. |
pData | Pointer to data buffer |
Size | Amount of data to be received |
HAL | status |
Definition at line 938 of file stm32f4xx_hal_uart.c.
References __HAL_UART_CLEAR_OREFLAG, UART_HandleTypeDef::ErrorCode, HAL_DMA_Start_IT(), HAL_UART_ERROR_NONE, HAL_UART_STATE_BUSY_RX, HAL_UART_STATE_READY, UART_HandleTypeDef::hdmarx, UART_HandleTypeDef::Instance, UART_HandleTypeDef::pRxBuffPtr, UART_HandleTypeDef::RxState, UART_HandleTypeDef::RxXferSize, UART_DMAError(), UART_DMAReceiveCplt(), UART_DMARxHalfCplt(), __DMA_HandleTypeDef::XferAbortCallback, __DMA_HandleTypeDef::XferCpltCallback, __DMA_HandleTypeDef::XferErrorCallback, and __DMA_HandleTypeDef::XferHalfCpltCallback.
HAL_StatusTypeDef HAL_UART_Receive_IT | ( | UART_HandleTypeDef * | huart, |
uint8_t * | pData, | ||
uint16_t | Size | ||
) |
Receives an amount of data in non blocking mode.
huart | pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. |
pData | Pointer to data buffer |
Size | Amount of data to be received |
HAL | status |
Definition at line 828 of file stm32f4xx_hal_uart.c.
References UART_HandleTypeDef::ErrorCode, HAL_UART_ERROR_NONE, HAL_UART_STATE_BUSY_RX, HAL_UART_STATE_READY, UART_HandleTypeDef::Instance, UART_HandleTypeDef::pRxBuffPtr, UART_HandleTypeDef::RxState, UART_HandleTypeDef::RxXferCount, and UART_HandleTypeDef::RxXferSize.
void HAL_UART_RxCpltCallback | ( | UART_HandleTypeDef * | huart | ) |
Rx Transfer completed callbacks.
huart | pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. |
None |
Definition at line 1680 of file stm32f4xx_hal_uart.c.
Referenced by UART_DMAReceiveCplt(), and UART_Receive_IT().
void HAL_UART_RxHalfCpltCallback | ( | UART_HandleTypeDef * | huart | ) |
Rx Half Transfer completed callbacks.
huart | pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. |
None |
Definition at line 1695 of file stm32f4xx_hal_uart.c.
Referenced by UART_DMARxHalfCplt().
HAL_StatusTypeDef HAL_UART_Transmit | ( | UART_HandleTypeDef * | huart, |
uint8_t * | pData, | ||
uint16_t | Size, | ||
uint32_t | Timeout | ||
) |
Sends an amount of data in blocking mode.
huart | pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. |
pData | Pointer to data buffer |
Size | Amount of data to be sent |
Timeout | Timeout duration |
HAL | status |
Definition at line 616 of file stm32f4xx_hal_uart.c.
References UART_HandleTypeDef::ErrorCode, UART_HandleTypeDef::gState, HAL_GetTick(), HAL_UART_ERROR_NONE, HAL_UART_STATE_BUSY_TX, HAL_UART_STATE_READY, UART_HandleTypeDef::Init, UART_HandleTypeDef::Instance, UART_InitTypeDef::Parity, UART_HandleTypeDef::TxXferCount, UART_HandleTypeDef::TxXferSize, UART_FLAG_TC, UART_FLAG_TXE, UART_PARITY_NONE, UART_WaitOnFlagUntilTimeout(), UART_WORDLENGTH_9B, and UART_InitTypeDef::WordLength.
HAL_StatusTypeDef HAL_UART_Transmit_DMA | ( | UART_HandleTypeDef * | huart, |
uint8_t * | pData, | ||
uint16_t | Size | ||
) |
Sends an amount of data in non blocking mode.
huart | pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. |
pData | Pointer to data buffer |
Size | Amount of data to be sent |
HAL | status |
Definition at line 873 of file stm32f4xx_hal_uart.c.
References __HAL_UART_CLEAR_FLAG, UART_HandleTypeDef::ErrorCode, UART_HandleTypeDef::gState, HAL_DMA_Start_IT(), HAL_UART_ERROR_NONE, HAL_UART_STATE_BUSY_TX, HAL_UART_STATE_READY, UART_HandleTypeDef::hdmatx, UART_HandleTypeDef::Instance, UART_HandleTypeDef::pTxBuffPtr, UART_HandleTypeDef::TxXferCount, UART_HandleTypeDef::TxXferSize, UART_DMAError(), UART_DMATransmitCplt(), UART_DMATxHalfCplt(), UART_FLAG_TC, __DMA_HandleTypeDef::XferAbortCallback, __DMA_HandleTypeDef::XferCpltCallback, __DMA_HandleTypeDef::XferErrorCallback, and __DMA_HandleTypeDef::XferHalfCpltCallback.
HAL_StatusTypeDef HAL_UART_Transmit_IT | ( | UART_HandleTypeDef * | huart, |
uint8_t * | pData, | ||
uint16_t | Size | ||
) |
Sends an amount of data in non blocking mode.
huart | pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. |
pData | Pointer to data buffer |
Size | Amount of data to be sent |
HAL | status |
Definition at line 786 of file stm32f4xx_hal_uart.c.
References UART_HandleTypeDef::ErrorCode, UART_HandleTypeDef::gState, HAL_UART_ERROR_NONE, HAL_UART_STATE_BUSY_TX, HAL_UART_STATE_READY, UART_HandleTypeDef::Instance, UART_HandleTypeDef::pTxBuffPtr, UART_HandleTypeDef::TxXferCount, and UART_HandleTypeDef::TxXferSize.
void HAL_UART_TxCpltCallback | ( | UART_HandleTypeDef * | huart | ) |
Tx Transfer completed callbacks.
huart | pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. |
None |
Definition at line 1650 of file stm32f4xx_hal_uart.c.
Referenced by UART_DMATransmitCplt(), and UART_EndTransmit_IT().
void HAL_UART_TxHalfCpltCallback | ( | UART_HandleTypeDef * | huart | ) |
Tx Half Transfer completed callbacks.
huart | pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module. |
None |
Definition at line 1665 of file stm32f4xx_hal_uart.c.
Referenced by UART_DMATxHalfCplt().