Serial Ports: Difference between revisions

From STorM32-BGC Wiki
Jump to navigation Jump to search
No edit summary
 
(59 intermediate revisions by the same user not shown)
Line 1: Line 1:
The topic of the STorM32's serial ports can be confusing. This article aims at providing some clarification.
This article aims at providing some clarification concerning the STorM32's serial ports.
 
<div class="toclimit-2">__TOC__</div>
 
== Ports ==
 
The naming of the STorM32 serial ports may appear confusing at first. However, it is in fact pretty consistent, across all boards - with one (unfortunate) exception: UART1.
 
Generally, the STorM32 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: {{BOX|RC}} and {{BOX|RC2}}. The STorM32 serial ports are named {{BOX|USB}}, {{BOX|UART}}, {{BOX|UART2}}, and {{BOX|UARTX}}, and are accessible in the GUI as {{PARAMVALUE|usb}}, {{PARAMVALUE|uart}}, {{PARAMVALUE|uart2}}, and {{PARAMVALUE|uartx}}. The pins corresponding to, e.g., the ports {{BOX|UART}} and {{BOX|UART2}} are labelled accordingly as Rx/Tx and Rx2/Tx2.
 
UART1 is different. It is not a port like {{BOX|UART}} or {{BOX|UART2}}, and you won't find any parameter with the option {{PARAMVALUE|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 STM32F103RC 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.
 
  The names for the serial hardware peripherals must not be confused with the names of the serial ports of the STorM32 controller!
 
For instance, on the v1.3x boards the serial port {{BOX|UART}} is connected to the hardware peripheral UART3, while on the v3.3 and v4.1 boards it is connected to the hardware peripheral UART5. From a user perspective this is however irrelevant, since all the user needs to know is that there is a serial port {{BOX|UART}} which can be selected in the GUI as {{PARAMVALUE|uart}}.
 
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 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 {{BOX|UARTX}} port.
 
=== Availability ===
 
Concerning the availability of the serial ports (for STorM32 boards documented in this wik) one can note:
 
* All STorM32 boards provide the {{BOX|UART}} port.
 
* The v3.3/v4.1 STorM32 boards do provide a port labeled UART1 (Rx1/Tx1), which is indeed the UART1 hardware peripheral. Some v3.3 and the v4.1 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 {{PARAMVALUE|usb}}, i.e., this is the {{BOX|USB}} port.
 
* On the STorM32 v1.x boards the {{BOX|USB}} serial is indeed the USB connector. The UART1 hardware peripheral, used e.g. for flashing firmware, is available on these boards on the {{BOX|RC}} port, as pins RC-0 and RC-1.
 
* On the v3.3/v4.1 STorM32 boards the {{BOX|UART2}} serial is either available as an explicit {{BOX|UART2}} port or via the {{BOX|ESP}} port. The v1.x boards do not offer this serial at all (for these boards the GUI setting {{PARAMVALUE|uart2}} has no effect).
 
* On all STorM32 boards the {{BOX|UARTX}} serial is available on the {{BOX|RC}} port, pins RC-0 and RC-1 (accessible in the GUI as {{PARAMVALUE|uartx}}). In pictures of the v1.x board one however finds it indicated as UART1 and not UARTX (on these boards {{BOX|UARTX}} is in fact the UART1 peripheral).
 
{| class="wikitable"
! Gui
! v1.3x
! v3.3/v4.1
|-
| {{PARAMVALUE|uart}}  || {{BOX|UART}} port || {{BOX|UART}} port
|-
| {{PARAMVALUE|uart2}} || has no effect, {{BOX|UART2}} port not available || {{BOX|UART2}} port or on {{BOX|ESP}} port
|-
| {{PARAMVALUE|usb}} || USB connector || USB connector or UART1 port<br>is equal to UART1
|-
| {{PARAMVALUE|uartx}} || RC-0,RC-1 pins on {{BOX|RC}} port<br>is equal to UART1, labeled UART1 || RC-0,RC-1 pins on {{BOX|RC}} port<br>labeled UARTX
|}
<!--
 
The naming of the STorM32's serial ports can be confusing. This article aims at providing some clarification.


== Ports ==
== Ports ==


Generally one has to distinguish between the hardware peripherals provided by the STM32 micro-controller and their naming, and the serial ports exposed on the STorM32 boards to the user and their naming. Unfortunately, there is some overlap in the naming, which certainly contributes to the confusion. Furthermore, some STorM32 serials may not be found on ports which are named accordingly, but on "other" ports. This mess is certainly unfortunate, but reflects the efforts to continually increase the STorM32's capabilities and satisfy user demands while keeping some backwards compatibility.
Generally one has to distinguish between the hardware peripherals provided by the STM32 micro-controller and their names, and the available serial ports and their naming.  
 
Unfortunately, there is some overlap in the naming, which certainly contributes to the confusion. Furthermore, some STorM32 serials may not be found on ports which are named accordingly, but on "other" ports. This mess is certainly unfortunate, but reflects the efforts to continually increase the STorM32's capabilities and satisfy user demands while keeping some backwards compatibility.


The hardware peripherals are generally called UARTx or USARTx, where x goes from 1 to 5 for e.g. STM32F103 chips. We will not distinguish between UART or USART but just call them UARTx.
The hardware peripherals are generally called UARTx or USARTx, where x goes from 1 to 5 for e.g. STM32F103 chips. We will not distinguish between UART or USART but just call them UARTx.
Line 13: Line 68:
* All STorM32 boards provide the {{BOX|UART}} port.
* All STorM32 boards provide the {{BOX|UART}} port.


* The STorM32 v3.x boards do provide a port labeled UART1, which is indeed the STM32 UART1 peripheral, and can be used for flashing firmware, but to the STorM32 firmware it is the {{BOX|USB}} port (accessible in the GUI as {{PARAMVALUE|usb}}). Some STorM32 v3.x boards provide a physical USB connector, which is however just connected to UART1 (using a USB-TTL adapter), i.e., it can be used for flashing to the STorM32 firmware it is the {{BOX|USB}} port. On the STorM32 v1.x boards the {{BOX|USB}} port is indeed the physical USB connector, while the STM32's UART1 peripheral used for flashing firmware is available on the STorM32 {{BOX|RC}} port, pins RC-0 and RC-1.
* The STorM32 v3.x boards do provide a port labeled UART1, which is indeed the STM32 UART1 peripheral, and can be used for flashing firmware, but to the STorM32 firmware it is the {{BOX|USB}} port (accessible in the GUI as {{PARAMVALUE|usb}}). Some STorM32 v3.x boards provide in addition a physical USB connector, which is however just also UART1 (i.e. connected to UART1 with a USB-TTL adapter), with said function. On the STorM32 v1.x boards the {{BOX|USB}} port is indeed the physical USB connector, while the STM32's UART1 peripheral used for flashing firmware is available on the STorM32 {{BOX|RC}} port, pins RC-0 and RC-1.


* On the STorM32 v3.x boards the {{BOX|UART2}} serial is either available as an explicit {{BOX|UART2}} port, or available via the {{BOX|ESP}} port. The v1.x boards do not offer this serial at all (for these boards the GUI setting {{PARAMVALUE|uart2}} has no effect).
* On the STorM32 v3.x boards the {{BOX|UART2}} serial is either available as an explicit {{BOX|UART2}} port or via the {{BOX|ESP}} port. The v1.x boards do not offer this serial at all (for these boards the GUI setting {{PARAMVALUE|uart2}} has no effect).


* On all STorM32 boards the {{BOX|UARTX}} serial is available on the {{BOX|RC}} port, pins RC-0 and RC-1 (accessible in the GUI as {{PARAMVALUE|uartx}}). For the v1.x board it is however indicated in the pictures of the board as UART1 (which is the STM32 peripheral it is connected to on these boards).
* On all STorM32 boards the {{BOX|UARTX}} serial is available on the {{BOX|RC}} port, pins RC-0 and RC-1 (accessible in the GUI as {{PARAMVALUE|uartx}}). In pictures of the v1.x board it is however indicated as UART1 and not UARTX (on these boards UARTX is in fact the STM32 UART1 peripheral).
-->


== Baudrate ==
== Baudrate ==


The default baudrate is generally 115200 bps for all serial ports (including USB on the v3.x boards).
The default baudrate is generally 115200 bps for all serial ports (including {{BOX|USB}} on the v3.3 and v4.1 boards).


They can be adjusted for the serials {{BOX|USB}}, {{BOX|UART}}, {{BOX|UART2}} in the GUI. There is no possibility to adjust the baudrate of the {{BOX|UARTX}} serial port.
They can be adjusted for the {{BOX|USB}}, {{BOX|UART}}, {{BOX|UART2}} serial ports in the GUI. There is no possibility to adjust the baudrate of the {{BOX|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|The GUI per default also communicates with a baudrate of 115200 bps. It can be changed in the GUI.}}


{{COMMENT|Changing the baudrate of a serial port can imply that one cannot connect to this port with the GUI anymore.}}
{{COMMENT|Changing the baudrate of a serial port can imply that one cannot connect to this port with the GUI anymore.}}

Latest revision as of 17:23, 19 January 2024

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

Ports

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

Generally, the STorM32 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 STM32F103RC 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.

 The names for the serial hardware peripherals must not be confused with the names of the serial ports of 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.3 and v4.1 boards it is connected to the hardware peripheral UART5. From a user perspective this is however irrelevant, since all the user needs to know is that there is a serial port UART which can be selected in the GUI as “uart”.

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 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 (for STorM32 boards documented in this wik) one can note:

  • All STorM32 boards provide the UART port.
  • The v3.3/v4.1 STorM32 boards do provide a port labeled UART1 (Rx1/Tx1), which is indeed the UART1 hardware peripheral. Some v3.3 and the v4.1 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. 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 v3.3/v4.1 STorM32 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).
Gui v1.3x v3.3/v4.1
“uart” UART port UART port
“uart2” has no effect, UART2 port not available UART2 port or on ESP port
“usb” USB connector USB connector or UART1 port
is equal to UART1
“uartx” RC-0,RC-1 pins on RC port
is equal to UART1, labeled UART1
RC-0,RC-1 pins on RC port
labeled UARTX

Baudrate

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

They can be adjusted for the USB, UART, UART2 serial ports 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.

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