How this block appears in a Simulink model?¶
What can be configured?¶
|Configuration Parameter||Selectable Option/Value||Description|
|UART module||0--1--2||Select UART module.|
|Baud rate (bps)||Communication speed configuration value, Example: 9600, 115200 or 1000000||Select baud rate.|
|Parity||None--Odd--Even||Parity bit selection|
|Stop bit||1--1.5--2||Stop bit selection|
|TX GPIO Pin||Not used--0 to 33||Pin connect (remap) configuration for transmit pin (Tx). Or select "Not used " to disable Tx for the selected module.|
|RX GPIO Pin||Not used--0 to 39||Pin connect (remap) configuration for transmit pin (Rx). Or select "Not used " to disable Rx for the selected module.|
|Advanced options||Check--Uncheck||This option is to enable advance configuration mode, include memory buffer size.|
|Rx buffer size (bytes)||0--256--512--1024--2048||Select buffer size for receiving (Rx) buffer, size must be in a number of 2^N and higher than packet length.
Example, to receive Rx packet with length 90 bytes, the Rx buffer should be configured to 128 or higher.
|Tx buffer size (bytes)||0--256--512--1024--2048||Similar to Rx buffer, size must be in a number of 2^N and higher than transmit packet length.|
When to use this block?¶
The block must be placed into a Simulink model to enable/ configure the selected UART module when the application need to send or receive data from external device using UART protocol.
How does this block work?¶The following overview describes how to establish communication between an ESP32 and other UART devices using the functions and data types of the UART driver. The overview reflects a typical programming workflow and is broken down into the sections provided below:
- Setting Communication Parameters - Setting baud rate, data bits, stop bits, etc.
- Setting Communication Pins - Assigning pins for connection to a device.
- Driver Installation - Allocating ESP32’s resources for the UART driver.
- Running UART Communication - Sending / receiving data
- Using Interrupts - Triggering interrupts on specific communication events
- Deleting a Driver - Freeing allocated resources if a UART communication is no longer required