Arrow / Mbed OS DAPLink Reset
Embed: (wiki syntax)

« Back to documentation index

IO operation functions

IO operation functions
[USART Exported Functions]

USART Transmit and Receive functions. More...

Functions

HAL_StatusTypeDef HAL_USART_Transmit (USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size, uint32_t Timeout)
 Simplex Send an amount of data in blocking mode.
HAL_StatusTypeDef HAL_USART_Receive (USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size, uint32_t Timeout)
 Full-Duplex Receive an amount of data in blocking mode.
HAL_StatusTypeDef HAL_USART_TransmitReceive (USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout)
 Full-Duplex Send receive an amount of data in full-duplex mode (blocking mode).
HAL_StatusTypeDef HAL_USART_Transmit_IT (USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size)
 Simplex Send an amount of data in non-blocking mode.
HAL_StatusTypeDef HAL_USART_Receive_IT (USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size)
 Simplex Receive an amount of data in non-blocking mode.
HAL_StatusTypeDef HAL_USART_TransmitReceive_IT (USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size)
 Full-Duplex Send receive an amount of data in full-duplex mode (non-blocking).
HAL_StatusTypeDef HAL_USART_Transmit_DMA (USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size)
 Simplex Send an amount of data in non-blocking mode.
HAL_StatusTypeDef HAL_USART_Receive_DMA (USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size)
 Full-Duplex Receive an amount of data in non-blocking mode.
HAL_StatusTypeDef HAL_USART_TransmitReceive_DMA (USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size)
 Full-Duplex Transmit Receive an amount of data in non-blocking mode.
HAL_StatusTypeDef HAL_USART_DMAPause (USART_HandleTypeDef *husart)
 Pauses the DMA Transfer.
HAL_StatusTypeDef HAL_USART_DMAResume (USART_HandleTypeDef *husart)
 Resumes the DMA Transfer.
HAL_StatusTypeDef HAL_USART_DMAStop (USART_HandleTypeDef *husart)
 Stops the DMA Transfer.
void HAL_USART_IRQHandler (USART_HandleTypeDef *husart)
 This function handles USART interrupt request.
__weak void HAL_USART_TxCpltCallback (USART_HandleTypeDef *husart)
 Tx Transfer completed callbacks.
__weak void HAL_USART_TxHalfCpltCallback (USART_HandleTypeDef *husart)
 Tx Half Transfer completed callbacks.
__weak void HAL_USART_RxCpltCallback (USART_HandleTypeDef *husart)
 Rx Transfer completed callbacks.
__weak void HAL_USART_RxHalfCpltCallback (USART_HandleTypeDef *husart)
 Rx Half Transfer completed callbacks.
__weak void HAL_USART_TxRxCpltCallback (USART_HandleTypeDef *husart)
 Tx/Rx Transfers completed callback for the non-blocking process.
__weak void HAL_USART_ErrorCallback (USART_HandleTypeDef *husart)
 USART error callbacks.

Detailed Description

USART Transmit and Receive functions.

  ==============================================================================
                         ##### IO operation functions #####
  ==============================================================================
  [..]
    This subsection provides a set of functions allowing to manage the USART synchronous
    data transfers.
      
  [..] 
    The USART supports master mode only: it cannot receive or send data related to an input
    clock (SCLK is always an output).

    (#) 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.  
        (++) No-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 USART IRQ when using Interrupt mode or the DMA IRQ when 
             using DMA mode.
             The HAL_USART_TxCpltCallback(), HAL_USART_RxCpltCallback() and HAL_USART_TxRxCpltCallback() 
             user callbacks 
             will be executed respectively at the end of the transmit or Receive process
             The HAL_USART_ErrorCallback() user callback will be executed when a communication 
             error is detected

    (#) Blocking mode APIs are :
        (++) HAL_USART_Transmit() in simplex mode
        (++) HAL_USART_Receive() in full duplex receive only
        (++) HAL_USART_TransmitReceive() in full duplex mode

    (#) Non Blocking mode APIs with Interrupt are :
        (++) HAL_USART_Transmit_IT()in simplex mode
        (++) HAL_USART_Receive_IT() in full duplex receive only
        (++) HAL_USART_TransmitReceive_IT() in full duplex mode
        (++) HAL_USART_IRQHandler()

    (#) Non Blocking mode functions with DMA are :
        (++) HAL_USART_Transmit_DMA()in simplex mode
        (++) HAL_USART_Receive_DMA() in full duplex receive only
        (++) HAL_USART_TransmitReceive_DMA() in full duplex mode
        (++) HAL_USART_DMAPause()
        (++) HAL_USART_DMAResume()
        (++) HAL_USART_DMAStop()

    (#) A set of Transfer Complete Callbacks are provided in non Blocking mode:
        (++) HAL_USART_TxHalfCpltCallback()
        (++) HAL_USART_TxCpltCallback()
        (++) HAL_USART_RxHalfCpltCallback()
        (++) HAL_USART_RxCpltCallback()
        (++) HAL_USART_ErrorCallback()
        (++) HAL_USART_TxRxCpltCallback()


Function Documentation

HAL_StatusTypeDef HAL_USART_DMAPause ( USART_HandleTypeDef *  husart )

Pauses the DMA Transfer.

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values:
HALstatus

Definition at line 1075 of file stm32f1xx_hal_usart.c.

HAL_StatusTypeDef HAL_USART_DMAResume ( USART_HandleTypeDef *  husart )

Resumes the DMA Transfer.

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values:
HALstatus

Definition at line 1095 of file stm32f1xx_hal_usart.c.

HAL_StatusTypeDef HAL_USART_DMAStop ( USART_HandleTypeDef *  husart )

Stops the DMA Transfer.

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values:
HALstatus

Definition at line 1115 of file stm32f1xx_hal_usart.c.

__weak void HAL_USART_ErrorCallback ( USART_HandleTypeDef *  husart )

USART error callbacks.

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values:
None

Definition at line 1315 of file stm32f1xx_hal_usart.c.

void HAL_USART_IRQHandler ( USART_HandleTypeDef *  husart )

This function handles USART interrupt request.

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values:
None

Definition at line 1148 of file stm32f1xx_hal_usart.c.

HAL_StatusTypeDef HAL_USART_Receive ( USART_HandleTypeDef *  husart,
uint8_t *  pRxData,
uint16_t  Size,
uint32_t  Timeout 
)

Full-Duplex Receive an amount of data in blocking mode.

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pRxData,:Pointer to data buffer
Size,:Amount of data to be received
Timeout,:Timeout duration
Return values:
HALstatus

Definition at line 499 of file stm32f1xx_hal_usart.c.

HAL_StatusTypeDef HAL_USART_Receive_DMA ( USART_HandleTypeDef *  husart,
uint8_t *  pRxData,
uint16_t  Size 
)

Full-Duplex Receive an amount of data in non-blocking mode.

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pRxData,:Pointer to data buffer
Size,:Amount of data to be received
Return values:
HALstatus
Note:
The USART DMA transmit channel must be configured in order to generate the clock for the slave.
When the USART parity is enabled (PCE = 1) the data received contain the parity bit.

Definition at line 924 of file stm32f1xx_hal_usart.c.

HAL_StatusTypeDef HAL_USART_Receive_IT ( USART_HandleTypeDef *  husart,
uint8_t *  pRxData,
uint16_t  Size 
)

Simplex Receive an amount of data in non-blocking mode.

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pRxData,:Pointer to data buffer
Size,:Amount of data to be received
Return values:
HALstatus

Definition at line 761 of file stm32f1xx_hal_usart.c.

__weak void HAL_USART_RxCpltCallback ( USART_HandleTypeDef *  husart )

Rx Transfer completed callbacks.

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values:
None

Definition at line 1270 of file stm32f1xx_hal_usart.c.

__weak void HAL_USART_RxHalfCpltCallback ( USART_HandleTypeDef *  husart )

Rx Half Transfer completed callbacks.

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values:
None

Definition at line 1285 of file stm32f1xx_hal_usart.c.

HAL_StatusTypeDef HAL_USART_Transmit ( USART_HandleTypeDef *  husart,
uint8_t *  pTxData,
uint16_t  Size,
uint32_t  Timeout 
)

Simplex Send an amount of data in blocking mode.

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pTxData,:Pointer to data buffer
Size,:Amount of data to be sent
Timeout,:Timeout duration
Return values:
HALstatus

Definition at line 422 of file stm32f1xx_hal_usart.c.

HAL_StatusTypeDef HAL_USART_Transmit_DMA ( USART_HandleTypeDef *  husart,
uint8_t *  pTxData,
uint16_t  Size 
)

Simplex Send an amount of data in non-blocking mode.

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pTxData,:Pointer to data buffer
Size,:Amount of data to be sent
Return values:
HALstatus

Definition at line 863 of file stm32f1xx_hal_usart.c.

HAL_StatusTypeDef HAL_USART_Transmit_IT ( USART_HandleTypeDef *  husart,
uint8_t *  pTxData,
uint16_t  Size 
)

Simplex Send an amount of data in non-blocking mode.

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pTxData,:Pointer to data buffer
Size,:Amount of data to be sent
Return values:
HALstatus
Note:
The USART errors are not managed to avoid the overrun error.

Definition at line 712 of file stm32f1xx_hal_usart.c.

HAL_StatusTypeDef HAL_USART_TransmitReceive ( USART_HandleTypeDef *  husart,
uint8_t *  pTxData,
uint8_t *  pRxData,
uint16_t  Size,
uint32_t  Timeout 
)

Full-Duplex Send receive an amount of data in full-duplex mode (blocking mode).

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pTxData,:Pointer to data transmitted buffer
pRxData,:Pointer to data received buffer
Size,:Amount of data to be sent
Timeout,:Timeout duration
Return values:
HALstatus

Definition at line 602 of file stm32f1xx_hal_usart.c.

HAL_StatusTypeDef HAL_USART_TransmitReceive_DMA ( USART_HandleTypeDef *  husart,
uint8_t *  pTxData,
uint8_t *  pRxData,
uint16_t  Size 
)

Full-Duplex Transmit Receive an amount of data in non-blocking mode.

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pTxData,:Pointer to data transmitted buffer
pRxData,:Pointer to data received buffer
Size,:Amount of data to be received
Note:
When the USART parity is enabled (PCE = 1) the data received contain the parity bit.
Return values:
HALstatus

Definition at line 997 of file stm32f1xx_hal_usart.c.

HAL_StatusTypeDef HAL_USART_TransmitReceive_IT ( USART_HandleTypeDef *  husart,
uint8_t *  pTxData,
uint8_t *  pRxData,
uint16_t  Size 
)

Full-Duplex Send receive an amount of data in full-duplex mode (non-blocking).

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pTxData,:Pointer to data transmitted buffer
pRxData,:Pointer to data received buffer
Size,:Amount of data to be received
Return values:
HALstatus

Definition at line 811 of file stm32f1xx_hal_usart.c.

__weak void HAL_USART_TxCpltCallback ( USART_HandleTypeDef *  husart )

Tx Transfer completed callbacks.

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values:
None

Definition at line 1240 of file stm32f1xx_hal_usart.c.

__weak void HAL_USART_TxHalfCpltCallback ( USART_HandleTypeDef *  husart )

Tx Half Transfer completed callbacks.

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values:
None

Definition at line 1255 of file stm32f1xx_hal_usart.c.

__weak void HAL_USART_TxRxCpltCallback ( USART_HandleTypeDef *  husart )

Tx/Rx Transfers completed callback for the non-blocking process.

Parameters:
husart,:Pointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values:
None

Definition at line 1300 of file stm32f1xx_hal_usart.c.