Page 92 - Build Your Own Quadcopter_ Power Up Your Designs with the Parallax Elev-8
P. 92
Chapter 4: Prog ramming the P arallax Propeller Chip 71
speed, better frequency stability, and better precision of the clock signal than the built-in
internal RC oscillator does. In addition, the applications discussed later in this chapter
require precise timing, which necessitates the use of the crystal-controlled oscillator.
The Prop chip also has a phase-locked loop (PLL) circuit that is used only in conjunction
with the crystal oscillator. The PLL circuit can multiply the external crystal resonant
frequency in steps of 1×, 2×, 4×, 8× or 16×. It is very common to have a Prop board equipped
with a 5-MHz crystal used with the 16× PLL multiplier to create an 80-MHz Prop clock
frequency. This does not quite match the 2.4- to 3.0-GHz range of Intel processors, but it does
not need to in order to meet the needs of the Prop embedded applications.
The Prop may also be thought of as a microcontroller because of the GPIO pins and
because each cog contains two versatile counters that may be configured in different ways to
suit an application. Every cog also has its own video generator circuit that both improves
display performance and increases program display functionality.
The hub and cogs interface in a round-robin fashion, as may be seen in Figure 4.1. Each
cog has a time slice in which to access the common 32-kB RAM memory. The hub-memory
access time is set to be 50% of the system-clock speed, which means a 40-MHz access rate for
an 80-MHz clock rate. Cogs are also rated at a nominal 20 million instructions per second
(MIPS) when operating at the 80-MHz clock speed. The MIPS rating is a result of an average
Prop instruction taking four clock cycles to complete. The 40-MHz round-robin hub access
speed means that data transfers between cogs and the shared hub memory are not constrained
or limited.
The 32-kB hub memory ROM is used to store common data tables as well as the character
generator set that each cog video generator can utilize to display programmed video output.
Sharing a common character data table frees up the individual cog memory for its own
program. 8 kB of hub ROM is also reserved for the Spin interpreter that converts source-level
Spin code into executable native instructions or tokens. A space-optimized copy of the Spin
interpreter is put into an individual cog's memory, thus enabling the cog to perform real-
time processing of the Spin tokens designated to run in that cog. The Spin language is
discussed in detail below in the programming section.
Note: You should realize that no code is ever executed from hub memory; all code that is run in a
Prop chip is executed by the cogs.
The Prop is manufactured in several physical packages including a 44-pin low profile
quad flat package (LQFP) surface-mount configuration that has 0.8-mm pin spacing. There is
also a 44-pin quad flat no-leads (QFN) carrier format, and finally, a 40 dual inline package (DIP)
suitable for solderless breadboard prototyping. I used the Parallax Propeller Board of
Education (BOE) shown in Figure 4.2 to develop and test the software used for the auxiliary
functions for the Elev-8 quadcopter.
The BOE has an LQFP-mounted Prop chip that is connected to many different peripherals,
which allows for rapid and convenient Prop software development. This is certainly true for
the servo-motor test application discussed in Chapter 5. There are a series of servo ports
located at the top right of Figure 4.3, which shows an annotated BOE photo.
There is also an external 64-kB EEPROM installed on the BOE that enables you to load
and store programs in a nontransient state, which means that the programs remains in the
EEPROM even if the power is shut off. Programs stored in RAM are considered transient
because they disappear once the power is removed. The BOE board supports the Prop
firmware feature whereby a program stored in EEPROM will automatically be copied into
the Prop RAM and then executed once the power is applied. Please be aware that there is a