Preface
Since the early 2000s, hundreds of companies have licensed the ARM CPU and the number of licensees is
growing very rapidly. While the licensee must follow the ARM CPU architecture and instruction set, they are free to
implement peripherals such as I/O ports, ADCs, Timers, DACs, SPIs, I2Cs and UARTs as they please. In other words,
while one can write an Assembly language program for the ARM chip, and it will run on any ARM chip, a program written
for the I/O ports of an ARM chip for company A will not run on an ARM chip from company B. This is due to the fact that
special function registers and their physical address locations to access the I/O ports are not standardized and every
licensee implements it differently. We have dedicated the first volume in this series to the ARM Assembly language
programming and architecture since the Assembly language is standard and runs on any ARM chip regardless of who
makes them. Our ARM Assembly book is called "ARM Assembly Language Programming and Architecture" and is
available from Amazon in Kindle format. See the following link:
http://www.amazon.com/Assembly-Language-Programming-Architecture-ebook/dp/B00ENJPNTW/ref=sr_1_1
For the peripheral programming of the ARM, we had no choice but to dedicate a separate volume to each vendor.
This volume covers the peripheral programming of the TI (Texas Instruments) ARM Tiva chip. Throughout the book, we
use C language to access the special function registers and program the TI ARM Tiva peripherals. We have provided a
couple of Assembly language programs for I/O ports in Chapter 2 for those who want to experiment with Assembly
language in accessing the I/O ports and their special function registers. These few Assembly language programs also
help to see the contrast between the C and Assembly versions of the same program in ARM.
Two approaches in programming the ARM chips
When you program an ARM chip, you have two choices:
1. Use the functions written by the vendor to access the peripherals. The vast majority of the vendors/
companies making the ARM chip provide a proprietary device library of functions allowing access to their
peripherals. These device library functions are copyrighted and cannot be used with another vendor's ARM
chip. For students and developers, the problem with this approach is you have no control over the functions
and it is very hard to customize them for your project.
2. The second approach is to access the peripheral's special function registers directly using C language and
create your own custom library since you have total control over each function. Much of these functions can
be modified and used with another vendor if you decide to change the ARM chip vendor. In this book, we have
taken the second approach since our primary goal is to teach how to program the peripherals of an ARM chip.
We know this approach is difficult and tedious, but the rewards are great.
Compilers and IDE Tools
For programming the ARM chip, you can use any of the widely available compilers from Keil (www.keil.com), IAR
(www.IAR.COM) or any other one. Some vendors also provide their own compiler IDE for their ARM chips. TI provides
Code Composer Studioâ„¢ (CCStudio) free of charge. For this book, we have used the Keil ARM compiler IDE to write
and test the programs. They do work with other compilers including the TI CCStudio.
TI ARM Trainer
The TI has many inexpensive trainers for the ARM Tiva C series. Among them are TI Launchpad Evaluation kits.
Although we used the TI Launchpad Evaluation Kit to test the programs, the programs runs on other TI kits as long as
they are based on Tivaâ„¢ C Series ARMآ® Cortexâ„¢-M4F-based microcontrollers series.
Chapters Overview
In Chapter 1, we examine the C language data types for 32-bit systems. We also explore the new ISO C99 data
types since they are widely used in IDE compilers for the embedded systems.
Chapter 2 examines the simple I/O port programming and shows sample programs on how to access the special
function registers associated with the general purpose I/O (GPIO) ports.
Chapter 3 shows the interfacing of the ARM chip with the real-world devices: LCD and keypad. It provides sample
programs for the devices.
In Chapter 4, the interfacing and programming of serial UART ports are examined.
Chapter 5 is dedicated to the timers in ARM. It also shows how to use timers as an event counter.
The Interrupt programming of the ARM is discussed in Chapter 6.
Chapter 7 examines the ADC concepts and shows how to program them with the ARM chip. It also examines the
sensor interfacing and signal conditioning.
Chapter 8 covers the SPI protocol and shows DAC interfacing with sample programs in ARM.
The I2C bus protocol and interfacing of an I2C based RTC is discussed in Chapter 9.
Chapter 10 explores the relay and stepper motor interfacing with ARM.
评论1