Serial Ports: Difference between revisions
Line 17: | Line 17: | ||
The names for the serial hardware peripherals must not be confused with the names of the serial ports of the STorM32 controller! | 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. | 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. | 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. |
Revision as of 17:20, 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 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. 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).
Gui | v1.3x | v3.3 |
---|---|---|
“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.x 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.