Embedded
Embedded
Volume 3
Fourth Edition,
January 2017
Jonathan W. Valvano
ii Jonathan Valvano
Fourth edition
January 2017
In order to reduce costs, this college textbook has been self-published. For more information about my
classes, my research, and my books, see http://users.ece.utexas.edu/~valvano/
For corrections and comments, please contact me at: [email protected]. Please cite this book
as: J. W. Valvano, Embedded Systems: Real-Time Operating Systems for ARM® Cortex-M
Microcontrollers, Volume 3, http://users.ece.utexas.edu/~valvano/, ISBN: 978-1466468863.
Table of Contents
Preface to Volume 3
Embedded systems are a ubiquitous component of our everyday lives. We interact with
hundreds of tiny computers every day that are embedded into our houses, our cars, our toys,
and our work. As our world has become more complex, so have the capabilities of the
microcontrollers embedded into our devices. The ARM Cortex-M family represents the new
class of microcontrollers much more powerful than the devices available ten years ago. The
purpose of this book is to present the design methodology to train young engineers to
understand the basic building blocks that comprise devices like a cell phone, an MP3 player, a
pacemaker, antilock brakes, and an engine controller.
This book is the third in a series of three books that teach the fundamentals of embedded
systems as applied to the ARM Cortex-M family of microcontrollers. This third volume is
primarily written for senior undergraduate or first-year graduate electrical and computer
engineering students. It could also be used for professionals wishing to design or deploy a real-
time operating system onto an ARM platform. The first book Embedded Systems: Introduction
to ARM Cortex-M Microcontrollers is an introduction to computers and interfacing focusing
on assembly language and C programming. The second book Embedded Systems: Real-Time
Interfacing to ARM Cortex-M Microcontrollers focuses on interfacing and the design of
embedded systems. This third book is an advanced book focusing on operating systems, high-
speed interfacing, control systems, and robotics.
An embedded system is a system that performs a specific task and has a computer embedded
inside. A system is comprised of components and interfaces connected together for a common
purpose. This book presents components, interfaces and methodologies for building systems.
Specific topics include microcontrollers, design, verification, hardware/software
synchronization, interfacing devices to the computer, timing diagrams, real-time operating
systems, data collection and processing, motor control, analog filters, digital filters, and real-
time signal processing.
In general, the area of embedded systems is an important and growing discipline within
electrical and computer engineering. In the past, the educational market of embedded systems
has been dominated by simple microcontrollers like the PIC, the 9S12, and the 8051. This is
because of their market share, low cost, and historical dominance. However, as problems
Jonathan Valvano xiii
become more complex, so must the systems that solve them. A number of embedded system
paradigms must shift in order to accommodate this growth in complexity. First, the number of
calculations per second will increase from millions/sec to billions/sec. Similarly, the number of
lines of software code will also increase from thousands to millions. Thirdly, systems will
involve multiple microcontrollers supporting many simultaneous operations. Lastly, the need
for system verification will continue to grow as these systems are deployed into safety critical
applications. These changes are more than a simple growth in size and bandwidth. These
systems must employ parallel programming, high-speed synchronization, real-time operating
systems, fault tolerant design, priority interrupt handling, and networking. Consequently, it will
be important to provide our students with these types of design experiences. The ARM
platform is both low cost and provides the high performance features required in future
embedded systems. Although the ARM market share is large and will continue to grow.
Furthermore, students trained on the ARM will be equipped to design systems across the
complete spectrum from simple to complex. The purpose of writing these three books at this
time is to bring engineering education into the 21st century.
This book employs many approaches to learning. It will not include an exhaustive
recapitulation of the information in data sheets. First, it begins with basic fundamentals, which
allows the reader to solve new problems with new technology. Second, the book presents many
detailed design examples. These examples illustrate the process of design. There are multiple
structural components that assist learning. Checkpoints, with answers in the back, are short
easy to answer questions providing immediate feedback while reading. Homework problems,
which typically are simpler than labs, provide more learning opportunities. The book includes
an index and a glossary so that information can be searched. The most important learning
experiences in a class like this are of course the laboratories. More detailed lab descriptions are
available on the web. Specifically for Volume 1, look at the lab assignments for EE319K. For
Volume 2 refer to the EE445L labs, and for this volume, look at the lab assignments for
EE445M/EE380L.6.
There is a web site accompanying this book http://users.ece.utexas.edu/~valvano/arm.
Posted here are ARM Keil™ uVision® and Texas Instruments Code Composer Studio™
projects for each of the example programs in the book. You will also find data sheets and Excel
spreadsheets relevant to the material in this book.
The book will cover embedded systems for ARM® Cortex™-M microcontrollers with specific
details on the TM4C123, TM4C1294, and MSP432. Most of the topics can be run on any Texas
Instruments Cortex M microcontroller. In these books the terms MSP432 and TM4C will refer
to any of the Texas Instruments ARM Cortex-M based microcontrollers. Although the solutions
are specific for the MSP432 and TM4C families, it will be possible to use these books for
other ARM derivatives.
Acknowledgements
I owe a wonderful debt of gratitude to Daniel Valvano. He wrote and tested most of the
software examples found in these books. Secondly, he maintains the example web site,
http://users.ece.utexas.edu/~valvano/arm. Lastly, he meticulously proofread this manuscript.
Many shared experiences contributed to the development of this book. First I would like to
acknowledge the many excellent teaching assistants I have had the pleasure of working with.
Some of these hard-working, underpaid warriors include Pankaj Bishnoi, Rajeev Sethia, Adson
da Rocha, Bao Hua, Raj Randeri, Santosh Jodh, Naresh Bhavaraju, Ashutosh Kulkarni, Bryan