Electrical – How to choose UART maximum output speed

gpiostm32stm32cubemxuart

When I open up a project in STM32CubeMX and configure a UART, there's a Maximum output speed configuration (under GPIO Settings) that defaults to Very High. The options are:

  • Low
  • Medium
  • High
  • Very High

In STM32CubeMX User Manual it says the following about Maximum output speed:

GPIO maximum output speed (for communication peripherals only)
It is set to Low by default for power consumption optimization and can be changed to a higher frequency to fit application requirements.

But it's actually set to "Low" only for regular Output GPIOs. For UART TX/RX pins it's actually set to Very High.

I have a few questions regarding this:

  1. What "application requirements" would require a higher setting?
  2. Why does this settings default to Very High in UART, and Low in Output GPIO?
  3. Most importantly, can 2 UARTs with different Maximum Output Speeds talk (communicate), or should they be configured the same? What implications would occur if the UART of each side was configured differently regarding this setting?

Best Answer

The GPIO speed setting just configures the drive strength or the ability how much the pin can source and sink current. More current means faster signal transitions to heavier capacitive loads.

1) For example driving a FET gate which is highly capacitive and it needs to spend minimum time being halfway on

2) Somebody has chosen these defaults often just because you need to have some basic default setting that mostly work. Using say 3 megabaud with long wires for debug UART might be safer to have high drive ability, but blinking a LED on GPIO once per second does not matter which setting is used.

3) Of course they can communicate if the baud rate used is slow enough that signal slew rate does not contribute to the error much. Weakest drive strength can work to about 2 MHz maybe, depends on which MCU is used.