STM32H735xx HAL User Manual
Functions
Peripheral Control functions
UARTEx Exported Functions

Extended Peripheral Control functions. More...

Functions

HAL_StatusTypeDef HAL_MultiProcessorEx_AddressLength_Set (UART_HandleTypeDef *huart, uint32_t AddressLength)
 By default in multiprocessor mode, when the wake up method is set to address mark, the UART handles only 4-bit long addresses detection; this API allows to enable longer addresses detection (6-, 7- or 8-bit long).
HAL_StatusTypeDef HAL_UARTEx_StopModeWakeUpSourceConfig (UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection)
 Set Wakeup from Stop mode interrupt flag selection.
HAL_StatusTypeDef HAL_UARTEx_EnableStopMode (UART_HandleTypeDef *huart)
 Enable UART Stop Mode.
HAL_StatusTypeDef HAL_UARTEx_DisableStopMode (UART_HandleTypeDef *huart)
 Disable UART Stop Mode.
HAL_StatusTypeDef HAL_UARTEx_EnableFifoMode (UART_HandleTypeDef *huart)
 Enable the FIFO mode.
HAL_StatusTypeDef HAL_UARTEx_DisableFifoMode (UART_HandleTypeDef *huart)
 Disable the FIFO mode.
HAL_StatusTypeDef HAL_UARTEx_SetTxFifoThreshold (UART_HandleTypeDef *huart, uint32_t Threshold)
 Set the TXFIFO threshold.
HAL_StatusTypeDef HAL_UARTEx_SetRxFifoThreshold (UART_HandleTypeDef *huart, uint32_t Threshold)
 Set the RXFIFO threshold.
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.

Detailed Description

Extended Peripheral Control functions.

 ===============================================================================
                      ##### Peripheral Control functions #####
 ===============================================================================
    [..] This section provides the following functions:
     (+) HAL_MultiProcessorEx_AddressLength_Set() API optionally sets the UART node address
         detection length to more than 4 bits for multiprocessor address mark wake up.
     (+) HAL_UARTEx_StopModeWakeUpSourceConfig() API defines the wake-up from stop mode
         trigger: address match, Start Bit detection or RXNE bit status.
     (+) HAL_UARTEx_EnableStopMode() API enables the UART to wake up the MCU from stop mode
     (+) HAL_UARTEx_DisableStopMode() API disables the above functionality
     (+) HAL_UARTEx_EnableFifoMode() API enables the FIFO mode
     (+) HAL_UARTEx_DisableFifoMode() API disables the FIFO mode
     (+) HAL_UARTEx_SetTxFifoThreshold() API sets the TX FIFO threshold
     (+) HAL_UARTEx_SetRxFifoThreshold() API sets the RX FIFO threshold

    [..] This subsection also provides a set of additional functions providing enhanced reception
    services to user. (For example, these functions allow application to handle use cases
    where number of data to be received is unknown).

    (#) Compared to standard reception services which only consider number of received
        data elements as reception completion criteria, these functions also consider additional events
        as triggers for updating reception status to caller :
       (+) Detection of inactivity period (RX line has not been active for a given period).
          (++) RX inactivity detected by IDLE event, i.e. RX line has been in idle state (normally high state)
               for 1 frame time, after last received byte.
          (++) RX inactivity detected by RTO, i.e. line has been in idle state
               for a programmable time, after last received byte.
       (+) Detection that a specific character has been received.

    (#) There are two mode of transfer:
       (+) Blocking mode: The reception is performed in polling mode, until either expected number of data is received,
           or till IDLE event occurs. Reception is handled only during function execution.
           When function exits, no data reception could occur. HAL status and number of actually received data elements,
           are returned by function after finishing transfer.
       (+) Non-Blocking mode: The reception 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_UARTEx_RxEventCallback() user callback will be executed during Receive process
           The HAL_UART_ErrorCallback()user callback will be executed when a reception error is detected.

    (#) Blocking mode API:
        (+) HAL_UARTEx_ReceiveToIdle()

    (#) Non-Blocking mode API with Interrupt:
        (+) HAL_UARTEx_ReceiveToIdle_IT()

    (#) Non-Blocking mode API with DMA:
        (+) HAL_UARTEx_ReceiveToIdle_DMA()


Function Documentation

HAL_StatusTypeDef HAL_MultiProcessorEx_AddressLength_Set ( UART_HandleTypeDef huart,
uint32_t  AddressLength 
)

By default in multiprocessor mode, when the wake up method is set to address mark, the UART handles only 4-bit long addresses detection; this API allows to enable longer addresses detection (6-, 7- or 8-bit long).

Note:
Addresses detection lengths are: 6-bit address detection in 7-bit data mode, 7-bit address detection in 8-bit data mode, 8-bit address detection in 9-bit data mode.
Parameters:
huartUART handle.
AddressLengthThis parameter can be one of the following values:
Return values:
HALstatus

Definition at line 387 of file stm32h7xx_hal_uart_ex.c.

References __HAL_UART_DISABLE, __HAL_UART_ENABLE, assert_param, __UART_HandleTypeDef::gState, HAL_UART_STATE_BUSY, __UART_HandleTypeDef::Instance, IS_UART_ADDRESSLENGTH_DETECT, and UART_CheckIdleState().

HAL_StatusTypeDef HAL_UARTEx_DisableFifoMode ( UART_HandleTypeDef huart)

Disable the FIFO mode.

Parameters:
huartUART handle.
Return values:
HALstatus

Definition at line 559 of file stm32h7xx_hal_uart_ex.c.

References __HAL_UART_DISABLE, assert_param, __UART_HandleTypeDef::FifoMode, __UART_HandleTypeDef::gState, HAL_UART_STATE_BUSY, HAL_UART_STATE_READY, __UART_HandleTypeDef::Instance, and UART_FIFOMODE_DISABLE.

HAL_StatusTypeDef HAL_UARTEx_DisableStopMode ( UART_HandleTypeDef huart)

Disable UART Stop Mode.

Parameters:
huartUART handle.
Return values:
HALstatus

Definition at line 499 of file stm32h7xx_hal_uart_ex.c.

References __UART_HandleTypeDef::Instance.

HAL_StatusTypeDef HAL_UARTEx_EnableFifoMode ( UART_HandleTypeDef huart)
HAL_StatusTypeDef HAL_UARTEx_EnableStopMode ( UART_HandleTypeDef huart)

Enable UART Stop Mode.

Note:
The UART is able to wake up the MCU from Stop 1 mode as long as UART clock is HSI or LSE.
Parameters:
huartUART handle.
Return values:
HALstatus

Definition at line 480 of file stm32h7xx_hal_uart_ex.c.

References __UART_HandleTypeDef::Instance.

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 (M1-M0 = 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.
When FIFO mode is enabled, the RXFNE flag is set as long as the RXFIFO is not empty. Read operations from the RDR register are performed when RXFNE flag is set. From hardware perspective, RXFNE flag and RXNE are mapped on the same bit-field.
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 711 of file stm32h7xx_hal_uart_ex.c.

References __HAL_UART_CLEAR_FLAG, __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_HandleTypeDef::Mask, UART_InitTypeDef::Parity, __UART_HandleTypeDef::ReceptionType, __UART_HandleTypeDef::RxState, __UART_HandleTypeDef::RxXferCount, __UART_HandleTypeDef::RxXferSize, UART_CLEAR_IDLEF, UART_FLAG_IDLE, UART_FLAG_RXNE, UART_MASK_COMPUTATION, UART_PARITY_NONE, 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 (M1-M0 = 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 898 of file stm32h7xx_hal_uart_ex.c.

References __HAL_UART_CLEAR_FLAG, HAL_UART_RECEPTION_TOIDLE, HAL_UART_STATE_READY, __UART_HandleTypeDef::Instance, __UART_HandleTypeDef::ReceptionType, __UART_HandleTypeDef::RxState, UART_CLEAR_IDLEF, 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 (M1-M0 = 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 836 of file stm32h7xx_hal_uart_ex.c.

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

HAL_StatusTypeDef HAL_UARTEx_SetRxFifoThreshold ( UART_HandleTypeDef huart,
uint32_t  Threshold 
)
HAL_StatusTypeDef HAL_UARTEx_SetTxFifoThreshold ( UART_HandleTypeDef huart,
uint32_t  Threshold 
)
HAL_StatusTypeDef HAL_UARTEx_StopModeWakeUpSourceConfig ( UART_HandleTypeDef huart,
UART_WakeUpTypeDef  WakeUpSelection 
)

Set Wakeup from Stop mode interrupt flag selection.

Note:
It is the application responsibility to enable the interrupt used as usart_wkup interrupt source before entering low-power mode.
Parameters:
huartUART handle.
WakeUpSelectionAddress match, Start Bit detection or RXNE/RXFNE bit status. This parameter can be one of the following values:
Return values:
HALstatus

Definition at line 425 of file stm32h7xx_hal_uart_ex.c.

References __HAL_UART_DISABLE, __HAL_UART_ENABLE, assert_param, __UART_HandleTypeDef::gState, HAL_GetTick(), HAL_UART_STATE_BUSY, HAL_UART_STATE_READY, HAL_UART_TIMEOUT_VALUE, __UART_HandleTypeDef::Instance, IS_UART_WAKEUP_SELECTION, UART_WaitOnFlagUntilTimeout(), UART_WAKEUP_ON_ADDRESS, UARTEx_Wakeup_AddressConfig(), and UART_WakeUpTypeDef::WakeUpEvent.