STM32F4xx HAL Documentation
Hardware Abstraction Layer for STM32F4 familiy
Loading...
Searching...
No Matches

USART Transmit and Receive functions. More...

Collaboration diagram for IO operation functions:

Functions

HAL_StatusTypeDef HAL_USART_Transmit (USART_HandleTypeDef *husart, const 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, const uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout)
 Full-Duplex Send and Receive an amount of data in full-duplex mode (blocking mode).
 
HAL_StatusTypeDef HAL_USART_Transmit_IT (USART_HandleTypeDef *husart, const 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, const uint8_t *pTxData, uint8_t *pRxData, uint16_t Size)
 Full-Duplex Send and Receive an amount of data in full-duplex mode (non-blocking).
 
HAL_StatusTypeDef HAL_USART_Transmit_DMA (USART_HandleTypeDef *husart, const uint8_t *pTxData, uint16_t Size)
 Simplex Send an amount of data in DMA mode.
 
HAL_StatusTypeDef HAL_USART_Receive_DMA (USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size)
 Full-Duplex Receive an amount of data in DMA mode.
 
HAL_StatusTypeDef HAL_USART_TransmitReceive_DMA (USART_HandleTypeDef *husart, const uint8_t *pTxData, uint8_t *pRxData, uint16_t Size)
 Full-Duplex Transmit Receive an amount of data in DMA 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.
 
HAL_StatusTypeDef HAL_USART_Abort (USART_HandleTypeDef *husart)
 Abort ongoing transfer (blocking mode).
 
HAL_StatusTypeDef HAL_USART_Abort_IT (USART_HandleTypeDef *husart)
 Abort ongoing transfer (Interrupt mode).
 
void HAL_USART_IRQHandler (USART_HandleTypeDef *husart)
 This function handles USART interrupt request.
 
void HAL_USART_TxCpltCallback (USART_HandleTypeDef *husart)
 Tx Transfer completed callbacks.
 
void HAL_USART_TxHalfCpltCallback (USART_HandleTypeDef *husart)
 Tx Half Transfer completed callbacks.
 
void HAL_USART_RxCpltCallback (USART_HandleTypeDef *husart)
 Rx Transfer completed callbacks.
 
void HAL_USART_RxHalfCpltCallback (USART_HandleTypeDef *husart)
 Rx Half Transfer completed callbacks.
 
void HAL_USART_TxRxCpltCallback (USART_HandleTypeDef *husart)
 Tx/Rx Transfers completed callback for the non-blocking process.
 
void HAL_USART_ErrorCallback (USART_HandleTypeDef *husart)
 USART error callbacks.
 
void HAL_USART_AbortCpltCallback (USART_HandleTypeDef *husart)
 USART Abort Complete callback.
 

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()

    (#) Non-Blocking mode transfers could be aborted using Abort API's :
        (++) HAL_USART_Abort()
        (++) HAL_USART_Abort_IT()

    (#) For Abort services based on interrupts (HAL_USART_Abort_IT), a Abort Complete Callbacks is provided:
        (++) HAL_USART_AbortCpltCallback()

    (#) 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_USART_ErrorCallback() user callback is executed. Transfer is kept ongoing on USART 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_USART_ErrorCallback() user callback is executed.

Function Documentation

◆ HAL_USART_Transmit()

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

#include <stm32f4xx_hal_usart.h>

Simplex Send an amount of data in blocking mode.

Note
When USART 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 pTxData.
Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pTxDataPointer 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 743 of file stm32f4xx_hal_usart.c.

References __HAL_LOCK, __HAL_UNLOCK, __USART_HandleTypeDef::ErrorCode, HAL_BUSY, HAL_ERROR, HAL_GetTick(), HAL_OK, HAL_TIMEOUT, HAL_USART_ERROR_NONE, HAL_USART_STATE_BUSY_TX, HAL_USART_STATE_READY, __USART_HandleTypeDef::Init, __USART_HandleTypeDef::Instance, USART_InitTypeDef::Parity, __USART_HandleTypeDef::State, __USART_HandleTypeDef::TxXferCount, __USART_HandleTypeDef::TxXferSize, USART_FLAG_TC, USART_FLAG_TXE, USART_PARITY_NONE, USART_WaitOnFlagUntilTimeout(), USART_WORDLENGTH_9B, and USART_InitTypeDef::WordLength.

◆ HAL_USART_Receive()

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

#include <stm32f4xx_hal_usart.h>

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

Note
To receive synchronous data, dummy data are simultaneously transmitted.
When USART 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 pRxData.
Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pRxDataPointer 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 832 of file stm32f4xx_hal_usart.c.

References __HAL_LOCK, __HAL_UNLOCK, DUMMY_DATA, __USART_HandleTypeDef::ErrorCode, HAL_BUSY, HAL_ERROR, HAL_GetTick(), HAL_OK, HAL_TIMEOUT, HAL_USART_ERROR_NONE, HAL_USART_STATE_BUSY_RX, HAL_USART_STATE_READY, __USART_HandleTypeDef::Init, __USART_HandleTypeDef::Instance, USART_InitTypeDef::Parity, __USART_HandleTypeDef::RxXferCount, __USART_HandleTypeDef::RxXferSize, __USART_HandleTypeDef::State, USART_FLAG_RXNE, USART_FLAG_TXE, USART_PARITY_NONE, USART_WaitOnFlagUntilTimeout(), USART_WORDLENGTH_8B, USART_WORDLENGTH_9B, and USART_InitTypeDef::WordLength.

◆ HAL_USART_TransmitReceive()

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

#include <stm32f4xx_hal_usart.h>

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

Note
When USART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01), the sent data and the received data are handled as sets of u16. In this case, Size must indicate the number of u16 available through pTxData and through pRxData.
Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pTxDataPointer to TX data buffer (u8 or u16 data elements).
pRxDataPointer to RX data buffer (u8 or u16 data elements).
SizeAmount of data elements (u8 or u16) to be sent (same amount to be received).
TimeoutTimeout duration
Return values
HALstatus

Definition at line 933 of file stm32f4xx_hal_usart.c.

References __HAL_LOCK, __HAL_UNLOCK, __USART_HandleTypeDef::ErrorCode, HAL_BUSY, HAL_ERROR, HAL_GetTick(), HAL_OK, HAL_TIMEOUT, HAL_USART_ERROR_NONE, HAL_USART_STATE_BUSY_RX, HAL_USART_STATE_READY, __USART_HandleTypeDef::Init, __USART_HandleTypeDef::Instance, USART_InitTypeDef::Parity, __USART_HandleTypeDef::RxXferCount, __USART_HandleTypeDef::RxXferSize, __USART_HandleTypeDef::State, __USART_HandleTypeDef::TxXferCount, __USART_HandleTypeDef::TxXferSize, USART_FLAG_RXNE, USART_FLAG_TXE, USART_PARITY_NONE, USART_WaitOnFlagUntilTimeout(), USART_WORDLENGTH_8B, USART_WORDLENGTH_9B, and USART_InitTypeDef::WordLength.

◆ HAL_USART_Transmit_IT()

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

#include <stm32f4xx_hal_usart.h>

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

Note
When USART 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 pTxData.
Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pTxDataPointer to data buffer (u8 or u16 data elements).
SizeAmount of data elements (u8 or u16) to be sent.
Return values
HALstatus
Note
The USART errors are not managed to avoid the overrun error.

Definition at line 1073 of file stm32f4xx_hal_usart.c.

References __HAL_LOCK, __HAL_UNLOCK, __USART_HandleTypeDef::ErrorCode, HAL_BUSY, HAL_ERROR, HAL_OK, HAL_USART_ERROR_NONE, HAL_USART_STATE_BUSY_TX, HAL_USART_STATE_READY, __USART_HandleTypeDef::Instance, __USART_HandleTypeDef::pTxBuffPtr, __USART_HandleTypeDef::State, __USART_HandleTypeDef::TxXferCount, and __USART_HandleTypeDef::TxXferSize.

◆ HAL_USART_Receive_IT()

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

#include <stm32f4xx_hal_usart.h>

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

Note
To receive synchronous data, dummy data are simultaneously transmitted.
When USART 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 pRxData.
Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pRxDataPointer to data buffer (u8 or u16 data elements).
SizeAmount of data elements (u8 or u16) to be received.
Return values
HALstatus

Definition at line 1126 of file stm32f4xx_hal_usart.c.

References __HAL_LOCK, __HAL_UNLOCK, DUMMY_DATA, __USART_HandleTypeDef::ErrorCode, HAL_BUSY, HAL_ERROR, HAL_OK, HAL_USART_ERROR_NONE, HAL_USART_STATE_BUSY_RX, HAL_USART_STATE_READY, __USART_HandleTypeDef::Init, __USART_HandleTypeDef::Instance, USART_InitTypeDef::Parity, __USART_HandleTypeDef::pRxBuffPtr, __USART_HandleTypeDef::RxXferCount, __USART_HandleTypeDef::RxXferSize, __USART_HandleTypeDef::State, and USART_PARITY_NONE.

◆ HAL_USART_TransmitReceive_IT()

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

#include <stm32f4xx_hal_usart.h>

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

Note
When USART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01), the sent data and the received data are handled as sets of u16. In this case, Size must indicate the number of u16 available through pTxData and through pRxData.
Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pTxDataPointer to TX data buffer (u8 or u16 data elements).
pRxDataPointer to RX data buffer (u8 or u16 data elements).
SizeAmount of data elements (u8 or u16) to be sent (same amount to be received).
Return values
HALstatus

Definition at line 1184 of file stm32f4xx_hal_usart.c.

References __HAL_LOCK, __HAL_UNLOCK, __USART_HandleTypeDef::ErrorCode, HAL_BUSY, HAL_ERROR, HAL_OK, HAL_USART_ERROR_NONE, HAL_USART_STATE_BUSY_TX_RX, HAL_USART_STATE_READY, __USART_HandleTypeDef::Init, __USART_HandleTypeDef::Instance, USART_InitTypeDef::Parity, __USART_HandleTypeDef::pRxBuffPtr, __USART_HandleTypeDef::pTxBuffPtr, __USART_HandleTypeDef::RxXferCount, __USART_HandleTypeDef::RxXferSize, __USART_HandleTypeDef::State, __USART_HandleTypeDef::TxXferCount, __USART_HandleTypeDef::TxXferSize, and USART_PARITY_NONE.

◆ HAL_USART_Transmit_DMA()

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

#include <stm32f4xx_hal_usart.h>

Simplex Send an amount of data in DMA mode.

Note
When USART 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 pTxData.
Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pTxDataPointer to data buffer (u8 or u16 data elements).
SizeAmount of data elements (u8 or u16) to be sent.
Return values
HALstatus

Definition at line 1243 of file stm32f4xx_hal_usart.c.

References __HAL_LOCK, __HAL_UNLOCK, __HAL_USART_CLEAR_FLAG, __USART_HandleTypeDef::ErrorCode, HAL_BUSY, HAL_DMA_Start_IT(), HAL_ERROR, HAL_OK, HAL_USART_ERROR_NONE, HAL_USART_STATE_BUSY_TX, HAL_USART_STATE_READY, __USART_HandleTypeDef::hdmatx, __USART_HandleTypeDef::Instance, __USART_HandleTypeDef::pTxBuffPtr, __USART_HandleTypeDef::State, __USART_HandleTypeDef::TxXferCount, __USART_HandleTypeDef::TxXferSize, USART_DMAError(), USART_DMATransmitCplt(), USART_DMATxHalfCplt(), USART_FLAG_TC, __DMA_HandleTypeDef::XferAbortCallback, __DMA_HandleTypeDef::XferCpltCallback, __DMA_HandleTypeDef::XferErrorCallback, and __DMA_HandleTypeDef::XferHalfCpltCallback.

◆ HAL_USART_Receive_DMA()

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

#include <stm32f4xx_hal_usart.h>

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

Note
When USART 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 pRxData.
Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pRxDataPointer to data buffer (u8 or u16 data elements).
SizeAmount of data elements (u8 or u16) to be received.
Return values
HALstatus
Note
The USART DMA transmit stream 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 1310 of file stm32f4xx_hal_usart.c.

References __HAL_LOCK, __HAL_UNLOCK, __HAL_USART_CLEAR_OREFLAG, __USART_HandleTypeDef::ErrorCode, HAL_BUSY, HAL_DMA_Start_IT(), HAL_ERROR, HAL_OK, HAL_USART_ERROR_NONE, HAL_USART_STATE_BUSY_RX, HAL_USART_STATE_READY, __USART_HandleTypeDef::hdmarx, __USART_HandleTypeDef::hdmatx, __USART_HandleTypeDef::Init, __USART_HandleTypeDef::Instance, USART_InitTypeDef::Parity, __USART_HandleTypeDef::pRxBuffPtr, __USART_HandleTypeDef::pTxBuffPtr, __USART_HandleTypeDef::RxXferSize, __USART_HandleTypeDef::State, __USART_HandleTypeDef::TxXferSize, USART_DMAError(), USART_DMAReceiveCplt(), USART_DMARxHalfCplt(), USART_PARITY_NONE, __DMA_HandleTypeDef::XferAbortCallback, __DMA_HandleTypeDef::XferCpltCallback, __DMA_HandleTypeDef::XferErrorCallback, and __DMA_HandleTypeDef::XferHalfCpltCallback.

◆ HAL_USART_TransmitReceive_DMA()

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

#include <stm32f4xx_hal_usart.h>

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

Note
When USART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01), the sent data and the received data are handled as sets of u16. In this case, Size must indicate the number of u16 available through pTxData and through pRxData.
Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
pTxDataPointer to TX data buffer (u8 or u16 data elements).
pRxDataPointer to RX data buffer (u8 or u16 data elements).
SizeAmount of data elements (u8 or u16) to be received/sent.
Note
When the USART parity is enabled (PCE = 1) the data received contain the parity bit.
Return values
HALstatus

Definition at line 1408 of file stm32f4xx_hal_usart.c.

References __HAL_LOCK, __HAL_UNLOCK, __HAL_USART_CLEAR_FLAG, __HAL_USART_CLEAR_OREFLAG, __USART_HandleTypeDef::ErrorCode, HAL_BUSY, HAL_DMA_Start_IT(), HAL_ERROR, HAL_OK, HAL_USART_ERROR_NONE, HAL_USART_STATE_BUSY_TX_RX, HAL_USART_STATE_READY, __USART_HandleTypeDef::hdmarx, __USART_HandleTypeDef::hdmatx, __USART_HandleTypeDef::Init, __USART_HandleTypeDef::Instance, USART_InitTypeDef::Parity, __USART_HandleTypeDef::pRxBuffPtr, __USART_HandleTypeDef::pTxBuffPtr, __USART_HandleTypeDef::RxXferSize, __USART_HandleTypeDef::State, __USART_HandleTypeDef::TxXferSize, USART_DMAError(), USART_DMAReceiveCplt(), USART_DMARxHalfCplt(), USART_DMATransmitCplt(), USART_DMATxHalfCplt(), USART_FLAG_TC, USART_PARITY_NONE, __DMA_HandleTypeDef::XferAbortCallback, __DMA_HandleTypeDef::XferCpltCallback, __DMA_HandleTypeDef::XferErrorCallback, and __DMA_HandleTypeDef::XferHalfCpltCallback.

◆ HAL_USART_DMAPause()

HAL_StatusTypeDef HAL_USART_DMAPause ( USART_HandleTypeDef * husart)

#include <stm32f4xx_hal_usart.h>

Pauses the DMA Transfer.

Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values
HALstatus

Definition at line 1499 of file stm32f4xx_hal_usart.c.

References __HAL_LOCK, __HAL_UNLOCK, HAL_OK, and __USART_HandleTypeDef::Instance.

◆ HAL_USART_DMAResume()

HAL_StatusTypeDef HAL_USART_DMAResume ( USART_HandleTypeDef * husart)

#include <stm32f4xx_hal_usart.h>

Resumes the DMA Transfer.

Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values
HALstatus

Definition at line 1519 of file stm32f4xx_hal_usart.c.

References __HAL_LOCK, __HAL_UNLOCK, HAL_OK, and __USART_HandleTypeDef::Instance.

◆ HAL_USART_DMAStop()

HAL_StatusTypeDef HAL_USART_DMAStop ( USART_HandleTypeDef * husart)

#include <stm32f4xx_hal_usart.h>

Stops the DMA Transfer.

Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values
HALstatus

Definition at line 1539 of file stm32f4xx_hal_usart.c.

References HAL_DMA_Abort(), HAL_IS_BIT_SET, HAL_OK, HAL_USART_STATE_BUSY_RX, HAL_USART_STATE_BUSY_TX, __USART_HandleTypeDef::hdmarx, __USART_HandleTypeDef::hdmatx, __USART_HandleTypeDef::Instance, __USART_HandleTypeDef::State, USART_EndRxTransfer(), and USART_EndTxTransfer().

◆ HAL_USART_Abort()

HAL_StatusTypeDef HAL_USART_Abort ( USART_HandleTypeDef * husart)

#include <stm32f4xx_hal_usart.h>

Abort ongoing transfer (blocking mode).

Parameters
husartUSART handle.
Note
This procedure could be used for aborting any ongoing transfer (either Tx or Rx, as described by TransferType parameter) started in Interrupt or DMA mode. This procedure performs following operations :
  • Disable PPP Interrupts (depending of transfer direction)
  • 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 1596 of file stm32f4xx_hal_usart.c.

References __USART_HandleTypeDef::ErrorCode, HAL_DMA_Abort(), HAL_IS_BIT_SET, HAL_OK, HAL_USART_ERROR_NONE, HAL_USART_STATE_READY, __USART_HandleTypeDef::hdmarx, __USART_HandleTypeDef::hdmatx, __USART_HandleTypeDef::Instance, __USART_HandleTypeDef::RxXferCount, __USART_HandleTypeDef::State, __USART_HandleTypeDef::TxXferCount, and __DMA_HandleTypeDef::XferAbortCallback.

◆ HAL_USART_Abort_IT()

HAL_StatusTypeDef HAL_USART_Abort_IT ( USART_HandleTypeDef * husart)

#include <stm32f4xx_hal_usart.h>

Abort ongoing transfer (Interrupt mode).

Parameters
husartUSART handle.
Note
This procedure could be used for aborting any ongoing transfer (either Tx or Rx, as described by TransferType parameter) started in Interrupt or DMA mode. This procedure performs following operations :
  • Disable PPP Interrupts (depending of transfer direction)
  • 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 1662 of file stm32f4xx_hal_usart.c.

References __USART_HandleTypeDef::ErrorCode, HAL_DMA_Abort_IT(), HAL_IS_BIT_SET, HAL_OK, HAL_USART_AbortCpltCallback(), HAL_USART_ERROR_NONE, HAL_USART_STATE_READY, __USART_HandleTypeDef::hdmarx, __USART_HandleTypeDef::hdmatx, __USART_HandleTypeDef::Instance, __USART_HandleTypeDef::RxXferCount, __USART_HandleTypeDef::State, __USART_HandleTypeDef::TxXferCount, USART_DMARxAbortCallback(), USART_DMATxAbortCallback(), and __DMA_HandleTypeDef::XferAbortCallback.

◆ HAL_USART_IRQHandler()

◆ HAL_USART_TxCpltCallback()

__weak void HAL_USART_TxCpltCallback ( USART_HandleTypeDef * husart)

#include <stm32f4xx_hal_usart.h>

Tx Transfer completed callbacks.

Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values
None

Definition at line 1943 of file stm32f4xx_hal_usart.c.

References UNUSED.

Referenced by USART_DMATransmitCplt(), and USART_EndTransmit_IT().

◆ HAL_USART_TxHalfCpltCallback()

__weak void HAL_USART_TxHalfCpltCallback ( USART_HandleTypeDef * husart)

#include <stm32f4xx_hal_usart.h>

Tx Half Transfer completed callbacks.

Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values
None

Definition at line 1958 of file stm32f4xx_hal_usart.c.

References UNUSED.

Referenced by USART_DMATxHalfCplt().

◆ HAL_USART_RxCpltCallback()

__weak void HAL_USART_RxCpltCallback ( USART_HandleTypeDef * husart)

#include <stm32f4xx_hal_usart.h>

Rx Transfer completed callbacks.

Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values
None

Definition at line 1973 of file stm32f4xx_hal_usart.c.

References UNUSED.

Referenced by USART_DMAReceiveCplt(), and USART_Receive_IT().

◆ HAL_USART_RxHalfCpltCallback()

__weak void HAL_USART_RxHalfCpltCallback ( USART_HandleTypeDef * husart)

#include <stm32f4xx_hal_usart.h>

Rx Half Transfer completed callbacks.

Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values
None

Definition at line 1988 of file stm32f4xx_hal_usart.c.

References UNUSED.

Referenced by USART_DMARxHalfCplt().

◆ HAL_USART_TxRxCpltCallback()

__weak void HAL_USART_TxRxCpltCallback ( USART_HandleTypeDef * husart)

#include <stm32f4xx_hal_usart.h>

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

Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values
None

Definition at line 2003 of file stm32f4xx_hal_usart.c.

References UNUSED.

Referenced by USART_DMAReceiveCplt(), and USART_TransmitReceive_IT().

◆ HAL_USART_ErrorCallback()

__weak void HAL_USART_ErrorCallback ( USART_HandleTypeDef * husart)

#include <stm32f4xx_hal_usart.h>

USART error callbacks.

Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values
None

Definition at line 2018 of file stm32f4xx_hal_usart.c.

References UNUSED.

Referenced by HAL_USART_IRQHandler(), USART_DMAAbortOnError(), and USART_DMAError().

◆ HAL_USART_AbortCpltCallback()

__weak void HAL_USART_AbortCpltCallback ( USART_HandleTypeDef * husart)

#include <stm32f4xx_hal_usart.h>

USART Abort Complete callback.

Parameters
husartUSART handle.
Return values
None

Definition at line 2032 of file stm32f4xx_hal_usart.c.

References UNUSED.

Referenced by HAL_USART_Abort_IT(), USART_DMARxAbortCallback(), and USART_DMATxAbortCallback().