Peifang Zhou

Design Considerations for Serial Communications in an RTOS Environment
Status: Available NowSerial communications such as console are prevalent in the embedded software development. This workshop will explore options and tradeoffs when implementing serial communications in an RTOS environment, in particular the methods to receive serial data and the interactions between ISR and the data receiving task. The workshop will go through standard techniques and present a simple yet powerful design for high-speed and bursty serial traffic.
The workshop uses an STM32 board for hands-on experience. Any STM32 board is fine. STM32CubeIDE is used to generate the initial startup code to save time. A simple terminal program named Termite is used for serial communications between the STM32 board and a Windows computer. To maximize the benefits of hands-on experience, the hardware and software requirements are detailed below:
- STM32 board – an STM32 Nucleo-64 board is recommended since it is low-cost and uses a single USB cable for power, debugging, programing, and serial communications. It requires little effort to get started quickly.
- USB cable to connect the STM32 board to a Windows computer.
- IDE – Create a user account, download STM32CubeIDE from ST website https://www.st.com/en/
development-tools/ , and install it on a Windows computer.stm32cubeide.html - Terminal program – go to the Termite website https://www.compuphase.com/software_termite.htm, click the “Termite version 3.4 (program only) (76 KiB)” link, unzip the downloaded file in any folder on a Windows computer, and double-click Terminite.exe to run the program.
It would save time to review one of the following documents to identify the UART Rx/Tx pins and the user LED pin (optional) before the start of the workshop:
- user manual – under the Documentation tab of the board webpage, or
- schematic – under the CAD Resources tab of the board webpage
For example, the STM32 Nucleo-F303RE webpage is https://www.st.com/en/evaluation-tools/nucleo-f303re.html#. Under the Documentation tab, there is a link to the user manual “UM1724STM32 Nucleo-64 boards (MB1136)”. Under the CAD Resources tab, there are three links to the Rev. C03/C04/C05 board schematics. On STM32 Nucleo-64 boards marked with the MB1136 identifier, USART2 interface is available on the PA2/PA3 pins and LD2 is a user controlled green LED connected to the PA5 pin.
Note that the examples from the workshop are only intended to illustrate concepts. For the ease of presentation, they are much simpler than the production-level source code developed in real-world projects.