100% found this document useful (2 votes)
141 views55 pages

(FREE PDF Sample) Programming With STM32: Getting Started With The Nucleo Board and C/C++ Donald Norris Ebooks

Nucleo

Uploaded by

onelzsanci
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
141 views55 pages

(FREE PDF Sample) Programming With STM32: Getting Started With The Nucleo Board and C/C++ Donald Norris Ebooks

Nucleo

Uploaded by

onelzsanci
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Experience Seamless Full Ebook Downloads for Every Genre at textbookfull.

com

Programming With STM32: Getting Started With the


Nucleo Board and C/C++ Donald Norris

https://textbookfull.com/product/programming-with-
stm32-getting-started-with-the-nucleo-board-and-c-c-donald-
norris/

OR CLICK BUTTON

DOWNLOAD NOW

Explore and download more ebook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Practical Tinker Board: Getting Started and Building


Projects with the ASUS Single-Board Computer 1st Edition
Elizabeth Clark
https://textbookfull.com/product/practical-tinker-board-getting-
started-and-building-projects-with-the-asus-single-board-computer-1st-
edition-elizabeth-clark/
textboxfull.com

Getting Started with Advanced C# 1st Edition Vaskaran


Sarcar [Sarcar

https://textbookfull.com/product/getting-started-with-advanced-c-1st-
edition-vaskaran-sarcar-sarcar/

textboxfull.com

Getting Started with the micro bit Coding and Making with
the BBC s Open Development Board 1st Edition Wolfram Donat

https://textbookfull.com/product/getting-started-with-the-micro-bit-
coding-and-making-with-the-bbc-s-open-development-board-1st-edition-
wolfram-donat/
textboxfull.com

Primary Mathematics Textbook 2B Jennifer Hoerst

https://textbookfull.com/product/primary-mathematics-
textbook-2b-jennifer-hoerst/

textboxfull.com
Learning C by developing games with Unity 2020 An
enjoyable and intuitive approach to getting started with C
programming and Unity Fifth Edition Harrison Ferrone
https://textbookfull.com/product/learning-c-by-developing-games-with-
unity-2020-an-enjoyable-and-intuitive-approach-to-getting-started-
with-c-programming-and-unity-fifth-edition-harrison-ferrone/
textboxfull.com

Getting Started with PhantomJS Beltran Aries

https://textbookfull.com/product/getting-started-with-phantomjs-
beltran-aries/

textboxfull.com

Getting Started with Kubernetes 2nd Edition Baier

https://textbookfull.com/product/getting-started-with-kubernetes-2nd-
edition-baier/

textboxfull.com

Make Getting Started with Processing py Allison Parrish

https://textbookfull.com/product/make-getting-started-with-processing-
py-allison-parrish/

textboxfull.com

Getting Started with Gulp - Second Edition Travis Maynard

https://textbookfull.com/product/getting-started-with-gulp-second-
edition-travis-maynard/

textboxfull.com
Copyright © 2018 by McGraw-Hill Education. All rights reserved. Except as
permitted under the United States Copyright Act of 1976, no part of this
publication may be reproduced or distributed in any form or by any means, or
stored in a database or retrieval system, without the prior written permission of
the publisher.

ISBN: 978-1-26-003132-4
MHID: 1-26-003132-2

The material in this eBook also appears in the print version of this title: ISBN:
978-1-26-003131-7, MHID: 1-26-003131-4.

eBook conversion by codeMantra


Version 1.0

All trademarks are trademarks of their respective owners. Rather than put a
trademark symbol after every occurrence of a trademarked name, we use names
in an editorial fashion only, and to the benefit of the trademark owner, with no
intention of infringement of the trademark. Where such designations appear in
this book, they have been printed with initial caps.

McGraw-Hill Education eBooks are available at special quantity discounts to use


as premiums and sales promotions or for use in corporate training programs. To
contact a representative, please visit the Contact Us page at
www.mhprofessional.com.

Information contained in this work has been obtained by McGraw-Hill


Education from sources believed to be reliable. However, neither McGraw-Hill
Education nor its authors guarantee the accuracy or completeness of any
information published herein, and neither McGraw-Hill Education nor its
authors shall be responsible for any errors, omissions, or damages arising out of
use of this information. This work is published with the understanding that
McGraw-Hill Education and its authors are supplying information but are not
attempting to render engineering or other professional services. If such services
are required, the assistance of an appropriate professional should be sought.
TERMS OF USE

This is a copyrighted work and McGraw-Hill Education and its licensors reserve
all rights in and to the work. Use of this work is subject to these terms. Except as
permitted under the Copyright Act of 1976 and the right to store and retrieve one
copy of the work, you may not decompile, disassemble, reverse engineer,
reproduce, modify, create derivative works based upon, transmit, distribute,
disseminate, sell, publish or sublicense the work or any part of it without
McGraw-Hill Education’s prior consent. You may use the work for your own
noncommercial and personal use; any other use of the work is strictly prohibited.
Your right to use the work may be terminated if you fail to comply with these
terms.

THE WORK IS PROVIDED “AS IS.” McGRAW-HILL EDUCATION AND


ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO
THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS
TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY
INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA
HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY
WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR
A PARTICULAR PURPOSE. McGraw-Hill Education and its licensors do not
warrant or guarantee that the functions contained in the work will meet your
requirements or that its operation will be uninterrupted or error free. Neither
McGraw-Hill Education nor its licensors shall be liable to you or anyone else for
any inaccuracy, error or omission, regardless of cause, in the work or for any
damages resulting therefrom. McGraw-Hill Education has no responsibility for
the content of any information accessed through the work. Under no
circumstances shall McGraw-Hill Education and/or its licensors be liable for any
indirect, incidental, special, punitive, consequential or similar damages that
result from the use of or inability to use the work, even if any of them has been
advised of the possibility of such damages. This limitation of liability shall apply
to any claim or cause whatsoever whether such claim or cause arises in contract,
tort or otherwise.
About the Author

Donald J. Norris has a degree in electrical engineering and an MBA


specializing in production management. He is currently an adjunct professor
teaching an Embedded Systems course in the College of Engineering,
Technology and Aeronautics, part of the Southern New Hampshire University
(SNHU). He has also taught many different undergrad and grad courses mainly
in the computer science and technology areas at SNHU and other regional
schools for the past 33 years. Don created and taught the initial robotics courses
at SNHU both on-campus and online.
Don retired from civilian government service with the U.S. Navy, where he
specialized in underwater acoustics related to nuclear submarines and associated
advanced digital signal processing systems. Since then, he has spent more than
23 years as a professional software developer using the C, C#, C++, Python,
Micro Python, Node.JS, JavaScript, PHP, and Java languages in varied
development projects. He also has been a certified IT security consultant for the
last six years.
He has written and had published seven books including three involving the
Raspberry Pi, one on how to build and fly your own drone, a book on the Intel
Edison, one on the Internet of Things, and one on Micro Python.
Don started a consultancy, Norris Embedded Software Solutions (dba NESS
LLC), which specializes in developing application solutions using
microcontrollers, sensors, and actuators. The business has also recently
completed several robotics projects for clients.
Don likes to think of himself as a perpetual hobbyist and geek and is
constantly trying out new technologies and out-of-box experiments. He is a
licensed private pilot, photography buff, amateur extra class operator, avid
runner, and most importantly, a proud grandfather of three great kids,
Evangeline, Hudson, and Holton.
This book is dedicated to Dr. Peter Kachavos, my son-in-law, who is a
remarkably intelligent man with an equally remarkable long medical career in
service to his patients and the community. Until recently, Peter was a practicing
internist with an office in Manchester, NH. He recently retired after 25 years
from that practice and soon will be pursuing other interesting opportunities in
the medical field.

Peter enjoys cooking, fine wine, traveling, and spending quality time with his
family. His wife is my daughter, Shauna, and their child is my two-year-old
granddaughter, Evangeline.

Peter and I have spent many hours discussing many topics ranging from ancient
Greek artifacts to the latest technologies impacting modern society. I always
look forward to those interesting and challenging discussions.
CONTENTS AT A GLANCE

1 Introduction to the STMicroelectronics Line of Microcontrollers

2 STM MCU Software

3 STM32CubeMX Application

4 STM Project Development

5 General-Purpose Input Output (GPIO) and the STM Hardware Abstraction


Layer (HAL)

6 Interrupts

7 Timers

8 Bit Serial Communications

9 Analog-to-Digital Conversion

10 Pulse Width Modulation (PWM)

11 Direct Memory Access (DMA) and the Digital-to-Analog Converter (DAC)

Index
CONTENTS

Preface

1 Introduction to the STMicroelectronics Line of Microcontrollers


Microcomputer vs Microcontroller
STM Nucleo Boards
Principal MCU Components
Bit Serial Ports
Nucleo-64 Board Options
Summary

2 STM MCU Software


Open-Source versus Commercial Proprietary Software
Bare Metal Development
Brief History of MCU
The MCU Toolchain
Configuring a STM32 Toolchain
Summary

3 STM32CubeMX Application
Pinout Tab
MCU Alternative Functions
Integrated Peripheral (IP) Tree Pane
Creating an Example Project using CubeMX
The main.c Code Listing
ARM Cortex Microcontroller Software Interface Standard (CMSIS)
CubeMX-Generated C Code
Compiling and Downloading the Project
Downloading the Hex Code
Summary

4 STM Project Development


Hello World Project
Creating the Hello Nucleo Project
Adding Functionality to the Program
Compiling and Executing the Modified Program
Simple Modification for the main.c Function
Complex Modification for the main.c File
Summary

5 General-Purpose Input Output (GPIO) and the STM Hardware


Abstraction Layer (HAL)
Memory-Mapped Peripherals
Core Memory Addresses
Peripheral Memory Addresses
HAL_GPIO Module
GPIO Pin Hardware
LED Test Demonstration
Enabling Multiple Outputs
Push-Button Test Demonstration
Clock Speed Demonstration
Setting the Pin Clock Speeds
Summary

6 Interrupts
Interrupts
NVIC Specifications
Interrupt Process
External Interrupts
Interrupt Demonstration
Summary

7 Timers
STM Timer Peripherals
STM Timer Configuration
Update Event Calculation
Polled or Non-interrupt Blink LED Timer Demonstration
Test Run
Interrupt-Driven Blink LED Timer Demonstration
Test Run
Multi-rate Interrupt-Driven Blink LED Timer Demonstration
Test Run
Modification to the Multi-rate Program
Test Run
Summary

8 Bit Serial Communications


UARTs and USARTs
USART Configuration
Windows Terminal Program
Enabling USART2
USART Transmit Demonstration Program
Test Run
USART Receive Demonstration Program
Test Run
Summary

9 Analog-to-Digital Conversion
ADC Functions
ADC Module with HAL
ADC Conversion Modes
Channels, Groups, and Ranks
ADC Demonstration
ADC Demonstration Software
Summary

10 Pulse Width Modulation (PWM)


General-Purpose Timer PWM Signal Generation
Timer Hardware Architecture
PWM Signals with HAL
Enabling the PWM Function
PWM Demonstration Software
Demonstration One
Demonstration Two
Demonstration Three
Demonstration Four
Adding Functional Test Code
Test Results
Summary

11 Direct Memory Access (DMA) and the Digital-to-Analog


Converter (DAC)
DMA
Basic Data Transfer Concepts
DMA Controller Details
Using HAL with DMA
Demonstration One
DAC Peripheral
DAC Principles
HAL Software for the DAC
Demonstration Two
Demonstration Three
Summary
PREFACE

This book will serve both as an introduction to the STMicroelectronics line


of STM32 microcontrollers (MCUs) and also as an easy-to-follow Getting
Started Guide for readers interested in developing with a STM MCU. I will be
using one of the very inexpensive STM Nucleo-64 development boards for all of
the book projects, which should make it inviting for most readers to become
involved with the hardware. In fact, doing the book demonstration projects is
really the only way you can really be assured that you have gained a good
comprehension of the material in this book.
I will state from the beginning that it is simply not possible to gain a total
understanding of how a STM MCU functions by only reading this book. The
manufacturer datasheets that describe individual STM MCUs are often over
1,000 pages in length, which describes the enormity of the task of trying to
master the voluminous amount of information that describes these devices.
Instead, the book contents focus on a few of the core components that make up a
STM MCU and how to program those components to accomplish fairly simple
tasks.
Some readers will have trepidation about starting to develop with what are
typically considered professional grade MCUs. I wish to allay that fear and state
that I have found that developing applications with at least one representative
sample STM MCU to be remarkably easy and straightforward. In fact, I will
state that in some aspects it is easier to develop with a STM MCU than with an
Arduino or Raspberry Pi, which many readers will already be quite familiar and
probably have already created projects with those boards.
Often, the single biggest issue with developing with MCUs is setting up a
stable development toolchain. I will describe how to do this in a simple to
follow, step-by-step process, which if you rigorously follow will guarantee that
you will be able to quickly and without much trouble generate working binary
programs. These programs will then be quickly downloaded into the
development board for execution.
1
Introduction to the
STMicroelectronics Line of
Microcontrollers

This chapter provides you with an introduction to the very comprehensive


STMicroelectronics (STM) line of microcontrollers (MCUs). I will be focusing
only on several specific controllers throughout the book, but that should provide
you with an adequate representation of the functions and capabilities of the full
line of STM MCUs.

Microcomputer vs Microcontroller
I believe at the start of this book that it must make very clear the differences
between a microcomputer and a MCU. The reason for this distinction is very
simple: STM is a company that designs and manufacturers MCUs, not
microcomputers. I think my following definition of a MCU is as good as any
that I have read:

A microcontroller is an integrated system containing a minimum of a


microprocessor, dynamic and non-volatile memory, and a set of peripherals
consistent with all design requirements.

Right away, you can see from the definition that a MCU contains a
microprocessor which is sometimes referred to as a microcomputer. There also
must be both dynamic or volatile memory as well as nonvolatile or static
memory, where the latter holds any programs or scripts necessary to run the
microprocessor. Finally, there are always peripherals added to the design that
allow for the input and output of digital signals. There are often additional
peripherals such as timers, interrupt controllers, serial data ports, and a variety of
others depending upon what requirements the MCU must meet.
I discuss all the principal MCU components below to provide you with a solid
background to understand how a MCU functions. Most of the following
explanations are based on the voluminous amount of information provided by
STM on their microcontrollers. The reason behind STM providing such a large
amount of information is to allow engineers/software developers access to all the
data they need in order to incorporate STM products into original equipment
manufacturer (OEM) designs and products. This approach is fundamentally
different than the approach taken by suppliers of maker style boards and
products, such as the Arduino, Raspberry Pi, BeagleBone, and so forth. In the
case of the latter, board documentation is geared toward how to use a board in a
project. The STM data is extremely specific describing items such as the
nanosecond timing pulses between memory chips and processor buses. This is
exactly the reason why some of the STM MCU datasheets are over 1,100 pages
in length. Fortunately, the datasheet for the primary STM MCU I will be using in
this book is only 138 pages. I will provide later in this chapter the website where
you can download the datasheet.

STM Nucleo Boards


MCU manufacturers such as STM have long recognized that they just couldn’t
provide only chips to potential customers as most would have no way to
effectively evaluate them for potential use in their products. This is the reason
why the manufacturers offer relatively low-cost evaluation and demonstration
boards, which have representative MCUs all setup and ready to run. STM offers
a series of such boards that it calls the Nucleo line. I will be using a fairly simple
Nucleo-64 board for the book projects. STM has actually embraced the maker
community by marketing the Nucleo lineup as boards suitable for maker project
use. These boards are very inexpensive, usually about US$10–15, which leads
me to believe that STM is striving to gain a foothold in the maker community by
actually subsidizing the manufacturing costs for the boards. In any case, this is a
boon for makers and hobbyists and one that we should embrace.
Figure 1-1 shows the three basic Nucleo boards available at the time of
writing this book.
Figure 1-1 Three basic Nucleo boards.

The boards are named Nucleo-32, Nucleo-64, and Nucleo-144 from left to
right, respectively, as shown in Figure 1-1. The number in each name represents
the number of pins present in the MCU chip. Nucleo-64 is the principal board
used in this book.

Principal MCU Components


The first component to consider is the processor or microcomputer.

Processor
The processor used in Nucleo-32 and Nucleo-64 boards is the ARM Cortex M-4
32-bit processor. It too has a lengthy 278-page user guide available from
infocenter.arm.com/help/topic/com.arm.doc.dui0553a/DUI0553A_cortex_m4_dgug.pdf
The actual processor circuitry is part of the STM MCU because STM has
purchased intellectual property (IP) rights from the ARM Corporation in order to
integrate it into its chips. However, for all practical purposes, the ARM
processor is programmed using the tools and techniques promulgated by the
ARM Corporation to support its processor IP. This distinction is of no
consequence in our case because the software tools to be used for the book
projects have all been carefully crafted and tested to work seamlessly together by
STM. Any license issues have already been resolved without bothering the end
user.
The following list contains some of the important specifications for the
Cortex M-4 processor for interested readers:
• Full-featured ARMv7-M instruction set, optimized for embedded
applications
• Floating point unit (FPU)
• Low-power 32-bit processor
• Memory protection unit (MPU)
• Nested vector interrupt controller (NVIC)
• Trace, breakpoint, and JTAG capabilities
• Advanced Microcontroller Bus Architecture (AMBA)
• Advanced High-Performance Bus (AHB5, AHB-Lite)

There are many more features to the Cortex M-4 processor as the 278-page
user guide would suggest. I would also recommend Joseph Yiu’s book, The
Definitive Guide to ARM® Cortex®-M3 and Cortex®-M4 Processors, Third
Edition, to readers who really want to delve into this processor to a great depth.
Figure 1-2 is a block diagram of the Cortex M-4 processor showing all of the
listed items and more.
Figure 1-2 ARM Cortex M-4 block diagram.

STM is responsible for the design and implementation of all components


outside of the box shown in Figure 1-2. Of course, the STM design must be
compliant with the ARM processor specifications. One item missing in the
figure is a clock input. The reason for it being missing is that the block diagram
is from the ARM Cortex M-4 user guide, while the clock circuitry is the
responsibility of STM, the MCU designer. STM has set the base processor clock
frequency at 72 MHz, which appears to be very low in today’s world of multi-
gigahertz clock rates for most PCs. In fact, the latest Raspberry Pi model 3 has a
1.2-GHz clock rate. But first appearances are deceiving in this case. The Cortex
M-4 processor uses an extremely efficient instruction set, with three-stage
pipelining, which maximizes the performance of the underlying reduced
instruction set computing (RISC) that the processor employs. In addition, many
common microcontroller tasks, which I discuss below, have been implemented
in a combination of hardware and firmware, further improving the overall
performance, while keeping the power consumption as low as possible. Power
consumption and performance are two key microcontroller attributes that system
designers always keep in mind. Keeping the clock rate as low as possible will
always minimize the power consumed as well as increase the longevity of the
chip.

Memory
The Cortex M-4 processor uses a Harvard architecture. This means that program
instructions are stored and retrieved from a memory separate and distinct from
the memory that holds data. The other common computer architecture is named
von Neumann in which instructions and data share a common memory. MCUs
have very limited memory and take advantage of the speed-up available by using
concurrent instruction and data access. Additionally, having separate memories
means that the processor is no longer constrained to the same sized data widths.
This means instructions can be fetched and executed in 4-byte chunks or 32 bits,
while data can be simultaneously handled with 1-byte or 8-bit chunks, thus
speeding up the overall throughput to and from the processor and memory.
Another advantage the Harvard architecture has over the von Neumann form is
that instruction prefetches can now be done in parallel with regular instruction
executions, thus further speeding up the overall system performance. Finally,
concurrent instruction and data access eliminates the need for data caches, which
are typically used in von Neumann machines. This further reduces system
complexity and power consumption.
The Nucleo-64 board used in this book is the STM MCU, model number
STM32F302R8. This chip has a 64-KB flash memory and a 16-KB static
random access memory (SRAM). Yes, those are kilobytes, not mega- or
gigabytes. You cannot expect to create any graphical programs that run in this
limited memory space. Microcontroller programs are truly a throwback to the
earliest days of computing where memory was very limited and developers had
to use every available byte to store and execute programs. Having mentioned the
scarce memory resources, you will be able to use a variety of modern-day
graphic-based programs to develop the MCU program, but they will run on a
PC. The compiled and optimized binary code will be downloaded into the MCU
from the PC.
It turns out that 64 KB is plenty of space to run fairly large programs because
the C/C++ cross-compiler used for this book’s projects produces optimize code,
eliminating all but the essential instructions needed for the program. The 16-KB
SRAM size is more than adequate for the dynamic memory requirements to
support a maximum 64-KB sized program. The actual memory is integrated onto
the MCU chip and its type is largely irrelevant for our purposes.

Peripherals
The peripherals are what make the MCU viable for its intended purposes. In my
microcontroller definition I stated, “a set of peripherals consistent with all design
requirements.” This means that microcontrollers typically have different
peripheral configurations depending upon the requirements they are designed to
meet. This is a major reason why STM manufactures such a wide variety of
MCUs. I will focus on the Nucleo-64 microcontroller I mentioned above and
will use its set of peripherals as my discussion points. I will next need to
demonstrate how the Nucleo-64 board is set up in order to fully explain how all
the peripheral features function with this board.

Nucleo-64 Board Layout


Figure 1-3 is a block diagram showing how the major components that make up
a Nucleo-64 board are configured.
Figure 1-3 Nucleo-64 block diagram.

The first item you should note is that the board is actually made of two
sections, the top section being a ST-LINK/V2-1 programmer and the bottom
section is the STM32 MCU. The bottom section is also fitted with two sets of
connectors. One set is compatible with the Arduino shield pin configuration and
other set is the ST Morpho pinout configuration. There are two push buttons, B1
and B2, shown in the figure. B1 is multipurpose, while B2 is the reset push
button. There is also one LED indicated in the figure; however, there are several
others also which are shown in follow-on figures. The programmer section may
be separated from the microcontroller section by snapping the sparse printed
circuit board (PCB) joints, which can be seen in Figure 1-1. I would not
recommend doing so because you would lose all programming capability for the
MCU section. I suppose it was set up in this fashion so you could separate the
sections once there was a working MCU for a specific project and there was no
need for any further programming.
Figure 1-4 is a top view of the Nucleo-64 board with most of the components
clearly annotated.

Figure 1-4 Annotated top view of the Nucleo-64 board.

Remarkably, there are relatively few components on the board. Most of the
space is taken up by connectors, push buttons, configuration jumpers, LEDs, and
the microcontroller chip. This sparse layout reflects the nature of the MCU,
which is to be an embedded device without any of the niceties needed for the
human-computer interface (HCI). HCI is possible with this board by using an
appropriate extension board that plugs into this board
Figure 1-5 shows the bottom side of the Nucleo-64 board.

Figure 1-5 Annotated bottom view of the Nucleo-64 board.

Not much to see in this figure other than a bunch of 0-ohm resistors that may
be removed if it was desired to disable certain features such as the reset and user
buttons and user LED, or make hardware configuration changes to the ST-LINK
programmer.
Figure 1-6 is much more interesting as it shows the pinouts for all the
connectors on the top of the Nucleo-64 board.
Figure 1-6 Nucleo-64 pinout diagram.

There are two sets of pinouts shown in Figure 1-6, one belonging to the
Arduino and the other to the ST Morpho. Connectors CN5, CN6, CN8, and CN9
belong to the Arduino set. Connectors CN7 and CN10 belong to the Morpho set.
It is important to note that there are no one-to-one relationships between the sets.
The Morpho connectors are two double rows of 38 pins for a total of 76 pins.
The Arduino connectors are single-row connectors totaling 32 pins in all spread
across four connectors.

Arduino Connectors
Tables 1-1 to 1-4, which are from the Nucleo-64 User Guide, detail the Arduino
connectors with cross-references between Arduino pin terms and STM32 pins. I
have provided further clarifications on some of the pin functions following each
table, where I felt it was appropriate.
Table 1-1 details the CN6 connector pinout. Refer to Figure 1-4 to see the
placement of CN6 on the board.

Table 1-1 CN6 Pinout

Grounding pin 3 will reset the MCU. The STM32 pin designation NRST is
short for non-maskable reset, which means a low on this pin is always
recognized as a forcible MCU reset. Pins 2 and 4 provide 3.3 V, but I would
recommend that only a very limited amount of current be drawn from these pins
or you risk disrupting the board operations. Pin 5 provides 5 V, but again my
same caution exists for excessive current draw. VIN is where you can attach an
external power supply. The input voltage range is approximately 7 to 12 V based
on the voltage regulator ratings connected to this pin. Jumper JP5 must be
switched to accommodate the external power supply. Finally, the IOREF pin
allows Arduino shields to adjust the I/O voltage to the 3V3 for the STM32 if
those shields follow the STM specification.
Table 1-2 details the CN8 connector pinout. Refer to Figure 1-4 to see the
placement of CN8 on the board.

Table 1-2 CN8 Pinout


These pins are the analog voltage inputs that are routed to the MCU
multichannel analog-to-digital converter (ADC). You must restrict the analog
input voltage to 3.3 V or less to avoid damaging the ADC inputs. Note that there
is no one-to-one correspondence between the Arduino channels and the MCU
channels. Pins 5 and 6 are the default ADC inputs. If you need these to bus #1
I2C inputs, you must disconnect solder bridges SB51 and SB56 and connect
SB42 and SB46. These connections are made using 0-ohm resistors on the
bottom side of the MCU board. Please note that the bus #1 I2C connections are
already available on pins 1 and 2 on connector CN5.
Table 1-3 details the CN5 connector pinout. Refer to Figure 1-4 to see the
placement of CN5 on the board.

Table 1-3 CN5 Pinout

The analog voltage reference (AREF) should be connected to 3.3 V because


that is the maximum allowed voltage to be input to the MCU ADC channels. If
you have another supply available with a lesser voltage, say 2.5 V, then you can
connect AREF to that and increase the ADC dynamic range by a third. Just be
aware that inputting a voltage greater than 2.5 V will not change the ADC
output, effectively saturating it. Pins 3 to 6 may be configured as general-
purpose input/output (GPIO) or act as the bus #2 serial peripheral interface
(SPI). Pins 2, 3, and 4 can also act as timer pins if neither the GPIO nor the SPI
is required.
Table 1-4 details the CN9 connector pinout. Refer to Figure 1-4 to see the
placement of CN9 on the board.
Table 1-4 CN9 Pinout

These eight pins are normally regular GPIO, but they may be reconfigured so
that pins 4, 6, and 7 are timer pins. In addition, pins 1 and 2 can act as the #2
USART.

Morpho Connectors
Table 1-5 is from the Nucleo-64 User Guide and details the STM Morpho
connections with references to the STM32 pins. I have provided further
clarifications on some of the pin functions following the table, where I felt it was
appropriate. I did not repeat the comments I provided for Arduino connection as
they are equally valid for the Morpho connections.
Table 1-5 CN7 and CN10 Pinouts

Table 1-5 details the CN7 and CN10 connector pinouts. Refer to Figure 1-4 to
see the placement of CN7 and CN10 on the board.
U5V is 5-V power supplied from the ST-LINK/V2-1 USB connector. The
BOOT0 input pin allows for changing how the MCU initially boots during a
power-on event. I will discuss the boot options in a later chapter. VBAT input is
often used as a battery backup for powering a real-time clock or a security key. It
is typically tied to VCC if not used for a battery backup.
The next series of MCU components that I will discuss enable the MCU to
perform its operations more efficiently and quickly than possible by relying on
software constructs.

Nested Vectored Interrupt Controller (NVIC)


Interrupts are essential elements in the MCU structure. Without them, MCUs
cannot efficiently function given the limited memory available and low clock
speeds. MCU interrupts are implemented both in hardware and software. But
first I need to define what an interrupt is and how it is used:
Another Random Scribd Document
with Unrelated Content
“And now,” he said, “I must be up and doing, although it is past two
o’clock. I must bid my mother good-bye, and I foresee there will be
no time to do it when once I have reported, which I promised to do
within twenty-four hours. By starting now I can reach Ferry Farm to-
morrow morning, spend an hour with her, and return here at night; so
if you, captain, will have my horses brought, I will wake up my boy
Billy”—for, although Billy was quite George’s age, he remained ever
his “boy.”
Next morning at Ferry Farm, about ten o’clock, Betty, happening to
open the parlor door, ran directly into George’s arms, whom she
supposed to be forty-five miles off. Betty was speechless with
amazement.
“Don’t look as if you had seen a rattlesnake, Betty,” cried George,
giving her a very cruel pinch, “but run, like a good child as you are,
though flighty, and tell our mother that I am here.”
Before Betty could move a step in marched Madam Washington,
stately and beautiful as ever. And there were the three boys, all
handsome youths, but handsomer when they were not contrasted
with the elder brother; and then, quite gayly and as if he were a mere
lad, George plunged into his story, telling his mother that he was to
make the campaign with General Braddock as first aide-de-camp,
and trying to tell her about the officers’ letter, which he took from his
pocket, but, blushing very much, was going to return it, had not Betty
seized it as with an eagle’s claw.
“Betty,” cried George, stamping his foot, “give me back that letter!”
“No, indeed, George,” answered Betty, with calm disdain. “Do not put
on any of your grand airs with me. I have heard of this letter, and I
mean to read it aloud to our mother. And you may storm and stamp
and fume all you like—’tis not of the slightest consequence.”
So George, scowling and yet forced to laugh a little, had to listen to
all the compliments paid him read out in Betty’s rich, ringing young
voice, while his mother sat and glowed with pride, and his younger
brothers hurrahed after the manner of boys; and when Betty had got
through the letter her laughing face suddenly changed to a very
serious one, and she ran to George and kissed him all over his
cheeks, saying:
“Dear George, it makes me so happy that I both want to laugh and
cry—dear, dear brother!”
And George, with tender eyes, kissed Betty in return, so that she
knew how much he loved her.
When Madam Washington spoke it was in a voice strangely different
from her usually calm, musical tones. She had just got the idol of her
heart back from all his dangers, and she was loath to let him go
again, and told him so.
“But, mother,” answered George, after listening to her respectfully,
“when I started upon my campaign last year you told me that you
placed me in God’s keeping. The God to whom you commended me
then defended me from all harm, and I trust He will do so now. Do
not you?”
Madam Washington paused, and the rare tears stole down her
cheeks.
“You are right, my son,” she answered, presently. “I will not say
another word to detain you, but will once more give you into the
hands of the good God to take care of for me.”
That night, before twelve o’clock, George reported at Alexandria to
General Braddock as his aide.
On the 20th of April, near the time that George had set out the year
before, General Braddock began his march from Alexandria in
Virginia to the mountains of Pennsylvania, where the reduction of
Fort Duquesne was his first object. There were two magnificent
regiments of crack British troops and ten companies of Virginia
troops, hardy and seasoned, and in the highest spirits at the
prospect of their young commander being with them. They cheered
him vociferously when he appeared riding with General Braddock,
and made him blush furiously. But his face grew very long and
solemn when he saw the immense train of wagons to carry baggage
and stores which he knew were unnecessary, and the general at that
very moment was storming because there were not more.
“These,” he said, “were furnished by Mr. Franklin, Postmaster-
General of Pennsylvania, and he sends me only a hundred and fifty
at that.”
“A hundred too many,” was George’s thought.
The march was inconceivably slow. Never since George could
remember had he so much difficulty in restraining his temper as on
that celebrated march. As he said afterwards, “Every mole-hill had to
be levelled, and bridges built across every brook.” General Braddock
wished to march across the trackless wilderness of the Alleghanies
as he did across the flat plains of Flanders, and he spent his time in
constructing a great military road when he should have been pushing
ahead. So slow was their progress that in reaching Winchester
George was enabled to make a détour and go to Greenway Court for
a few hours. The delight of Lord Fairfax and Lance was extreme, but
in a burst of confidence George told them the actual state of affairs.
“What you tell me,” said the earl, gravely, “determines me to go to
the low country, for if this expedition results disastrously I can be of
more use at Williamsburg than here. But, my dear George, I am
concerned for you, because you look ill. You are positively gaunt,
and you look as if you had not eaten for a week.”
“Ill!” cried George, beginning to walk up and down the library, and
clinching and unclinching his lists nervously. “My lord, it is my heart
and soul that are ill. Can you think what it is to watch a general,
brave but obstinate, and blind to the last degree, rushing upon
disaster? Upon my soul, sir, those English officers think, I verily
believe, that the Indians are formed into regiments and battalions,
with a general staff and a commissary, and God knows what!” And
George raved a while longer before he left to ride back to
Winchester, with Billy riding after him. This outbreak was so unlike
George, he looked so strange, his once ruddy face was so pallid at
one moment and so violently flushed at another that the earl and
Lance each felt an unspoken dread that his strong body might give
way under the strain upon it.
George galloped back into Winchester that night. Both his horse and
Billy’s were dripping wet, and as he pulled his horse almost up on his
haunches Billy said, in a queer voice:
“Hi, Marse George, d’yar blood on yo’ bridle. You rid dat boss hard,
sho’ nough!”
“Hold your tongue!” shouted George, in a tone that Billy had never
heard from him before; and then, in the next minute, he said,
confusedly, “I did not mean to speak so, but my head is in a whirl; I
think I must be ill.”
And as he spoke he reeled in his saddle, and would have fallen had
not Billy run forward and caught him. He staggered into the house
where he had lodgings, and got into his bed, and by midnight he was
raving with fever.
Billy had sense enough to go for Dr. Craik, George’s old
acquaintance, who had volunteered as surgeon to General
Braddock’s staff. He was a bright-eyed, determined-looking man, still
young, but skilled in his profession. By morning the fever was
reduced, and Dr. Craik was giving orders about the treatment as he
sat by George’s bedside, for the army was to resume its march that
day.
“Your attack is sharp,” said the doctor, “but you have an iron
constitution, and with ordinary care you will soon be well.”
George, pale and haggard, but without fever, listened to the doctor’s
directions with a half-smile. The troops were already on the move;
outside could be heard the steady tramp of feet, the thunder of
horses’ hoofs, the roll of artillery-wagons, and the commotion of an
army on the move. In a few moments the doctor left him, saying:
“I think you will shortly be able to rejoin the army, Colonel
Washington.”
“I think so, too,” answered George.
As soon as the doctor was out of the room George turned to Billy
and said:
“Help me on with my clothes, and as soon as the troops are well out
of the town fetch the horses.”
When the soldiers halted at noon, General Braddock, sitting under a
tree by the road-side, was asking Dr. Craik’s opinion of the time that
Colonel Washington could rejoin, when around the corner of a huge
bowlder rode George with Billy behind him. He was very pale, but he
could sit his horse. He could not but laugh at the doctor’s angry face,
but said deprecatingly to him:
“I would have fretted myself more ill had I remained at Winchester,
for I am not by nature patient, and I have been ill so little that I do not
know how to be ill.”
“I see you don’t,” was the doctor’s dry reply.
For four days George kept up with the army, and managed, in spite
of burning fevers, of a horrible weakness and weariness, of
sleepless nights racked with pain, to ride his horse. On the fifth he
was compelled to take to a covered wagon. There, on a rough bed,
with Billy holding his burning head, he was jolted along for ten days
more, each day more agonizing than the one before. In that terrible
time master and man seemed to have changed places. It was
George who was fretful and unreasonable and wildly irritable, while
Billy, the useless, the lazy, the incorrigible, nursed him with a
patience, a tenderness, a strange intelligence that amazed all who
saw it, and was even dimly felt by George. The black boy seemed
able to do altogether without sleep. At every hour of the day and
night he was awake and alert, ready to do anything for the poor
sufferer. As the days passed on, and George grew steadily worse,
the doctor began to look troubled. In his master’s presence Billy
showed no sign of fear, but he would every day follow Dr. Craik when
he left, and ask him, with an ashy face:
“Marse doctor, is Marse George gwi’ die?”
“I hope not. He is young and strong, and God is good.”
“Ef he die, an’ I go home, what I gwi’ say when mistis come out and
say, ‘Billy, wh’yar yo’ Marse George?’” And at that Billy would throw
himself on the ground in a paroxysm of grief that was piteous to see.
The doctor carefully concealed from the soldiers George’s real
condition. But after four or five days of agony a change set in, and
within the week George was able to sit up and even ride a little. The
wagons had kept with the rear division of the army, but George knew
that General Braddock, with twelve hundred picked men, had gone
ahead and must be near Fort Duquesne. On the fourteenth day, in
the evening, when the doctor came he found his patient walking
about. He was frightfully thin and pale, but youth and strength and
good habits were beginning to assert themselves. He was getting
well.
“Doctor,” said he, “this place is about fifteen miles from Fort
Duquesne. I know it well, and from this hour I emancipate myself
from you. This day I shall report for duty.”
The next morning, the 9th of July, 1755, dawned beautifully, and the
first long lances of light revealed a splendid sight on the banks of the
Monongahela. On one side flowed the great river in majestic beauty.
Following the shores was a kind of natural esplanade, while a little
way off the rich woods, within which dwelt forever a purple twilight,
overhung this charming open space. And along this open space
marched, in exquisite precision, two thousand of England’s crack
troops—cavalry, infantry, and artillery—and a thousand bronzed
Virginia soldiery to the music of the fife and drum. Often in after-
years George Washington was heard to say that the most beautiful
sight his eyes ever rested on was the sight of Braddock’s army at
sunrise on that day of blood. Officers and men were in the highest
spirits; they expected within a few hours to be in sight of Fort
Duquesne, where glory, as they thought, awaited their coming. Even
George’s apprehensions of the imprudence of this mode of attack
were soothed. He rode by General Braddock’s side, and was by far
the most conspicuous figure there for grace and nobility. His illness
seemed to have departed in a night, and he was the same erect,
soldierly form, fairly dwarfing every one contrasted with him. As the
general and his first aide rode together, General Braddock said,
confidently:
“Colonel Washington, in spite of your warning, see how far we have
come upon our way without disaster. The danger of an attack by
Indians is now passed, and we have but to march a few miles more
and glory is ours.”
Scarcely were the words out of his mouth when there was one sharp
crack of a gun, followed by a fierce volley, and fifty men dropped in
their tracks. But there was no enemy visible. The shots were like a
bolt of lightning from a clear sky.
“The Indians,” said George, in a perfectly composed voice, reining
up his horse.
“I see no Indians,” cried General Braddock, excitedly. “There is
disorder in the ranks; have them closed up at once, and march in
double time. We will soon find the enemy.”
But the firing from the invisible foe again broke forth, this time fiercer
and more murderous than before. General Braddock, riding to the
head of the first regiment, which had begun to waver, shouted the
order for them to reform and fire. The veteran troops, as coolly as if
on parade, closed up their ranks, and gave a volley, but it was as if
fired in the air. They saw no enemy to fire at. Meanwhile the Virginia
troops, after the first staggering effect of a terrific musketry fire
poured into them by an unseen enemy, suddenly broke ranks, and,
each man running for a tree, they took possession of the skirts of the
woods. On seeing this General Braddock galloped up to George.
“Colonel Washington,” he cried, violently, “your Virginia troops are
insubordinate! They have scattered themselves through the woods,
and I desire them formed again in columns of fours to advance.”
“Sir,” answered George, in agony, “the ravines are full of Indians—
many hundreds of them. They can slaughter us at their pleasure if
we form in the open. The Virginians know how to fight them.”
“You are an inexperienced soldier, sir, and therefore I excuse you.
But look at my English veterans—see how they behave—and I
desire the Virginians to do the same.”
At that moment George’s horse fell upon his knees, and the next he
rolled over, shot through the heart. The English regiments had
closed up manfully, after receiving several destructive volleys,
returning the fire of their assailants without seeing them and without
producing the smallest effect. But suddenly the spectacle of half their
men dead or wounded on the ground, the galloping about of
riderless horses, the shrieks of agony that filled the air, seemed to
unman them. They broke and ran in every direction. In vain General
Braddock rode up to them, actually riding over them, waving his
sword and calling to them to halt.
The men who had faced the legions of Europe were panic-stricken
by this dreadful unseen foe, and fled, only to be shot down in their
tracks. To make it more terrible, the officers were singled out for
slaughter, and out of eighty-six officers in a very little while twenty-six
were killed and thirty-seven wounded. General Braddock himself had
his horse shot under him, and as he rolled on the ground a cry of
pain was wrung from him by two musket-balls that pierced his body.
Of his three aides, two lay weltering in their blood, and George alone
was at his side helping him to rise.
Rash and obstinate as General Braddock might be, he did not lack
for courage, and in that awful time he was determined to fight to the
last.
“Get me another horse,” he said, with difficulty, to George. “Are you,
too, wounded?”
“No, general, but I have had two horses shot under me. Here is my
third one—mount!” And by the exertion of an almost superhuman
strength he raised General Braddock’s bulky figure from the ground
and placed him in the saddle.
“I am badly wounded,” said General Braddock, as he reeled slightly;
“but I can sit my horse yet. Your Virginians are doing nobly, but they
should form in columns.”
Besotted to the end, but seeing that the Virginians alone were
standing their ground, General Braddock did not give a positive
order, and George did not feel obliged to obey this murderous
mistake. But General Braddock, after a gasp or two, turned a livid
face towards George.
“Colonel Washington, the command is yours. I am more seriously
wounded than I thought.” He swayed forward, and but for George
would have fallen from his horse.
The panic was now at its height. Men, horses, wagons, all piled
together in a terrible mêlée, made for the rear; but there, again, they
were met by a hail of bullets. Staggered, they rushed back, only to
be again mowed down by the hidden enemy. The few officers left
commanded, begged, and entreated the men to stand firm; but they,
who had faced death upon a hundred fields, were now so mad with
fear that they were incapable of obedience. George, who had
managed to have General Braddock carried to the rear with the aid
of Dr. Craik, had got another horse, and riding from one end of the
bloody field to the other, did all that mortal man could do to rally the
panic-stricken men, but it was in vain. His clothes were riddled with
bullets, but in the midst of the carnage around him he was
unharmed, and rode over the field like the embodied spirit of battle.
The Virginians alone, cool and determined, fought steadily and sold
their lives dearly, although picked off one by one. At last, after hours
of panic, flight, and slaughter, George succeeded in bringing off the
remnant of the Virginians, and, overtaking the fleeing mob of regular
troops some miles from the scene of the conflict, got them across the
ford of the Monongahela. They were safe from pursuit, for the
handful of Frenchmen could not persuade their Indian allies to leave
the plunder of the battle-field for the pursuit of the enemy. The first
thing that George did was to send immediately for wagons, which
had been left behind, to transport the wounded. General Braddock,
still alive but suffering agonies from his wounds, was carried on
horseback, then in a cart, and at last, the jolting being intolerable, on
a litter upon the shoulders of four sturdy backwoodsmen. But he was
marked for death. On the third day of this terrible retreat, towards
sunset, he sank into a lethargy. George, who had spent every
moment possible by his side, turned to Dr. Craik, who shook his
head significantly—there was no hope. As George dismounted and
walked by the side of the litter, the better to hear any words the dying
soldier might utter, General Braddock roused a little.
“Colonel Washington,” he said, in a feeble voice, “I am satisfied with
your conduct. We have had bad fortune—very bad fortune; but”—
here his mind began to wander—“yonder is the smoke rising from
the chimneys; we shall soon be home and at rest. Good-night,
Colonel Washington—”

“GEORGE DID ALL THAT MORTAL MAN COULD DO”


The men with the litter stopped. George, with an overburdened
heart, watched the last gasp of a rash but brave and honorable
soldier, and presently gently closed his eyes. That night the body of
General Braddock, wrapped in his military cloak, was buried under a
great oak-tree in the woods by the side of the highway, and before
daylight the mournful march was resumed.
The news of the disaster had preceded them, and when George,
attended only by Captain Vanbraam and a few of his Virginia officers,
rode into Williamsburg on an August evening, it was with the
heaviest heart he had ever carried in his bosom. But by one of those
strange paradoxes, ever existing in the careers of men of destiny,
the events that had brought ruin to others only served to exalt him
personally. His gallant conduct in battle, his miraculous escape, his
bringing off of the survivors, especially among the Virginia troops,
and the knowledge which had come about that had his advice been
heeded the terrible disaster would not have taken place—all
conspired to make him still more of a popular hero. Not only his own
men adored him, and pointed out that he had saved all that could be
saved on that dreadful day, but the British troops as well saw that the
glory was his, and the return march was one long ovation to the one
officer who came out of the fight with a greater reputation than when
he entered it. Everywhere crowds met him with acclamations and
with tears. The streets of the quaint little town of Williamsburg were
filled with people on this summer evening, who followed the party of
officers, with George at their head, to the palace. George responded
to the shouts for him by bowing gracefully from side to side.
Arrived at the palace he dismounted, and, just as the sentry at the
main door presented arms to him, he saw a party coming out, and
they were the persons he most desired to see in the world and least
expected. First came the Earl of Fairfax with Madam Washington,
whom he was about to hand down the steps and into his coach,
which had not yet driven up. Behind them demurely walked Betty,
and behind Betty came Lance, carrying the mantles of the two
ladies.
The earl and Madam Washington, engaged in earnest conversation,
did not catch sight of George until Betty had rushed forward, and
crying out in rapture, “George, dear George!” they saw the brother
and sister clasped in each other’s arms.
Madam Washington stood quite still, dumfounded with joy, until
George, kissing her hand tenderly, made her realize that it was
indeed he, her best beloved, saved from almost universal destruction
and standing before her. She, the calmest, the stateliest of women,
trembled, and had to lean upon him for support; the earl grasped his
hand; Lance was in waiting. George was as overcome with joy as
they were.
“But I must ask at once to see the governor,” said he, after the first
rapture of meeting was over. “You, my lord, must go with me, for I
want friends near me when I tell the story of sorrow and disaster.”
Four days afterwards, the House of Burgesses being in session,
Colonel Washington was summoned by the Speaker to read his
report of the campaign before it, and to be formally designated as
commander-in-chief of the forces. The facts were already known, but
it was thought well, in order to arouse the people to the sense of
their danger, and to provide means for carrying on the war in
defence of their frontiers, that Colonel Washington should make a
public report, and should publicly receive the appointment of
commander-in-chief of the next expedition. The House of Burgesses,
then as ever, proudly insistent of its rights, had given the governor to
understand that they would give him neither money nor supplies
unless their favorite soldier should have the command in the next
campaign—and, indeed, the attitude of the officers and soldiery
made this absolutely necessary. Even the governor had realized this,
and, disheartened by the failure of his much-heralded regulars, was
in a submissive mood, and these haughty colonial legislators, of
whose republican principles Governor Dinwiddie already complained
much, took this opportunity to prove that without their co-operation
but little could be done.
The large hall of the House of Burgesses, but dimly lighted by small
diamond-paned windows, was filled with the leading men of the
colony, including Lord Fairfax. Ladies had been admitted to the floor,
and among them sat in majestic beauty Madam Washington, and
next to her sat Betty, palpitating, trembling, blushing, and with proud,
bright eyes awaited the entrance of her “darling George,” as she
called him, although often reproved for her extravagance by her
mother.
At last George entered this august assembly. His handsome head
was uncovered, showing his fair hair. He wore a glittering uniform,
and his sword, given him by Lord Fairfax, hung at his side. He
carried himself with that splendid and noble air that was always his
characteristic, and, quietly seating himself, awaited the interrogatory
of the president. When this was made he rose respectfully and
began to read from manuscript the sad story of Braddock’s
campaign. It was brief, but every sentence thrilled all who heard it.
When he said, in describing the terrible story of the 9th of July, “The
officers in general behaved with incomparable bravery, for which
they suffered, upwards of sixty being killed or wounded,” a kind of
groan ran through the great assemblage; and when he added, in a
voice shaken with emotion, “The Virginia companies behaved like
men and died like soldiers; for, I believe, out of three companies on
the ground that day scarce thirty men were left alive,” sobs were
heard, and many persons, both men and women, burst into tears.
His report being ended, the president of the House of Burgesses
arose and addressed him:
“Colonel Washington: We have listened to your account of the late
campaign with feelings of the deepest and most poignant sorrow, but
without abandoning in any way our intention to maintain our lawful
frontiers against our enemies. It has been determined to raise
sixteen companies in this colony for offensive and defensive warfare,
and by the appointment of his excellency the governor, in deference
to the will of the people and the desire of the soldiers, you are
hereby appointed, by this commission from his excellency the
governor, which I hold in my hand, commander-in-chief of all the
forces now raised or to be raised by this colony, reposing special
confidence in your patriotism, valor, conduct, and fidelity. And you
are hereby invested with power and authority to act as you shall
think for the good of the service.
“And we hereby strictly charge all officers and soldiers under your
command to be obedient to your orders and diligent in the exercise
of their several duties.
“And we also enjoin and require you to be careful in executing the
great trust reposed in you, by causing strict discipline and order to be
observed in the army, and that the soldiers be duly exercised and
provided with all necessaries.
“And you are to regulate your conduct in every respect by the rules
and discipline of war, and punctually to observe and follow such
orders and directions as you shall receive from his excellency the
governor and this or other House of Burgesses, or committee of the
House of Burgesses.”
A storm of applause broke forth, and George stood silent, trembling
and abashed, with a noble diffidence. He raised one hand in
deprecation, and it was taken to mean that he would speak, and a
solemn hush fell upon the assembly. But in the perfect silence he felt
himself unable to utter a word, or even to lift his eyes from the floor.
The president sat in a listening attitude for a whole minute, then he
said:
“Sit down, Colonel Washington. Your modesty is equal to your valor,
and both are above comparison. Your life would not have been
spared, as if by a miracle, had not the All-wise Ruler of the heavens
and the earth designed that you should fulfil your great destiny; and
one day, believe me, you shall be called the prop, the stay, and the
glory of your country.”
THE END
FOOTNOTES:
[A] In Washington’s will he mentions “my man
William, calling himself William Lee,” and gives
him his freedom, along with the other slaves, and
an annuity besides: “and this I give him as a
testimony of my sense of his attachment to me,
and for his faithful services during the
Revolutionary War.”
[B] Washington, in his journal, speaks of the
Indian firing at him at short range, but says
nothing of his preventing his companion from
killing the would-be murderer. But his companion
expressly says that he would have killed the
Indian on the spot had not Washington forbidden
him. The Indians became very superstitious
about Washington’s immunity from bullets,
especially after Braddock’s defeat. In that battle
he was the target for the best marksmen among
them, and not only escaped without a scratch,
although two horses were killed under him and
his clothes riddled with bullets, but he was the
only officer of Braddock’s military family who
survived.
[C] This letter, which is printed in full in Marshall’s
Life of Washington, was among the highest
personal compliments ever paid Washington. The
signers were seasoned soldiers, addressing a
young man of twenty-three, under whom they
had made a campaign of frightful hardship ending
in disaster. They were to be ordered to resume
operations in the spring, and it was to this young
man that these officers appealed, believing him to
be essential to the proper conduct of the
campaign.
By JAMES BARNES
A LOYAL TRAITOR. A Story of the War of 1812.
Illustrated. Post 8vo, Cloth, Ornamental, $1 50.
A vigorous romance it is, full of life and adventure.—
N. Y. Herald.
A stirring story.... The several characters are finely
balanced and well drawn, and are admirably
interwoven to give reasonableness and
completeness in every chapter.—Chicago Inter-
Ocean.
We turn with a feeling of relief to Mr. Barnes’s
breezy and Marryat-like story of the American
privateersman.... This is all genuine romance, with a
wide horizon and many changes of scene.... Mr.
Barnes has done his work well.—N. Y. Times.
An excellent and intensely interesting story of
romance and adventure.—Brooklyn Standard-Union.
The book has freshness, animation, and strong
story-interest.—Outlook, N. Y.
A quick-moving, picturesque story. The daring
Yankee sailor of that naval war, his life above deck
and below, in battle and in cruise, his dialect and
yarns, are all quaintly reproduced in a series of vivid
scenes.—Philadelphia Record.

FOR KING OR COUNTRY. A Story of the American


Revolution. Illustrated. Post 8vo, Cloth, Ornamental, $1
50.

NAVAL ACTIONS OF THE WAR OF 1812. Illustrated. 8vo,


Cloth, Ornamental, $4 50.
NEW YORK AND LONDON
HARPER & BROTHERS, Publishers
☞ The above works are for sale by all booksellers, or will
be sent by mail by the publishers, postage prepaid, on
receipt of the price.
TRANSCRIBER’S NOTES:
Obvious typographical errors have been corrected.
Inconsistencies in hyphenation have been
standardized.
Archaic or variant spelling has been retained.
New original cover art included with this eBook is
granted to the public domain.
*** END OF THE PROJECT GUTENBERG EBOOK A VIRGINIA
CAVALIER ***

Updated editions will replace the previous one—the old editions


will be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright
in these works, so the Foundation (and you!) can copy and
distribute it in the United States without permission and without
paying copyright royalties. Special rules, set forth in the General
Terms of Use part of this license, apply to copying and
distributing Project Gutenberg™ electronic works to protect the
PROJECT GUTENBERG™ concept and trademark. Project
Gutenberg is a registered trademark, and may not be used if
you charge for an eBook, except by following the terms of the
trademark license, including paying royalties for use of the
Project Gutenberg trademark. If you do not charge anything for
copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such
as creation of derivative works, reports, performances and
research. Project Gutenberg eBooks may be modified and
printed and given away—you may do practically ANYTHING in
the United States with eBooks not protected by U.S. copyright
law. Redistribution is subject to the trademark license, especially
commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like