Robotics platforms have unique needs where microcontroller (MCU) performance is concerned. MCUs that have been optimized for use in robots often incorporate multiple functions, including built-in internet protocol (IP) connectivity, safety and security functions, and advanced control algorithms. Integrating an MCU core with a field programmable gate array (FPGA) is another approach to achieving optimized performance for robotics applications. Furthering the utility of MCUs in robotics, the robotic operating system (ROS), originally optimized for use with higher-performance central processing units (CPUs), has been simplified and released as micro-ROS for implementation in embedded MCUs and other lower-resource devices.
MCU options for robotics continue to multiply. This FAQ will review basic robot platform architectures with a particular emphasis on the use of MCUs; it reviews performance options that open up when MCU cores are integrated with FPGAs and closes with a review of the benefits of using micro-ROS. MCUs are important elements in robot designs. Even simple consumer robots can include multiple MCUs for specialized functions such as communications, user interfaces, USB, and motor control (Figure 1).
The emergence of smart factories and Industry 4.0 is driving demand for increasingly sophisticated and complex industrial robots. That results in a growing demand for high-performance MCUs with peripherals and accelerators supporting network communications, functional safety needs, and predictive analytics to minimize downtime. Heterogenous MCUs and multicore devices running from 800 MHz to 1GHz are often needed. Processing speed is critical to support high precision control of the motor’s position, direction, speed, and torque in multi-axis robots.
High-performance MCUs for robotics include dedicated accelerator hardware that supports the computations needed for servo control. In some cases, the current control loop calculations can be completed in under 1.5µs. In servo motor drive systems, the control loop can be separated into multiple layers, including a higher-level motion control loop, a position loop, a speed loop, and a torque/current loop, arranged in a cascaded topology (Figure 2). Upstream loops run at a multiple of the next loop downstream and provide reference data to the downstream loops, with the torque or current loop being the tightest control loop.
The control loops in the architecture outlined above can be implemented across the cores in a multicore MCU or divided between MCU cores and an FPGA. Optimization of the partitioning maximized the available processing bandwidth by spreading the loops among the independent computing resources. Each processing core can quickly run its specific algorithm, passing the results downstream for the next loop. At the same time, it continues to provide other functions as needed until the next set of input data arrives, and the algorithm begins again.
The individual MCU cores need a high level of performance to have the bandwidth available for rapidly processing the basic algorithm and providing additional functions required by the system. As cycle times approach 31.25 µs in a 32-kHz control loop or when inputs from multiple axes must be processed nearly simultaneously, fast processing is mandatory. Sometimes, it can take the combined resources of one or more high-performance MCU cores plus an FPGA.
MCUs, FPGAs, and eFPGAs
In robotic systems, combinations of MCUs and FPGAs can provide superior solutions compared with each type of device by itself. MCUs are flexible and easy to program. MCUs can also handle some level of parallel processing, but ultimately the core can become a bottleneck to higher levels of parallel performance. FPGAs consist of thousands of logic blocks which can be configured for massively parallel processing. FPGAs can also offer a higher level of flexibility, but they tend to be more expensive.
MCUs are great for handling routine functions such as multi-axis servo control. FPGAs can include large numbers of DSP blocks and programmable logic that can support the parallel processing needed for artificial intelligence (AI), machine learning (ML), and convolutional neural network (CNN) inference algorithms. The more AI/ML/CNN functionality needed on the robot platform, the greater the benefit of including an FPGA along with the MCU(s).
Comparing a MCU with an FPGA finds that a MCU includes a processor core, some memory, and many I/O ports and other functions. At the lowest level of abstraction, FPGAs and MCUs are composed of various multiplexers, flip-flops, adders, etc. However, the interconnections between all of the elements in a microcontroller are fixed and cannot be reconfigured. The user can use one of a variety of software development tools for microcontrollers. In the case of FPGAs, the interconnections are not fixed, and the device is “programmed” by designing an interconnect structure in hardware to perform specific functions. The differences give rise to the cost and performance tradeoffs between MCUs and FPGAs (Figure 3).
Depending on the needs of the specific design, there are three ways to combine MCUs and FPGAs:
- An MCU and FPGA can be combined as two discrete components
- A FPGA can include an integrated MCU core
- A MCU can include an integrated FPGA section
Each of these approaches has its advantages. For applications that need both high-performance servo control capabilities and large amounts of AI/ML/CNN functionality, a high-performance MCU can be combined with a separate large FPGA. The MCU might be used for control functions, while the FPGA is used for more intensive artificial intelligence and machine learning activities on the robot platform. In cases where the need for massive parallel processing and AI/ML/CNN dominates, an MCU core can be integrated with a large FPGA. In cases where the MCU dominates, and a relatively small amount of parallel processing is needed, a smaller embedded FPGA (eFPGA) can be integrated with a high-performance MCU.
In many robotics applications, one of the integrated solutions is often preferred. Integrated solutions can provide higher performance levels due to the close proximity of the MCU and FPGA elements. When a discrete FPGA is combined with a separate MCU, each device needs its memory buffer to handle data transfers between them. System performance can suffer if large amounts of data need to be transferred between the MCU and FPGA. On the other hand, if the FPGA and MCU are integrated into a single piece of silicon, they can share DDR memory, and data transfers don’t need to be buffered. Data transfers, in that case, involve simply transferring memory pointers between the MCU and FPGA.
Robot operating system for MCUs
The basic robot operating system (ROS) is an open-source software framework for robotics application development optimized for microprocessors running operating systems like Ubuntu Focal, macOS, and Windows 10. ROS 2 is the new generation of ROS. ROS 2 is designed with a layered architecture that separates the ROS client layers from the ROS middleware layer. The latest development in the ROS sphere is micro-ROS that brings ROS 2 to mid-range and higher MCUs. MCUs with tens of KB of RAM are needed to implement micro-ROS. Communication peripherals that enable the micro-ROS client-to-agent communication are also required in the MCU.
micro-ROS provides a ROS 2 development ecosystem that can run on top of Real-Time Operating Systems (RTOS), enabling them to comply with the time-critical requirements of robot system tasks that demand time deadlines or deterministic responses. FreeRTOS was one of the first RTOSes supported by the micro-ROS project and is integrated into its software stack. All of the implementations and tools developed by the FreeRTOS community can be reused with micro-ROS (Figure 4).
FreeRTOS has minimal memory and processing overhead, with the RTOS kernel binary image needing only 6K to 12K bytes, making it well-suited for running micro-ROS. In addition to FreeRTOS, micro-ROS can be run with the Zepher RTOS, and Zepher is supported by the micro-ROS client library and its middleware.
Specifying MCUs for robotics platforms is a complex process. Multiple MCUs or a single MCU with multiple cores are often required, plus the possible addition of an FPGA, either as an external device or an embedded element within the MCU. There are multiple tradeoffs when considering the integration of MCUs and FPGAs. For example, the MCU can be used for control functions, while the FPGA is used for more intensive artificial intelligence and machine learning activities on the robot platform. The release of the micro-ROS robot operating system to run on MCUs is another important tool available to designers of advanced robotics platforms.
An Engineer’s Guide to Industrial Robot Designs, Texas Instruments
First micro-ROS Application on Zephyr RTOS, Zephyr
FPGAs and Microcontrollers, Digilent
micro-ROS on FreeRTOS, FreeRTOS
Robotic Vacuum Cleaner, Microchip
Teardown: D7 robot vacuum from Neato Robotics, EEWorld