STM32F103xB HAL User Manual
Functions
IO operation functions
UART Exported Functions

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 DMA mode.
HAL_StatusTypeDef HAL_UART_Receive_DMA (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
 Receives an amount of data in DMA 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_UARTEx_ReceiveToIdle (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint16_t *RxLen, uint32_t Timeout)
 Receive an amount of data in blocking mode till either the expected number of data is received or an IDLE event occurs.
HAL_StatusTypeDef HAL_UARTEx_ReceiveToIdle_IT (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
 Receive an amount of data in interrupt mode till either the expected number of data is received or an IDLE event occurs.
HAL_StatusTypeDef HAL_UARTEx_ReceiveToIdle_DMA (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
 Receive an amount of data in DMA mode till either the expected number of data is received or an IDLE event occurs.
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.
__weak void HAL_UARTEx_RxEventCallback (UART_HandleTypeDef *huart, uint16_t Size)
 Reception Event Callback (Rx event notification called after use of advanced reception service).

Detailed Description

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 API's 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 API's are :
        (+) HAL_UART_Transmit()
        (+) HAL_UART_Receive()

    (#) Non-Blocking mode API's with Interrupt are :
        (+) HAL_UART_Transmit_IT()
        (+) HAL_UART_Receive_IT()
        (+) HAL_UART_IRQHandler()

    (#) Non-Blocking mode API's with DMA are :
        (+) HAL_UART_Transmit_DMA()
        (+) HAL_UART_Receive_DMA()
        (+) HAL_UART_DMAPause()
        (+) HAL_UART_DMAResume()
        (+) HAL_UART_DMAStop()

    (#) A set of Transfer Complete Callbacks are provided in Non_Blocking mode:
        (+) HAL_UART_TxHalfCpltCallback()
        (+) HAL_UART_TxCpltCallback()
        (+) HAL_UART_RxHalfCpltCallback()
        (+) HAL_UART_RxCpltCallback()
        (+) HAL_UART_ErrorCallback()

    (#) Non-Blocking mode transfers could be aborted using Abort API's :
        (+) HAL_UART_Abort()
        (+) HAL_UART_AbortTransmit()
        (+) HAL_UART_AbortReceive()
        (+) HAL_UART_Abort_IT()
        (+) HAL_UART_AbortTransmit_IT()
        (+) HAL_UART_AbortReceive_IT()

    (#) For Abort services based on interrupts (HAL_UART_Abortxxx_IT), a set of Abort Complete Callbacks are provided:
        (+) HAL_UART_AbortCpltCallback()
        (+) HAL_UART_AbortTransmitCpltCallback()
        (+) HAL_UART_AbortReceiveCpltCallback()

    (#) A Rx Event Reception Callback (Rx event notification) is available for Non_Blocking modes of enhanced reception services:
        (+) HAL_UARTEx_RxEventCallback()

    (#) In Non-Blocking mode transfers, possible errors are split into 2 categories.
        Errors are handled as follows :
       (+) Error is considered as Recoverable and non blocking : Transfer could go till end, but error severity is
           to be evaluated by user : this concerns Frame Error, Parity Error or Noise Error in Interrupt mode reception .
           Received character is then retrieved and stored in Rx buffer, Error code is set to allow user to identify error type,
           and HAL_UART_ErrorCallback() user callback is executed. Transfer is kept ongoing on UART side.
           If user wants to abort it, Abort services should be called by user.
       (+) Error is considered as Blocking : Transfer could not be completed properly and is aborted.
           This concerns Overrun Error In Interrupt mode reception and all errors in DMA mode.
           Error code is set to allow user to identify error type, and HAL_UART_ErrorCallback() user callback is executed.

    -@- 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.


Function Documentation

HAL_StatusTypeDef HAL_UART_Abort ( UART_HandleTypeDef huart)

Abort ongoing transfers (blocking mode).

Parameters:
huartUART handle.
Note:
This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode. This procedure performs following operations :
  • Disable UART Interrupts (Tx and Rx)
  • Disable the DMA transfer in the peripheral register (if enabled)
  • Abort DMA transfer by calling HAL_DMA_Abort (in case of transfer in DMA mode)
  • Set handle State to READY
This procedure is executed in blocking mode : when exiting function, Abort is considered as completed.
Return values:
HALstatus

Definition at line 1865 of file stm32f1xx_hal_uart.c.

References __UART_HandleTypeDef::ErrorCode, __UART_HandleTypeDef::gState, HAL_DMA_Abort(), HAL_DMA_ERROR_TIMEOUT, HAL_DMA_GetError(), HAL_UART_ERROR_DMA, HAL_UART_ERROR_NONE, HAL_UART_RECEPTION_STANDARD, HAL_UART_RECEPTION_TOIDLE, HAL_UART_STATE_READY, __UART_HandleTypeDef::hdmarx, __UART_HandleTypeDef::hdmatx, __UART_HandleTypeDef::Instance, __UART_HandleTypeDef::ReceptionType, __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).

Parameters:
huartUART handle.
Note:
This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode. This procedure performs following operations :
  • Disable UART Interrupts (Tx and Rx)
  • Disable the DMA transfer in the peripheral register (if enabled)
  • Abort DMA transfer by calling HAL_DMA_Abort_IT (in case of transfer in DMA mode)
  • Set handle State to READY
  • At abort completion, call user abort complete callback
This procedure is executed in Interrupt mode, meaning that abort procedure could be considered as completed only when user abort complete callback is executed (not when exiting function).
Return values:
HALstatus

Definition at line 2066 of file stm32f1xx_hal_uart.c.

References __UART_HandleTypeDef::AbortCpltCallback, __UART_HandleTypeDef::ErrorCode, __UART_HandleTypeDef::gState, HAL_DMA_Abort_IT(), HAL_UART_AbortCpltCallback(), HAL_UART_ERROR_NONE, HAL_UART_RECEPTION_STANDARD, HAL_UART_RECEPTION_TOIDLE, HAL_UART_STATE_READY, __UART_HandleTypeDef::hdmarx, __UART_HandleTypeDef::hdmatx, __UART_HandleTypeDef::Instance, __UART_HandleTypeDef::ReceptionType, __UART_HandleTypeDef::RxState, __UART_HandleTypeDef::RxXferCount, __UART_HandleTypeDef::TxXferCount, UART_DMARxAbortCallback(), UART_DMATxAbortCallback(), and __DMA_HandleTypeDef::XferAbortCallback.

UART Abort Complete callback.

Parameters:
huartUART handle.
Return values:
None

Definition at line 2660 of file stm32f1xx_hal_uart.c.

Referenced by HAL_UART_Abort_IT(), HAL_UART_UnRegisterCallback(), UART_DMARxAbortCallback(), UART_DMATxAbortCallback(), and UART_InitCallbacksToDefault().

HAL_StatusTypeDef HAL_UART_AbortReceive ( UART_HandleTypeDef huart)

Abort ongoing Receive transfer (blocking mode).

Parameters:
huartUART handle.
Note:
This procedure could be used for aborting any ongoing Rx transfer started in Interrupt or DMA mode. This procedure performs following operations :
  • Disable UART Interrupts (Rx)
  • Disable the DMA transfer in the peripheral register (if enabled)
  • Abort DMA transfer by calling HAL_DMA_Abort (in case of transfer in DMA mode)
  • Set handle State to READY
This procedure is executed in blocking mode : when exiting function, Abort is considered as completed.
Return values:
HALstatus

Definition at line 2005 of file stm32f1xx_hal_uart.c.

References __UART_HandleTypeDef::ErrorCode, HAL_DMA_Abort(), HAL_DMA_ERROR_TIMEOUT, HAL_DMA_GetError(), HAL_UART_ERROR_DMA, HAL_UART_RECEPTION_STANDARD, HAL_UART_RECEPTION_TOIDLE, HAL_UART_STATE_READY, __UART_HandleTypeDef::hdmarx, __UART_HandleTypeDef::Instance, __UART_HandleTypeDef::ReceptionType, __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).

Parameters:
huartUART handle.
Note:
This procedure could be used for aborting any ongoing Rx transfer started in Interrupt or DMA mode. This procedure performs following operations :
  • Disable UART Interrupts (Rx)
  • Disable the DMA transfer in the peripheral register (if enabled)
  • Abort DMA transfer by calling HAL_DMA_Abort_IT (in case of transfer in DMA mode)
  • Set handle State to READY
  • At abort completion, call user abort complete callback
This procedure is executed in Interrupt mode, meaning that abort procedure could be considered as completed only when user abort complete callback is executed (not when exiting function).
Return values:
HALstatus

Definition at line 2278 of file stm32f1xx_hal_uart.c.

References __UART_HandleTypeDef::AbortReceiveCpltCallback, HAL_DMA_Abort_IT(), HAL_UART_AbortReceiveCpltCallback(), HAL_UART_RECEPTION_STANDARD, HAL_UART_RECEPTION_TOIDLE, HAL_UART_STATE_READY, __UART_HandleTypeDef::hdmarx, __UART_HandleTypeDef::Instance, __UART_HandleTypeDef::ReceptionType, __UART_HandleTypeDef::RxState, __UART_HandleTypeDef::RxXferCount, UART_DMARxOnlyAbortCallback(), and __DMA_HandleTypeDef::XferAbortCallback.

UART Abort Receive Complete callback.

Parameters:
huartUART handle.
Return values:
None

Definition at line 2690 of file stm32f1xx_hal_uart.c.

Referenced by HAL_UART_AbortReceive_IT(), HAL_UART_UnRegisterCallback(), UART_DMARxOnlyAbortCallback(), and UART_InitCallbacksToDefault().

HAL_StatusTypeDef HAL_UART_AbortTransmit ( UART_HandleTypeDef huart)

Abort ongoing Transmit transfer (blocking mode).

Parameters:
huartUART handle.
Note:
This procedure could be used for aborting any ongoing Tx transfer started in Interrupt or DMA mode. This procedure performs following operations :
  • Disable UART Interrupts (Tx)
  • Disable the DMA transfer in the peripheral register (if enabled)
  • Abort DMA transfer by calling HAL_DMA_Abort (in case of transfer in DMA mode)
  • Set handle State to READY
This procedure is executed in blocking mode : when exiting function, Abort is considered as completed.
Return values:
HALstatus

Definition at line 1954 of file stm32f1xx_hal_uart.c.

References __UART_HandleTypeDef::ErrorCode, __UART_HandleTypeDef::gState, HAL_DMA_Abort(), HAL_DMA_ERROR_TIMEOUT, HAL_DMA_GetError(), HAL_UART_ERROR_DMA, 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).

Parameters:
huartUART handle.
Note:
This procedure could be used for aborting any ongoing Tx transfer started in Interrupt or DMA mode. This procedure performs following operations :
  • Disable UART Interrupts (Tx)
  • Disable the DMA transfer in the peripheral register (if enabled)
  • Abort DMA transfer by calling HAL_DMA_Abort_IT (in case of transfer in DMA mode)
  • Set handle State to READY
  • At abort completion, call user abort complete callback
This procedure is executed in Interrupt mode, meaning that abort procedure could be considered as completed only when user abort complete callback is executed (not when exiting function).
Return values:
HALstatus

Definition at line 2201 of file stm32f1xx_hal_uart.c.

References __UART_HandleTypeDef::AbortTransmitCpltCallback, __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.

UART Abort Complete callback.

Parameters:
huartUART handle.
Return values:
None

Definition at line 2675 of file stm32f1xx_hal_uart.c.

Referenced by HAL_UART_AbortTransmit_IT(), HAL_UART_UnRegisterCallback(), UART_DMATxOnlyAbortCallback(), and UART_InitCallbacksToDefault().

HAL_StatusTypeDef HAL_UART_DMAPause ( UART_HandleTypeDef huart)

Pauses the DMA Transfer.

Parameters:
huartPointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Return values:
HALstatus

Definition at line 1493 of file stm32f1xx_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.

Parameters:
huartPointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Return values:
HALstatus

Definition at line 1530 of file stm32f1xx_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.

Parameters:
huartPointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Return values:
HALstatus

Definition at line 1566 of file stm32f1xx_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().

UART error callbacks.

Parameters:
huartPointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Return values:
None

Definition at line 2646 of file stm32f1xx_hal_uart.c.

Referenced by HAL_UART_IRQHandler(), HAL_UART_UnRegisterCallback(), UART_DMAAbortOnError(), UART_DMAError(), and UART_InitCallbacksToDefault().

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.

Note:
When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01), the received data is handled as a set of u16. In this case, Size must indicate the number of u16 available through pData.
Parameters:
huartPointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
pDataPointer to data buffer (u8 or u16 data elements).
SizeAmount of data elements (u8 or u16) to be received.
TimeoutTimeout duration
Return values:
HALstatus

Definition at line 1224 of file stm32f1xx_hal_uart.c.

References __UART_HandleTypeDef::ErrorCode, HAL_GetTick(), HAL_UART_ERROR_NONE, HAL_UART_RECEPTION_STANDARD, HAL_UART_STATE_BUSY_RX, HAL_UART_STATE_READY, __UART_HandleTypeDef::Init, __UART_HandleTypeDef::Instance, UART_InitTypeDef::Parity, __UART_HandleTypeDef::ReceptionType, __UART_HandleTypeDef::RxState, __UART_HandleTypeDef::RxXferCount, __UART_HandleTypeDef::RxXferSize, UART_FLAG_RXNE, UART_PARITY_NONE, UART_WaitOnFlagUntilTimeout(), UART_WORDLENGTH_8B, 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 DMA mode.

Note:
When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01), the received data is handled as a set of u16. In this case, Size must indicate the number of u16 available through pData.
Parameters:
huartPointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
pDataPointer to data buffer (u8 or u16 data elements).
SizeAmount of data elements (u8 or u16) to be received.
Note:
When the UART parity is enabled (PCE = 1) the received data contains the parity bit.
Return values:
HALstatus

Definition at line 1463 of file stm32f1xx_hal_uart.c.

References HAL_UART_RECEPTION_STANDARD, HAL_UART_STATE_READY, __UART_HandleTypeDef::ReceptionType, __UART_HandleTypeDef::RxState, and UART_Start_Receive_DMA().

HAL_StatusTypeDef HAL_UART_Receive_IT ( UART_HandleTypeDef huart,
uint8_t *  pData,
uint16_t  Size 
)

Receives an amount of data in non blocking mode.

Note:
When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01), the received data is handled as a set of u16. In this case, Size must indicate the number of u16 available through pData.
Parameters:
huartPointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
pDataPointer to data buffer (u8 or u16 data elements).
SizeAmount of data elements (u8 or u16) to be received.
Return values:
HALstatus

Definition at line 1360 of file stm32f1xx_hal_uart.c.

References HAL_UART_RECEPTION_STANDARD, HAL_UART_STATE_READY, __UART_HandleTypeDef::ReceptionType, __UART_HandleTypeDef::RxState, and UART_Start_Receive_IT().

Rx Transfer completed callbacks.

Parameters:
huartPointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Return values:
None

Definition at line 2616 of file stm32f1xx_hal_uart.c.

Referenced by HAL_UART_UnRegisterCallback(), UART_DMAReceiveCplt(), UART_InitCallbacksToDefault(), and UART_Receive_IT().

Rx Half Transfer completed callbacks.

Parameters:
huartPointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Return values:
None

Definition at line 2631 of file stm32f1xx_hal_uart.c.

Referenced by HAL_UART_UnRegisterCallback(), UART_DMARxHalfCplt(), and UART_InitCallbacksToDefault().

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.

Note:
When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01), the sent data is handled as a set of u16. In this case, Size must indicate the number of u16 provided through pData.
Parameters:
huartPointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
pDataPointer to data buffer (u8 or u16 data elements).
SizeAmount of data elements (u8 or u16) to be sent
TimeoutTimeout duration
Return values:
HALstatus

Definition at line 1136 of file stm32f1xx_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 DMA mode.

Note:
When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01), the sent data is handled as a set of u16. In this case, Size must indicate the number of u16 provided through pData.
Parameters:
huartPointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
pDataPointer to data buffer (u8 or u16 data elements).
SizeAmount of data elements (u8 or u16) to be sent
Return values:
HALstatus

Definition at line 1395 of file stm32f1xx_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.

Note:
When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01), the sent data is handled as a set of u16. In this case, Size must indicate the number of u16 provided through pData.
Parameters:
huartPointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
pDataPointer to data buffer (u8 or u16 data elements).
SizeAmount of data elements (u8 or u16) to be sent
Return values:
HALstatus

Definition at line 1315 of file stm32f1xx_hal_uart.c.

References __HAL_UART_ENABLE_IT, __UART_HandleTypeDef::ErrorCode, __UART_HandleTypeDef::gState, HAL_UART_ERROR_NONE, HAL_UART_STATE_BUSY_TX, HAL_UART_STATE_READY, __UART_HandleTypeDef::pTxBuffPtr, __UART_HandleTypeDef::TxXferCount, __UART_HandleTypeDef::TxXferSize, and UART_IT_TXE.

Tx Transfer completed callbacks.

Parameters:
huartPointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Return values:
None

Definition at line 2586 of file stm32f1xx_hal_uart.c.

Referenced by HAL_UART_UnRegisterCallback(), UART_DMATransmitCplt(), UART_EndTransmit_IT(), and UART_InitCallbacksToDefault().

Tx Half Transfer completed callbacks.

Parameters:
huartPointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Return values:
None

Definition at line 2601 of file stm32f1xx_hal_uart.c.

Referenced by HAL_UART_UnRegisterCallback(), UART_DMATxHalfCplt(), and UART_InitCallbacksToDefault().

HAL_StatusTypeDef HAL_UARTEx_ReceiveToIdle ( UART_HandleTypeDef huart,
uint8_t *  pData,
uint16_t  Size,
uint16_t *  RxLen,
uint32_t  Timeout 
)

Receive an amount of data in blocking mode till either the expected number of data is received or an IDLE event occurs.

Note:
HAL_OK is returned if reception is completed (expected number of data has been received) or if reception is stopped after IDLE event (less than the expected number of data has been received) In this case, RxLen output parameter indicates number of data available in reception buffer.
When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M = 01), the received data is handled as a set of uint16_t. In this case, Size must indicate the number of uint16_t available through pData.
Parameters:
huartUART handle.
pDataPointer to data buffer (uint8_t or uint16_t data elements).
SizeAmount of data elements (uint8_t or uint16_t) to be received.
RxLenNumber of data elements finally received (could be lower than Size, in case reception ends on IDLE event)
TimeoutTimeout duration expressed in ms (covers the whole reception sequence).
Return values:
HALstatus

Definition at line 1621 of file stm32f1xx_hal_uart.c.

References __HAL_UART_CLEAR_IDLEFLAG, __HAL_UART_GET_FLAG, __UART_HandleTypeDef::ErrorCode, HAL_GetTick(), HAL_UART_ERROR_NONE, HAL_UART_RECEPTION_TOIDLE, HAL_UART_STATE_BUSY_RX, HAL_UART_STATE_READY, __UART_HandleTypeDef::Init, __UART_HandleTypeDef::Instance, UART_InitTypeDef::Parity, __UART_HandleTypeDef::ReceptionType, __UART_HandleTypeDef::RxState, __UART_HandleTypeDef::RxXferCount, __UART_HandleTypeDef::RxXferSize, UART_FLAG_IDLE, UART_FLAG_RXNE, UART_PARITY_NONE, UART_WORDLENGTH_8B, UART_WORDLENGTH_9B, and UART_InitTypeDef::WordLength.

HAL_StatusTypeDef HAL_UARTEx_ReceiveToIdle_DMA ( UART_HandleTypeDef huart,
uint8_t *  pData,
uint16_t  Size 
)

Receive an amount of data in DMA mode till either the expected number of data is received or an IDLE event occurs.

Note:
Reception is initiated by this function call. Further progress of reception is achieved thanks to DMA services, transferring automatically received data elements in user reception buffer and calling registered callbacks at half/end of reception. UART IDLE events are also used to consider reception phase as ended. In all cases, callback execution will indicate number of received data elements.
When the UART parity is enabled (PCE = 1), the received data contain the parity bit (MSB position).
When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M = 01), the received data is handled as a set of uint16_t. In this case, Size must indicate the number of uint16_t available through pData.
Parameters:
huartUART handle.
pDataPointer to data buffer (uint8_t or uint16_t data elements).
SizeAmount of data elements (uint8_t or uint16_t) to be received.
Return values:
HALstatus

Definition at line 1808 of file stm32f1xx_hal_uart.c.

References __HAL_UART_CLEAR_IDLEFLAG, HAL_UART_RECEPTION_TOIDLE, HAL_UART_STATE_READY, __UART_HandleTypeDef::Instance, __UART_HandleTypeDef::ReceptionType, __UART_HandleTypeDef::RxState, and UART_Start_Receive_DMA().

HAL_StatusTypeDef HAL_UARTEx_ReceiveToIdle_IT ( UART_HandleTypeDef huart,
uint8_t *  pData,
uint16_t  Size 
)

Receive an amount of data in interrupt mode till either the expected number of data is received or an IDLE event occurs.

Note:
Reception is initiated by this function call. Further progress of reception is achieved thanks to UART interrupts raised by RXNE and IDLE events. Callback is called at end of reception indicating number of received data elements.
When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M = 01), the received data is handled as a set of uint16_t. In this case, Size must indicate the number of uint16_t available through pData.
Parameters:
huartUART handle.
pDataPointer to data buffer (uint8_t or uint16_t data elements).
SizeAmount of data elements (uint8_t or uint16_t) to be received.
Return values:
HALstatus

Definition at line 1747 of file stm32f1xx_hal_uart.c.

References __HAL_UART_CLEAR_IDLEFLAG, HAL_UART_RECEPTION_TOIDLE, HAL_UART_STATE_READY, __UART_HandleTypeDef::Instance, __UART_HandleTypeDef::ReceptionType, __UART_HandleTypeDef::RxState, and UART_Start_Receive_IT().

void HAL_UARTEx_RxEventCallback ( UART_HandleTypeDef huart,
uint16_t  Size 
)

Reception Event Callback (Rx event notification called after use of advanced reception service).

Parameters:
huartUART handle
SizeNumber of data available in application reception buffer (indicates a position in reception buffer until which, data are available)
Return values:
None

Definition at line 2707 of file stm32f1xx_hal_uart.c.

Referenced by HAL_UART_IRQHandler(), HAL_UART_UnRegisterRxEventCallback(), UART_DMAReceiveCplt(), UART_DMARxHalfCplt(), UART_InitCallbacksToDefault(), and UART_Receive_IT().