ARM - AIAA Info

advertisement
1
Microcontroller Two Day Beginners
Workshop
Instructors
Craig Kief
Deputy Director, COSMIAC
craig.kief@cosmiac.org
Brian Zufelt
Faculty, UNM
brian.zufelt@cosmiac.org
Karl Henry
Instructor, JF Drake State
Karl.Henry@DrakeState.edu
Bassam Matar
Instructor, Chandler-Gilbert
b.matar@cgcmail.maricopa.edu
Nasser Alaraje
Associate Professor, MTU
alaraje@mtu.edu
1
Introductions
• Who are you?
• Where are you from?
• Any Microcontroller or Microprocessor experience?
• Any C experience?
• What do you want to learn from this?
2
Syllabus
Day 1
- 8:30 am Introduction / Survey
- 9:15 am
What is a Microcontroller
- 9:45 am
Compiler and C as Tools
- 10:15 am
Break
- 10:30 am
Lab 1 – Load Software
- 11:00 am
Lab 2 – White Light
- 12:00 pm
Lunch
- 1:00 pm
C Syntax, Compilers, Basic C Statements, Preprocessor
- 2:00 pm
Lab 3 – Blinking Light and Preprocessor
- 3:00 pm
Lab 4 – LED and Counter
3
Syllabus
Day 2
- 8:30 am
- 9:00 am
- 10:00 am
- 11:00 am
- 12:00 pm
- 1:00 pm
- 2:00 pm
- 3:00 pm
- 3:45 pm
- 4:00 pm
- 4:30 pm
- 5:00 pm
Recap of Day 1
Functions and Libraries
Lab 5 – Interrupts
Lab 6 – UART
Lunch
Lab 7 – Accelerometers
Lab 8 – Temp Sensor
Lab 9 – OLED / Final Project
Microcontroller peripherals
Support System (Software & Wiki, etc.)
Implementation / Adaption Plan / Issues at schools
Conclusions / Feedback / Survey
4
Why we are here
The average instructor when they are told they should be updating their
microcontroller lab by a department chair
5
Method: Immersive hands-on design for
every student
Students learn more, faster, and
better with unrestricted access to
design tools…
…overall learning improves when
applied design skills taught early;
…overall performance improves
when design skills used frequently;
…and they like it*
*results published in 2008 and 2009 ASEE proceedings
I never teach my pupils; I only attempt to provide the conditions in which they can learn. Albert Einstein
6
Microcontroller across the Curriculum
• Computer Architecture
• Embedded Processors
• System on a Chip
• Digital Logic
• Dedicated Controllers
• Application Specific Circuit Testing
• Controls
• Motor Control
• Sensor Interface
• Robotics
• DSP
• Dedicated MAC
7
Please interrupt and ask questions
8
What is a Microprocessor
• A microprocessor incorporates the functions of a computer's central
processing unit (CPU) on a single integrated circuit (IC). It is a
multipurpose, programmable device that accepts digital data as input,
processes it according to instructions stored in its memory, and
provides results as output.
• It is an example of sequential digital logic, as it has internal memory.
• Microprocessors operate on numbers and symbols represented in
the binary numeral system.
• The advent of low-cost computers on integrated circuits has
transformed modern society.
9
What is a Microcontroller
• A microcontroller (sometimes abbreviated µC, uC or MCU) is a small
computer on a single integrated circuit containing a processor core, memory,
and programmable input/output peripherals. Microcontrollers are designed for
embedded applications, in contrast to the microprocessors used in personal
computers or other general purpose applications.
• Microcontrollers are used in automatically controlled products and devices,
such as automobile engine control systems, implantable medical devices,
remote controls, office machines, appliances, power tools, toys and other
embedded systems.
• By reducing the size and cost compared to a design that uses a separate
microprocessor, memory, and input/output devices, microcontrollers make it
economical to digitally control even more devices and processes.
• Mixed signal microcontrollers are common, integrating analog components
needed to control non-digital electronic systems.
10
What is C and Assembly
All computers process information in the form of bits. However writing code in
1’s and 0’s can be a impossible task for complex systems. For this reason
higher level programing languages such as C and Assembly were created.
Assembly is a language that is closely tied to a given architectures instruction
set. An instruction set is the commands a given processor is able to execute as
a single instruction. For example, bit shifts , memory jump, basic math
operations.
C is a widely used programming language that rises above a specific
instruction set. This allows C to be more readable and portable to multiple
devices, while still remaining close enough to the hardware language that
minimal performance sacrifices are made. For these reasons C has become
the language of choice for many embedded system designers.
As you move to higher languages (C++, Java, C#, and objective C, Visual Basic) the language is easier to read,
however performance is sacrificed.
11
Top Languages
• According to IEEE
July, 2014
12
The Compiling Process
• A compiler is a computer program (or set of programs) that transforms
source code written in a programming language (the source language) into
another computer language (the target language, often having a binary form
known as object code). The most common reason for wanting to transform
source code is to create an executable program.
• The name "compiler" is primarily used for programs that translate source
code from a high-level programming language to a lower level language (e.g.,
assembly language or machine code).
• For this course, we will use the Texas Instruments Code Composer Compiler.
13
Stellaris vs. Tiva
• What is the difference?
• Please see this document that lists the equivalent part numbers in the two
families. The parts are the same and you can directly replace the Tiva part
number in a design with the equivalent LM4F part number. For software
porting, please see this document. Both the launchpad and the EK-LM4F232
will continue to be supported, and there is a new version of the Launchpad
with a Tiva part and additional functionality. Please let me know if you have
additional questions.
• Part number doc: http://www.ti.com/lit/ml/spmt284/spmt284.pdf
• Tiva LaunchPad vs Stellaris LaunchPad
14
Stellaris vs. Tiva
15
What projects are Microcontrollers good for?
The Tiva TM4C (formerly Stellaris LM4F) series of ARM Cortex-M4 microcontrollers provides top
performance and advanced integration. The product family is positioned for cost-conscious applications
requiring significant control processing and connectivity capabilities such as:
•Connectivity
•Sensor aggregation
•Security and access control
•Home and building automation
•Industrial automation
•Human machine interface
•Lighting control
•Energy
•Data acquisition
•System management
For applications requiring extreme conservation of power, the TM4C1233H6PM microcontroller
features a battery-backed Hibernation module to efficiently power down the TM4C1233H6PM to a
low-power state during extended periods of inactivity. A Hibernation module positions the
TM4C1233H6PM microcontroller perfectly for battery applications.
16
17
Why this tool
Eclipse (Design Environment) – Free
Code Composer (not free but open with IDE)
ADT (Android Development Tool)
Java
PIC (gcc)
AVR (gcc)
…
In computer programming, Eclipse is a multi-language software development
environment comprising a base workspace and an extensible plug-in system for
customizing the environment. It is written mostly in Java. It can be used to develop
applications in Java and, by means of various plug-ins, other programming
languages including Ada, C, C++, COBOL, Fortran, Haskell, JavaScript, Perl, PHP,
Python, Scala, Scheme, and Erlang.
18
Pinouts for Projects
TM4C1232H6PM
Tiva Chip
19
Section Objectives
At the end of this section you will be able to
 Understand the high-level architecture of ARM processor
 Understand the CPU, Digital, Analog and Programmable
Routing / Interconnect Systems
20
Why we went the way we did
TI Tiva
LaunchPad
Digilent Orbit Board Mounted on
Tiva LaunchPad
• ARM is the way of the future. Wanted a way to teach intro
microcontrollers but also a path way ahead to life long learning
• Wanted to have hardware that instructors could inexpensively obtain for a
long period of time
• Wanted to utilize Digilent reliability
• Wanted a free high quality design environment
• Wanted to utilize simple enough C code that instructors could immediately
begin simple projects
21
Tiva LaunchPad
The Tiva Launchpad is an evaluation
platform provided by Texas
Instruments. It provides an excellent
platform for exploring all the options
the Tiva family of microcontrollers
provide. Some features include:
•
•
•
•
•
•
In-circuit-debugger
I/O headers
USB connection
RGB LED
USB to Serial converter
Pushbuttons
22
What’s a kibibyte?
23
System Overview
Courtesy of Real-Time OS for ARM Cortex-M by Valvano
24
Digilent Orbit Board
The Orbit board contains many
features to help students grasp the
concepts presented
• OLED display
• Expandable PMOD connectors
• Potentiometer
• Switches
• Push Buttons
• LEDs
• I2C headers
There are definitely other alternatives
25
CPU Subsystem
Texas Instrument's Stellaris® family of
microcontrollers provide designers a highperformance ARM®
Cortex™-M-based architecture with a broad set of
integration capabilities and a strong ecosystem
of software and development tools. Targeting
performance and flexibility, the Stellaris
architecture offers a 80 MHz Cortex-M with FPU, a
variety of integrated memories and multiple
programmable GPIO. Offering quicker time-tomarket and cost savings, the Stellaris family of
microcontrollers is the leading choice in highperformance 32-bit applications.
Full datasheet at: http://cosmiac.org/Community_Portal_Micro.html
26
What and Why ARM?
• The ARM architecture describes a family of RISC-based computer
processors designed and licensed by British company ARM Holdings. It was
first developed in the 1980s by Acorn Computers Ltd to power their desktop
machines and subsequently spun off as a separate company, now ARM
Holdings.
• Globally as of 2013 it is the most widely used 32-bit instruction set
architecture in terms of quantity produced. According to ARM Holdings, in
2010 alone, producers of chips based on ARM architectures reported
shipments of 6.1 billion ARM-based processors, representing 95% of
smartphones, 35% of digital televisions and set-top boxes, and 10% of
mobile computers.
• As an IP core business, Advanced RISC Machine (ARM) Holdings itself does
not manufacture its own electronic chips, but licenses its designs to other
semiconductor manufacturers.
Why are they important
• Virtually every appliance, smart phone, automobile, well,
you name it, has one in it.
• Having a technician, technologist or engineer that doesn‘t at
least have a working knowledge of them is doing them an
injustice.
27
How are Microcontroller projects Designed?
• For our workshop, we will use three packages
• Code Composer Studio
• TivaWare Firmware Development Package
• LM Flash Programmer Utility
• ATE Workshop Lab
• The overall design language is C code!
28
I wish to help all of you to begin
teaching Microcontrollers
29
Three Elements of Focus
• Hardware : Includes the
architecture of the microcontroller /
microprocessor used, and if there
is an operating system installed.
• SDK: Includes all software used
for development; IDE, Debuggers
,etc..
• Programming Language:
Includes all programming
languages used to develop your
project. We will use C.
30
31
ARCHITECTURE OVERVIEW
ARM Processor
ARM Cortex Advanced Processors
Architectural innovation, compatibility
across diverse application spectrum
x1-4
• ARM Cortex-A Series:
• Applications processors for feature-
Cortex-A9
Cortex-A8
rich OS and user applications
x1-4
Cortex-A5
• ARM Cortex-R Series:
• Embedded processors for real-time
Cortex-R4(F)
signal processing and control applications
• ARM Cortex-M Series:
• Microcontroller-oriented processors
SC300™
Cortex™-M3
Cortex-M1
optimized for MCU, ASSP, SoC applications
Cortex-M0
33
ARM
CORTEX
M4F
• The next series of
slides will drill down
into the specifics
and capabilities
ARM Cortex M4F
• The Cortex-M4F processor is
built on a high-performance
processor core, with a 3-stage
pipeline Harvard architecture,
making it ideal for demanding
embedded applications.
• Four Parts that will be
discussed:
• ARM
• System Peripherals
• Serial Peripherals
• Analog Peripherals
34
ARM Cortex M4F
• “F” means the processor
has a Floating Point Unit
(FPA)
35
ARM Cortex M4F – Processor Core
• 32-bit ARM Cortex-M4F architecture optimized for small-footprint
embedded applications
• 80-MHz operation
• Outstanding processing performance combined with fast
interrupt handling
• ARM core in a compact memory size usually associated with 8and 16-bit devices, typically in the range of a few kilobytes of
memory for microcontroller-class applications
• IEEE754-compliant single-precision Floating-Point Unit (FPU)
• 16-bit SIMD vector processing unit
• Fast code execution permits slower processor clock or increases
sleep mode time
• Harvard architecture characterized by separate buses for
instruction and data
36
ARM Cortex M4F FPU and Peripherals
• Floating-Point Unit (FPU) - The FPU fully supports single-precision add,
subtract, multiply, divide, multiply and accumulate, and square root
operations. It also provides conversions between fixed-point and floatingpoint data formats, and floating-point constant instructions.
• The TM4C1233H6PM microcontroller is integrated with the following set of
on-chip memory and features: 32 KB single-cycle SRAM, 256 KB single-cycle
Flash memory and 2KB EEPROM
37
Memory Mapped I/O
Memory Mapped I/O is a method of assigning a memory address to all the
peripherals attached to the processor. This allows the processor to access
peripherals in the same way it accesses memory. This method reduces
development time, and code space.
38
39
SERIAL
40
SERIAL - OVERVIEW
The TM4C123GH6PM controller supports both
asynchronous and synchronous serial communications
with:
• USB 2.0 Device
• Eight UARTs with IrDA, 9-bit and ISO 7816 support
(one UART with modem flow control)
• Six I2C modules with four transmission speeds
including high-speed mode
• CAN 2.0 A/B controller
• Four Synchronous Serial Interface modules (SSI)
41
SERIAL - USB
• Universal Serial Bus (USB) is a serial bus standard designed to allow
peripherals to be connected and disconnected using a standardized
interface without rebooting the system.
• USB was designed to standardize the connection of computer peripherals
(including keyboards, pointing devices, digital cameras, printers, portable
media players, disk drives and network adapters) to personal computers,
both to communicate and to supply electric power.
• It has become commonplace on other devices, such as smartphones, PDAs
and video game consoles. USB has effectively replaced a variety of earlier
interfaces, such as serial and parallel ports, as well as separate power
chargers for portable devices.
42
SERIAL - UART
• A Universal Asynchronous Receiver/Transmitter (UART) is an integrated
circuit used for RS-232C serial communications, containing a transmitter
(parallel-to-serial converter) and a receiver (serial-to-parallel converter),
each clocked separately.
• The TM4C123GH6PM microcontroller includes eight fully programmable
16C550-type UARTs. Although the functionality is similar to a 16C550
UART, this UART design is not register compatible. The UART can
generate individually masked interrupts from the Rx, Tx, modem flow
control, and error conditions. The module generates a single combined
interrupt when any of the interrupts are asserted and are unmasked.
43
SERIAL – I2C
• The Inter-Integrated Circuit (I2C) bus provides bi-directional data transfer
through a two-wire design (a serial data line SDA and a serial clock line SCL).
The I2C bus interfaces to external I2C devices such as serial memory (RAMs
and ROMs), networking devices, LCDs, tone generators, and so on.
• The I2C bus may also be used for system testing and diagnostic purposes in
product development and manufacture.
• Each device on the I2C bus can be designated as either a master or a slave.
I2C module supports both sending and receiving data as either a master or a
slave and can operate simultaneously as both a master and a slave. Both the
I2C master and slave can generate interrupts.
• The TM4C123GH6PM microcontroller includes six I2C modules.
44
SERIAL - CAN
• Controller Area Network (CAN) is a multicast shared serial-bus standard for
connecting electronic control units (ECUs). CAN was specifically designed to
be robust in electromagnetically noisy environments and can utilize a
differential balanced line like RS-485 or twisted-pair wire. Originally created
for automotive purposes, it is now used in many embedded control
applications (for example, industrial or medical). Bit rates up to 1 Mbps are
possible at network lengths below 40 meters. Decreased bit rates allow
longer network distances (for example, 125 Kbps at 500m)
• CAN bus is a vehicle bus standard designed to allow microcontrollers and
devices to communicate with each other within a vehicle without a host
computer.
• CAN bus is a message-based protocol, designed specifically for automotive
applications but now also used in other areas such as aerospace, industrial
automation and medical equipment.
45
SERIAL – SSI
• Synchronous Serial Interface (SSI) is a four-wire bi-directional
communications interface that converts data between parallel and serial.
The SSI module performs serial-to-parallel conversion on data received
from a peripheral device, and parallel-to-serial conversion on data
transmitted to a peripheral device. The SSI module can be configured as
either a master or slave device. As a slave device, the SSI module can
also be configured to disable its output, which allows a master device to
be coupled with multiple slave devices. The TX and RX paths are buffered
with separate internal FIFOs.
• The SSI module also includes a programmable bit rate clock divider and
prescaler to generate the output serial clock derived from the SSI
module's input clock. Bit rates are generated based on the input clock and
the maximum bit rate is determined by the connected peripheral.
• The TM4C123GH6PM microcontroller includes four SSI modules
46
ANALOG
47
ANALOG - OVERVIEW
The TM4C123GH6PM microcontroller provides analog
functions integrated into the device, including:
• Two 12-bit Analog-to-Digital Converters (ADC) with
12 analog input channels and a sample rate of one
million samples/second
• Two analog comparators
• 16 digital comparators
• On-chip voltage regulator
48
ANALOG - ADC
• An analog-to-digital converter (ADC) is a peripheral that
converts a continuous analog voltage to a discrete digital
number. The Stellaris ADC module features 12-bit
conversion resolution and supports 12 input channels plus
an internal temperature sensor. Each ADC module has a
digital comparator function that allows the conversion value
to be diverted to a comparison unit that provides eight
digital comparators.
• The TM4C123GH6PM microcontroller provides two ADC
modules.
49
ANALOG – ANALOG COMPARATOR
• An analog comparator is a peripheral that compares two
analog voltages and provides a logical output that signals
the comparison result. The TM4C123GH6PM
microcontroller provides two independent integrated analog
comparators that can be configured to drive an output or
generate an interrupt or ADC event.
• The TM4C123GH6PM microcontroller provides two
independent integrated analog comparators.
50
DEVELOPMENT TOOLS
ARM Processor
51
IDE IS A TOOL
Code Composer Studio is more than a compiler. CCS contains
many tools
•
•
•
•
•
•
•
•
Debugger
Editor
Disassembler
GUI
Simulator
Drivers / Libraries
Examples
Optimization
|
Published 1988
|
| Published 2012 |
Syllabus
Day 1
- 8:30 am Introduction / Survey
- 9:15 am
What is a Microcontroller
- 9:45 am
Compiler and C as Tools
- 10:15 am
Break
- 10:30 am
Lab 1 – Load Software
- 11:00 am
Lab 2 – White Light
- 12:00 pm
Lunch
- 1:00 pm
C Syntax, Compilers, Basic C Statements, Preprocessor
- 2:00 pm
Lab 3 – Blinking Light and Preprocessor
- 3:00 pm
Lab 4 – LED and Counter
52
Start the Learning
The key from this workshop is to learn what you need to know to
successfully teach with Microcontrollers
53
Lab 1 Overview
• Provides you with an introduction to the design tools
• Steps you through the design tool installation process
• Loading and licensing the software
54
Lab 2 Overview
• Turn on a light
• Still only using the Tiva
LaunchPad
• Change the color
55
Lab 2 Overview
56
Syllabus
Day 1
- 8:30 am Introduction / Survey
- 9:15 am
What is a Microcontroller
- 9:45 am
Compiler and C as Tools
- 10:15 am
Break
- 10:30 am
Lab 1 – Load Software
- 11:00 am
Lab 2 – White Light
- 12:00 pm
Lunch
- 1:00 pm
C Syntax, Compilers, Basic C Statements, Preprocessor
- 2:00 pm
Lab 3 – Blinking Light and Preprocessor
- 3:00 pm
Lab 4 – LED and Counter
57
Lunch
• Talking ATE
• Proposals are due in October, 2015
58
Advanced Technological Education (ATE)
Synopsis of Program:
With an emphasis on two-year colleges, the Advanced Technological
Education (ATE) program focuses on the education of technicians for the
high-technology fields that drive our nation's economy. The program
involves partnerships between academic institutions and employers to
promote improvement in the education of science and engineering
technicians at the undergraduate and secondary school levels. The ATE
program supports curriculum development; professional development of
college faculty and secondary school teachers; career pathways to twoyear colleges from secondary schools and from two-year colleges to fouryear institutions; and other activities. Another goal is articulation between
two-year and four-year programs for K-12 prospective teachers that focus
on technological education. The program also invites proposals focusing on
research to advance the knowledge base related to technician education.
ATE Video
What is ATE? Video
Advanced Technological Education (ATE)
Cognizant Program Officer(s):
Please note that the following information is current at the time of publishing.
See program website for any updates to the points of
contact.
V. Celeste Carter
David B.
Campbell
David R. Brown
Connie K. DellaPiana
R. Corby Hovis
vccarter@nsf.gov
703-292-4651
dcampbel@nsf.gov (703) 292-5093
885 S
drbrown@nsf.gov
(703) 292-8831
835 N
cdellapi@nsf.gov
(703) 292-5309
835 N
chovis@nsf.gov
(703) 292-4625
835 N
Advanced Technological Education (ATE)
Synopsis of Program:
With an emphasis on two-year colleges, the Advanced Technological
Education (ATE) program focuses on the education of technicians for the
high-technology fields that drive our nation's economy. The program
involves partnerships between academic institutions and industry to
promote improvement in the education of science and engineering
technicians at the undergraduate and secondary school levels. The ATE
program supports curriculum development; professional development of
college faculty and secondary school teachers; career pathways to twoyear colleges from secondary schools and from two-year colleges to fouryear institutions; and other activities. Another goal is articulation between
two-year and four-year programs for K-12 prospective STEM teachers that
focus on technological education. The program invites research proposals
that advance the knowledge base related to technician education.
Anticipated number, size, and duration of
new awards
•
•
•
•
•
•
•
•
Anticipated number, size, and duration of new awards:
ATE Projects: approximately 20-35 new awards, ranging from $25,000 to $300,000 per year and having a
duration of up to three years, except for ATE-Coordination Network projects, which may be up to
$200,000 per year for four years.
ATE small grants for institutions new to the ATE program: approximately 12-20 awards for up to $200,000
(each) typically spread over three years. It is expected that the budget request will match the scope of the
project.
New national center proposals will be considered only if a compelling case that there is a national need
for a center in the particular technology and that the proposed center does not duplicate in any substantial
way an existing national center or nationally-coordinated activities in the same technology (see text above
under national centers). National centers funding will be $4 million spread over five years, with the
possibility of a competitive grant renewal for $4 million over an additional five years.
Regional Centers of Excellence: up to 2 new awards for up to $3 million (each) spread over four years,
with the possibility of a competitive grant renewal, normally at a lower level of annual funding, for an
additional three years.
Support Centers: up to 2 new awards for up to $1.6 million (each) spread over four years with the
possibility of a competitive grant renewal.
Planning Grants for Centers: up to 2 new awards for up to $70,000 (each) to develop well-formulated
plans for future national and/or regional centers (see Section V.A ["Proposal Preparation"] for additional
information).
Targeted Research on Technician Education: up to 5 new awards, ranging from $150,000 total for up to 2
years to $800,000 total for up to 3 years.
Other Stuff
Proposals due 9 October
External Evaluator
2 year important
We consult
Paperwork takes forever
Serve as proposal evaluator
Letters of support
Publications
Legend: 1=Really Important; 2=Important; 3=Cool to Know
65
1 SW-TM4C-DRL-UG-2.1.0.12573.pdf
• This document describes the most common peripherals
available on the chip. The library functions that are
included with TivaWare to run the peripherals are also
included.
• 700+ pages on ever peripheral including CAN, AES, LCD,
DES, UART, …….
66
1 SW-TM4C-EXAMPLES-UG2.1.0.12573
• The document provides example code and descriptions
for basic peripheral use and applications. Goes along
with the project code included in your installation.
67
1 SW-TM4C-RLN-2.1.0.12573
• Release notes are good to check for troubleshooting and
debug purposes. Sometimes the function calls will be
modified between releases and this is a great place to
begin to look for problem/solutions
• Note: it is not required to use the latest release of
TivaWare for every application – use what works
68
2 SW-TM4C-BOOTLDR-UG-2.1.0.12573
• This document describes how to use the boot loader and
the various features it offers.
69
2 SW-TM4C-IQMATH-UG-2.1.0.12573
• IQ Math document provides additional math functions that
are not included in the standard C library.
70
2 SW-TM4C-SENSORLIB-UG2.1.0.12573
• The sensor library provides
many functions to control
third party sensors that can
be connected to the Tiva
board.
• 160 pages of how to work
with a wide variety of
sensors
• Note that not all sensors are
created by TI.
71
2 SW-TM4C-TOOLS-UG-2.1.0.12573
• The tools user
guide provide
additional
information on the
development
environment
72
2 SW-TM4C-USBL-UG-2.1.0.12573
• USB is a dedicated document for the USB function on the
Tiva board. While USB is a standard, it is more involved
than a UART.
73
3 SW-TM4C-GRL-UG-2.1.0.12573
• The graphics library provides functions to translate and
display graphics options to use resistive touch screens
and there are multiple booster packs that take advantage
of this.
74
3 SW-TM4C-NFCLIB-UG-2.1.0.12573
• The NFC library provides functions to
control near field communications chips.
NFC is the new RF ID. Think ApplePay
on the new iWatch. The common chip is
from NXP
75
3 SW-TM4C-UTILS-UG-2.1.0.12573
• The utilities document is an extension of the tools
document and describes additional utilities for debugging,
programming, operations and applications.
76
Syllabus
Day 1
- 8:30 am Introduction / Survey
- 9:15 am
What is a Microcontroller
- 9:45 am
Compiler and C as Tools
- 10:15 am
Break
- 10:30 am
Lab 1 – Load Software
- 11:00 am
Lab 2 – White Light
- 12:00 pm
Lunch
- 1:00 pm
C Syntax, Compilers, Basic C Statements, Preprocessor
- 2:00 pm
Lab 3 – Blinking Light and Preprocessor
- 3:00 pm
Lab 4 – LED and Counter
77
78
C PROGRAMMING LANGUAGE
ARM Processor
Basic C
• Variables and Datatypes
• Arithmetic Expressions
• Relational and Logical Operators
• Bitwise operators
• Conditional statements
• Loops
• Functions
• Pointers
79
Variables and Data types
• Variables store bits of data, the size depends on the data type.
• Missing data types are bool and bit. These are typically handled
differently by the compiler.
80
Arithmetic Expressions
81
Relational and Logical Operators
These operations
always return a
Boolean result aka:
True/False , On/Off.
NOTE: False is any
zero value, and True
is a non-zero value.
82
Bitwise Operators
Bitwise Operations work on each bit within a given value
83
Conditional Statements
• Conditional Statements execute ONLY when a certain
condition is evaluated as true, or tested to be a specific
value.
• if(condition){}
• else{}
• switch(value){
case value1:
break;
case value2:
break;
default:
break;
}
84
Loops
• Loops involve a code block that will continue running in a
loop while a current condition is evaluated to be true.
• While(condition)
• For((initialize); (condition) ; (after loop)){}
Notice that each example contains a while(1) loop. If this
code block was not there, the code will execute only once.
85
Functions
• Functions allow you to separate you code into small
chunks that are intended to accomplish a specific task.
• All programs begin with the main(){}; function
• Functions must be declared before the main function. This
is called a prototype.
• All functions that call another function, must be declared
below the called function.
86
Pointers
• Pointers are variables that contain the
memory address of a specific value.
• Pointer bit size depends on the
architecture of the hardware used.
• Pointers are usually the most confusing
subject for those new to programming.
There is even books dedicated to the
proper use of pointers.
• We will cover pointers in the labs as they
come up.
87
Preprocessor
• The C preprocessor, is a macro processor that is used
automatically by the C compiler to transform your program
before compilation.
• The Preprocessor allows the developer to organize code
to make it more readable, portable, and reusable.
• All statements that begin with ‘#’ are handled by the
Preprocessor before the compiler is invoked.
88
C Syntax
• All #define are in all CAPS
• All functions begin with a capital letter
• All variables are lower case
• Indent one tab for all sub block code (eg. All code
between {})
• Keep all code related to a particular task together. Don’t
create patchy code.
• Comment, Comment, Comment!!!
89
Syllabus
Day 1
- 8:30 am Introduction / Survey
- 9:15 am
What is a Microcontroller
- 9:45 am
Compiler and C as Tools
- 10:15 am
Break
- 10:30 am
Lab 1 – Load Software
- 11:00 am
Lab 2 – White Light
- 12:00 pm
Lunch
- 1:00 pm
C Syntax, Compilers, Basic C Statements, Preprocessor
- 2:00 pm
Lab 3 – Blinking Light and Preprocessor
- 3:00 pm
Lab 4 – LED and Counter
90
Lab 3 Overview
• Blinking Light and Preprocessor
91
Next Project
92
Lab 4 Overview
• LED and Counter
93
Syllabus
Day 1
- 8:30 am Introduction / Survey
- 9:15 am
What is a Microcontroller
- 9:45 am
Compiler and C as Tools
- 10:15 am
Break
- 10:30 am
Lab 1 – Load Software
- 11:00 am
Lab 2 – White Light
- 12:00 pm
Lunch
- 1:00 pm
C Syntax, Compilers, Basic C Statements, Preprocessor
- 2:00 pm
Lab 3 – Blinking Light and Preprocessor
- 3:00 pm
Lab 4 – LED and Counter
94
Day 2
• Recap yesterday events
95
Syllabus
Day 2
- 8:30 am
- 9:00 am
- 10:00 am
- 11:00 am
- 12:00 pm
- 1:00 pm
- 2:00 pm
- 3:00 pm
- 3:45 pm
- 4:00 pm
- 4:30 pm
- 5:00 pm
Recap of Day 1
Functions and Libraries
Lab 5 – Interrupts
Lab 6 – UART
Lunch
Lab 7 – Accelerometers
Lab 8 – Temp Sensor
Lab 9 – OLED / Final Project
Microcontroller peripherals
Support System (Software & Wiki, etc.)
Implementation / Adaption Plan / Issues at schools
Conclusions / Feedback / Survey
96
Functions
• A function is a block of code that has a name and it has a
property that is reusable (i.e. it can be executed from as
many different points in a C program as required
• A function groups a number of program statements into a
unit and gives it a name.
• Functions give the ability for code segmented into
modules or “black boxes”
97
Libraries
• A C library is a set of named functions. Some libraries are
part of the C language standard. There are static and
dynamic libraries
• Static Libraries are part of the build environment
• Dynamic Libraries are part of the run-time environment
• .h files or header files include functional prototypes and declarations
(not definitions) of functions
• The .h file is used to generate a library
98
Lab 5 Overview
• Interrupts – airbag or stereo
99
Lab 6 Overview - UART Implementation
• According
to wikipedia: A universal asynchronous
receiver/transmitter, abbreviated UART, is a piece of
computer hardware that translates data between parallel and
serial forms. UARTs are commonly used in conjunction with
communication standards such as EIA, RS-232, RS-422 or
RS-485. The universal designation indicates that the data
format and transmission speeds are configurable. The
electric signaling levels and methods (such as differential
signaling etc.) are handled by a driver circuit external to the
UART.
•A UART is usually an individual (or part of an) integrated
circuit used for serial communications over a computer or
peripheral device serial port. UARTs are now commonly
included in microcontrollers.
100
Lunch
• Documentation
• Tutorials
• Software Installation
• Online Resources
101
Lab 7 Overview - Accelerometer
• Accelerometer – This device
is on the Orbit board.
Y+
X+
Z+
102
Lab 7 Overview
• What is an accelerometer?
An accelerometer is an electromechanical device that will measure
acceleration forces. These forces may be static, like the constant
force of gravity pulling at your feet, or they could be dynamic caused by moving or vibrating the accelerometer.
• What are accelerometers useful for?
By measuring the amount of static acceleration due to gravity, you
can find out the angle the device is tilted at with respect to the
earth. By sensing the amount of dynamic acceleration, you can
analyze the way the device is moving. At first, measuring tilt and
acceleration doesn't seem all that exciting. However, engineers
have come up with many ways to make really useful products with
them.
103
104
Lab 8 Overview
• Temp Sensor with a UART
105
Don’t get frustrated
The project may not be
successful for each person each
time. Don’t get frustrated. The
process is simple but it is often
easy to make simple mistakes.
106
Lab 9 Overview
• Final Project
•Suggestions:
•Output Temp sensor data to the LEDs on the
Orbit board
•Output Accelerometer data to the UART
107
Impediments to Implementation
• Hurdles we have seen
• We have always done it this way
• Hurdles you might see
• Fear factor
108
Additional Materials
• Here is the link for our tutorials
http://cosmiac.org/thrust-areas/academicprograms-and-design-services/educationand-workforcedevelopment/microcontrollers/
• Here is a link for an advanced TI ARM
series of tutorials and workshops.
http://processors.wiki.ti.com/index.php/Gett
ing_Started_with_the_TIVA%E2%84%A2_
CSeries_TM4C123G_LaunchPad?keyMatch
=getting%20started%20with%20tiva&tisear
ch=Search-EN
109
Additional Material
• An online edX course on Tiva:
https://www.edx.org/course/utaustinx/utaustinx-ut-6-01xembedded-systems-1172#.U8CRHvldUqw
• An online course on ARM:
http://users.ece.utexas.edu/~valvano/Volume1/E-Book/
110
Additional Materials
• Our 2nd volume on ARM programming was published in summer. This 2nd
volume is on Texas Instruments (TI) ARM Cortex Peripheral Programming.
Here is the link to Amazon:
http://www.amazon.com/TI-ARM-Peripherals-Programming-Interfacingebook/dp/B00L9DRAI2/ref=sr_1_1?s=books&ie=UTF8&qid=1403799567&sr=
1-1
• The support materials are available at
http://microdigitaled.com/ARM/TI_ARM_books.htm
•
• The first volume was on ARM Assembly Language Programming and
Architecture.
http://microdigitaled.com/ARM/ARM_ASM_books.htm
111
Collaboration
•
We do
collaborations
very well
•
Small Grants
for Institutions
New to the ATE
Program
•
Project
Proposals
112
Conclusions
113
Painful survey
We need
your help in
statistics.
We will be
contacting
you!
114
APPENDIX
115
116
117
Download