Serial Ports

From STorM32-BGC Wiki
Revision as of 18:01, 11 February 2023 by OlliW (talk | contribs) (→‎Availability)
Jump to navigation Jump to search

This article aims at providing some clarification concerning the STorM32's serial ports.

Ports

The naming of the STorM32 serial ports might be confusing at first. However, it is in fact pretty consistent, across all boards - with one (unfortunate) exception: UART1.

Generally, the port naming follows this scheme: The name of a port is simply the type of the port, plus a number (or symbol) for the 2nd port of that type, and so on. Example: RC and RC2. The STorM32 serial ports are named USB, UART, UART2, and UARTX, and are accessible in the GUI as “usb”, “uart”, “uart2”, and “uartx”. The pins corresponding to, e.g., the ports UART and UART2 are labelled accordingly as Rx/Tx and Rx2/Tx2.

UART1 is different. It is not a port like UART or UART2, and you won't find any parameter with the option “uart1” in the GUI, yet the name "UART1" appears in various places, e.g. as Rx1/Tx1 labels on boards or in pin descriptions or in documentary.

MCU Peripherals and Special Role of UART1

The microcontroller (MCU) which is used in the STorM32 controllers (STM32F103 chip) offers a number of hardware peripherals, among them the serial peripherals. These are generally called UARTx or USARTx, where x goes from 1 to 5 for e.g. the STM32F103 chip (we will not distinguish between UARTx or USARTx but just call them UARTx). Note: This naming convention is a choice of the chip manufacturer, not ours.

These names for the serial hardware peripherals must not be confused with the names of the serial ports offered by the STorM32 controller!

For instance, on the v1.3x boards the serial port UART is connected to the hardware peripheral UART3, while on the v3.x boards it is connected to the hardware peripheral UART5. From a user perspective this is however irrelevant, since all a user needs to know is that there is a serial port UART with the associated functionality.

The hardware peripheral UART1 is special, since it allows us to flash firmware into the microcontroller, and it is used by STorM32 for exactly this purpose. Therefore, we want to expose it on the STorM32 boards so we can flash the firmware using it, which is the reason for why one finds a UART1 port (or Rx1/Tx1 labels) on some boards.

Unfortunately, the number of serial ports provided by a STorM32 board or by the MCU is not sufficient for some applications. On STorM32 v1.3x boards, e.g., one would want to also use the peripheral UART1 to fullfill the user's needs. In the STorM32 software, this is made possible, for some features, as UARTX port.

Availability

Concerning the availability of the serial ports one can note:

  • All STorM32 boards provide the UART port.
  • The STorM32 v3.x boards do provide a port labeled UART1 (Rx1/Tx1), which is indeed the UART1 hardware peripheral. Some v3.x boards do also provide a physical USB connector, which is however just again the UART1 peripheral (tied together via a on-board USB-TTL adapter). The UART1 port or USB connector is accessible in the GUI as “usb”, i.e., this is the USB port.
  • On the STorM32 v1.x boards the USB serial is indeed the USB connector (tied to a different hardware peripheral). The UART1 hardware peripheral, used e.g. for flashing firmware, is available on these boards on the RC port, as pins RC-0 and RC-1.
  • On the STorM32 v3.x boards the UART2 serial is either available as an explicit UART2 port or via the ESP port. The v1.x boards do not offer this serial at all (for these boards the GUI setting “uart2” has no effect).
  • On all STorM32 boards the UARTX serial is available on the RC port, pins RC-0 and RC-1 (accessible in the GUI as “uartx”). In pictures of the v1.x board one however finds it indicated as UART1 and not UARTX (on these boards UARTX is in fact the UART1 peripheral).

Baudrate

The default baudrate is generally 115200 bps for all serial ports (including USB on the v3.x boards).

They can be adjusted for the serials USB, UART, UART2 in the GUI. There is no possibility to adjust the baudrate of the UARTX serial port.

Comment: The GUI per default also communicates with a baudrate of 115200 bps. It can be changed in the GUI however.

Comment: Changing the baudrate of a serial port can imply that one cannot connect to this port with the GUI anymore.