Skip to Content

USART Receive Block Description

This block is used to receive data via the UART, USART, or LPUART interface in STM microcontrollers. It provides the option to filter received data frames by setting a header that is used for searching data frames. Received data packets are available at the block output, excluding headers and/or terminators. To receive and return all incoming data frames along with headers and/or terminators, use the USART ReceiveAll block.



USART Receive block

Table of Contents

Inputs

This block has no inputs.

Outputs

Output NameTypeDescription
Statusuint8Block operating status. Returns:
1 operation successful
0 operation failed
Num rx framesuint32Number of received data frames.
Frames lengthuint32Length of received data frames.
DataDepends on Output data type parameterData from received frames. It is returned excluding headers and/or terminators.

Block Parameters

ParameterDescription
USART/UART module numberNumber of the USART/UART module.
TypePeripheral interface type:
UART/USART - UART or USART interface
LPUART - LPUART interface
Hex formatDetermines how the header is interpreted. When enabled, the header is treated as a sequence of hexadecimal (hex) values; when disabled, it is treated as an ASCII character string.
Conditional Parameter
Length
Header length in Hex format in bytes. This parameter is only accessible when the Hex format option is enabled.
HeaderThe header used to filter received data frames. It should be enclosed between [' and '].
Output data typeData type of the block output.
Fixed data lengthOption to set a constant length for the output data.
Conditional Parameter
Max data length (bytes)
Maximum output data length in bytes. This parameter is only available when the Fixed data length option is disabled.
Conditional Parameter
Fixed data length (bytes)
Fixed output data length in bytes. This parameter is only available when the Fixed data length option is enabled.
Search only last frameEnables searching only within the last received data frame.
Max receive framesMaximum number of data frames that can be stored in the receive buffer before processing.
Enable (Terminator settings)Enables waiting for a frame terminator.
Hex formatDetermines how the terminator is interpreted. When enabled, the terminator is treated as a sequence of hexadecimal (hex) values; when disabled, it is treated as an ASCII character string.
Conditional Parameter
Length
Terminator length in Hex format in bytes. This parameter is only available when the Hex format option is enabled.
TerminatorThe terminator string used to filter received data frames. It should be enclosed between [' and '].
Non blocking modeEnables the non-blocking operating mode.
Conditional Parameter
Blocking timeout [ms]
The time limit the system waits for the block execution to complete. This parameter is only available when the Non blocking mode option is disabled.
Sample time [s]Function refresh period.


Block parameters for USART

CubeMX Configuration for a Given MCU Model

The interface configuration instructions are located on the subpage CubeMX Configuration for a Given MCU Model.

See Also

Last updated on