Peifang Zhou
Advanced Serial Communications in an RTOS Environment
Status: Coming up in April 2025!This workshop marks the conclusion of our trilogy on the serial interface, building upon the insights shared in the last two Embedded Online Conferences. In this session, we will explore an advanced Direct Memory Access (DMA) technique that transforms the traditional character-based serial interface into a variable-length, packet-oriented one, similar to Ethernet. This powerful approach opens up new possibilities for reducing the complexity of software required for command handling and file transfers.
We will start by examining the theoretical foundations of this DMA technique, discussing its implementation for managing data packets of varying lengths. Following this, we will demonstrate practical applications through live coding on an STM32 Nucleo board. You will witness firsthand how this transformation simplifies the development of software for command handling and file transfer. By the end of the workshop, you will have a clear understanding of how to apply these concepts to your own projects to enhance the robustness and efficiency of your embedded systems.
Join us for this comprehensive session, where theory meets practice, and elevate your understanding of serial interfaces to the next level.
Building a Clean and Simple Command Line Interface in an RTOS Environment
Status: Available NowIt is a sequel to last year’s two presentations: Design Considerations for Serial Communications in an RTOS Environment and Building a Simple Command-Line Interface.
After blinking a LED and sending out “Hello, World” over a serial port, the next step in a typical embedded development is to build a command-line interface (CLI) to bring up other components and interfaces.
This workshop will demonstrate how to design a clean and simple CLI in an RTOS environment by partitioning functionalities and distributing them to functional blocks. The key insight is to view a console command as an immutable object and it flows through individual functional blocks. As a result of this streamlined design, simplicity is achieved by eliminating interactions between any non-neighboring blocks. In particular, there are three key ingredients in this simple CLI design:
- A terminal utility program (e.g., Termite) as a builder to assemble command objects. Once a command object is fully constructed, it will be sent out to a target board over a serial interface.
- The UART ISR as a de-serializer to reassemble the command object and notify a console task of the availability of such command object.
- The console task as a dispatcher to find a command handler and delegate the rest of command processing to a worker task.
The workshop will first present the architectural design of the proposed simple CLI interface and then walk through its implementation with live coding. A low-cost STM32 Nucleo board will be used to demonstrate how simple it is to implement each functional block with less than a dozen lines of C code. After the workshop, the participants will be able to apply this clean and simple CLI design to their real-world projects.
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.