UART Configuration Block
UART Configuration block configures the selected UART peripheral

When used in a Simulink® model, the Universal Synchronous/Asynchronous Receiver/Transmitter (USART) Configuration Block displays a summary of its main configuration settings:

  • The peripheral instance for the block configuration (i.e., UART 1 Config).
    • Multiple UART configuration block configures multiple UART.
  • Current baud rate setting and relative baud rate error for the achieved baud rate.
  • Bytes per fundamental Simulink time (the maximum number of bytes which could be physically sent or received within one Simulink fundamental time step).

An implementation with buffer allow more bytes to be sent or received, but the average byte or step should not go beyond that reference value.

Main Tab

The 'Main' tab contains configuration parameters for the UART channel selected.

The total number of UART channels are displayed in the Ref UART drop-down list. Each UART channel used must have a corresponding configuration block.

The 'Current Baud' value (indicated in brackets) is the exact baud rate achieved. The baud rates' popup field shows the error in percentage (+/- %) reach for the listed baud rate. You can specify non-standard UART baud rates by selecting the 'Custom' option from the drop-down list. A text field to write the targeted baud rate will appear. The error for this user-defined baud rate is shown.

The Rx/Tx Pin drop-down show pin mapping possibilities for the targeted microcontroller. Some microcontrollers do not have this feature. When 'Do not implement Tx (or Rx)' is selected, the pin selected as Tx (or Rx) in the 'Main' tab will not be used.

Click image to enlarge.
UART Configuration: Main tab

TX Tab

The 'TX' tab contains transmitter implementation parameters. The Implementation drop-down provides four choices:
• Do not implement Tx
• Simplest (xx bytes internal buffer only)
• Circular Buffer
• DMA Ping-Pong Mode
• DMA single Buffer (Possible data loss)

DMA options are shown for microcontrollers that supports DMA. The 'DMA Ping-Pong Mode' uses two buffers which are initialized and filled-in alternatingly. The first buffer is sent when it is completely full. With 'DMA single Buffer', only one buffer is used. With one buffer, the Rx block is not allowed to buffer new data during the short time during which the DMA buffer is being transmitted. This results in a loss of data. Double buffering makes it more robust at the expense of a second buffer.

Click image to enlarge.
UART Configuration: Tx tab

Advanced Tab

The 'Advanced' tab provides further options. Communication mode can be set to full-duplex or half-duplex from the Duplex drop-down list. In 'Half-duplex' mode, the UART is implemented using dynamic reconfiguration of the Rx/Tx pins to allow bi-directional serial communication using a single wire. The UART logic levels can be inverted separately for Rx and Tx pins by enabling the 'Invert Rx Pin logic' or the 'Invert Rx Pin logic' options.

Other configurable UART parameters are provided in the Parity, Stop bit, and Hardware Flow Control lists. Enabling the 'IrDA' mode provides a mechanism for converting the UART serial interface to an infrared interface. However, the 'Hardware Flow Control' is not available in the 'IrDA' mode.

Click image to enlarge.
UART Configuration: Advanced tab

Initialisation Sequence Tab

The 'Send an Initialisation sequence on the UART' option under the 'Initialisation Sequence' tab allows you to initialize a slave device at startup. Typically, a slave, with volatile memory only, might always start with a given baud rate. This option allows you to send a user-defined initialization sequence with different UART settings.

A use case is a GPS module or radio link module which always starts with a baud rate of 38400. The initialization sequence switches the device to your nominal baud rate (e.g.,115200 is sent first at 38400), then the UART peripheral is switched to the nominal baud rate to communicate with this slave device. This initialization sequence is sent only once at microcontroller startup.

Click image to enlarge.
UART Configuration: Initialisation Sequence tab
© 2018 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.