SILICA I The Engineers of Distribution 111
SILICA I The Engineers of Distribution 222
Joe Bungo
ARM
mbed Hello World
SILICA I The Engineers of Distribution 33
Agenda
► ARM Overview
● Who is ARM?
► mbed
● Introduction to mbed
● Lab 1 mbed registration and hello world demo
● Lab 2 Rapid prototyping: Creating a file system
What you’ll need:● http://mbed.org/handbook/Windows-serial-configuration (download driver and
run installer if you have Windows)
● http://mbed.org/handbook/Terminals (download any terminal application if
you do not already have one installed)
SILICA I The Engineers of Distribution 44
ARM LtdARM founded in November 1990
● Advanced RISC Machines
Company headquarters in Cambridge, UK
● Processor design centers in Cambridge, Austin, and Sophia Antipolis
● Sales, support, and engineering offices all over the world
Best known for its range of RISC processor cores designs
● Other products – fabric IP, software tools, models, cell libraries -
● to help partners develop and ship ARM-based SoCs
ARM does not manufacture silicon
More information about ARM and our offices on our web site: www.arm.com
SILICA I The Engineers of Distribution 55
ARM Connected Community – 800+
SILICA I The Engineers of Distribution 66
Huge Range of Applications
Energy Efficient Appliances
IR Fire Detector
Intelligent Vending
Tele-parking
Utility Meters
Exercise MachinesIntelligent toys
Equipment Adopting 32-bit ARM Microcontrollers
SILICA I The Engineers of Distribution 77
Huge Opportunity For ARM Technology
1998 2013 2020
billion
35+billion
35+35+processors shipped
100+billion100+100+
billion accumulated
after next 7 yrs
SILICA I The Engineers of Distribution 88
From 1mm3 to 1km3
1mm3 1km3
10¢ $1000
Mobile Embedded Consumer
Mobile Computing Server Enterprise PC
HomeHPC
SILICA I The Engineers of Distribution 99
ARM Cortex Advanced Processors
ARM Cortex™-A family:● Applications processors for feature-
rich OS and 3rd party applications
ARM Cortex-R family:● Embedded processors for real-time
signal processing, control applications
ARM Cortex-M family:● Microcontroller-oriented processors
for MCU, ASSP, and SoC applications
<12k gates...
SC300
Cortex-M0+
SC000
Cortex-R5Cortex-R4
Cortex-R7
Cortex-M4Cortex-M3Cortex-M1Cortex-M0
Cortex-A7
...2.5GHz
Cortex-A5
Cortex-A8Cortex-A9
Cortex-A57
Cortex-A15Cortex-A53
SILICA I The Engineers of Distribution 1010
ARM Cortex family
Cortex-A8
� Architecture v7A
� MMU
� AXI
� VFP & NEON support
Cortex-R4
� Architecture v7R
� MPU (optional)
� AXI
� Dual Issue
Cortex-M3
� Architecture v7M
� MPU (optional)
� AHB Lite & APB
SILICA I The Engineers of Distribution 1111
Rapid Prototyping for Microcontrollers
SILICA I The Engineers of Distribution 1212
► Microcontrollers are getting cheap
● 32-bit ARM Cortex-M3 Microcontrollers @ $1
► Microcontrollers are getting powerful
● Lots of processing, memory, I/O in one package
► Microcontrollers are getting interactive
● Internet connectivity, new sensors and actuators
► Creates new opportunities for microcontrollers
What’s happening in Microcontrollers?
SILICA I The Engineers of Distribution 1313
Opportunities for Microcontrollers
► Before 1980 computers were used and applied by computer scientists
► now they are:
● Applied across all industries
● Widely used in the home
● Used by almost anybody
► Currently microcontroller technology is mainly applied by the embedded professional
► Microcontrollers interact with “the real world”
● Sensors, actuators and communication, define their application
● Their potential is greater than the home computer
SILICA I The Engineers of Distribution 1414
Barriers for Microcontrollers
► What prevents microcontrollers from being designed in?
► Conceptually simple things can be hard to prototype
● I want to send an SMS when my cat comes through the cat flap
► Repetition of choices to make:
● Microcontroller
● Tool chain
● Dev board
● Sensors
● It’s not difficult, but can be tedious and time consuming
► Overhead for starting a new project
● Fine for a long complex projects
● A deterrent for quick experiments and tests
SILICA I The Engineers of Distribution 1515
Rapid Prototyping
3D Moulding 3D Printing 2D/3D Design Web Frameworks
► Rapid Prototyping helps industries create new products
● Control, communication and interaction increasingly define products
● Development cycles for microelectronics have not kept pace
SILICA I The Engineers of Distribution 1616
► Complete Hardware, Software and Web 2.0 Solution
mbed Rapid Prototyping Platform
Lightweight Online Compiler
Prototyping Form-Factor
Dedicated Developer Website
High-level Peripheral APIs
SILICA I The Engineers of Distribution 1717
mbed.org - Rapid Prototyping for MCUs
► Fastest way to get started with ARM microcontrollers
● Plug ‘n’ Play Hardware, Online Compiler
● Get setup and run “Hello World!” in 60 seconds
● Removes entry barriers to MCU technology
► Focused on rapid prototyping for a diverse audience
● DIP form-factor, High-level APIs, Developer website
● Technology and tradeoffs to enable fast experiments
● Creates new applications for MCU technology
► Launched at ESC Boston in Sept 2009 with live demo
● Internet-enabled “Twittering Billy” read out tweets
● An embedded internet device, prototyped in ½ day
● Over ¼ million video views in first week!
SILICA I The Engineers of Distribution 1818
mbed SDK
C/C++ SDK for ARM Microcontrollers● High-level APIs and standard environment
● Low level control as needed
● Portable across different ARM silicon vendor MCUs
Built on industry standard technology● ANSI/ISO C/C++
● CMSIS Compliant
● Compatible with all major professional MCU tools
Open Source● Released under permissive Apache 2.0 license
● Suitable for commercial and non-commercial use
● Managed, maintained and tested by ARM
SILICA I The Engineers of Distribution 1919
mbed HDK
HDK for ARM Microcontroller Boards● MCU sub-system and debug interface architecture
● Includes on-board USB interface
● Enables standard connection on low-cost boards, starter kits, modules
Built on industry standard technology● USB Device
● CMSIS-DAP Debug Interface Protocol
● Compatible with Windows, Mac, Linux
Free for commercial and non-commercial use● Portable across different ARM silicon vendor MCUs
● Developed, tested and maintained by ARM
SILICA I The Engineers of Distribution 2020
mbed-enabled Hardware
Expanding range of off-the-shelf mbed-enabled hardware● ARM Cortex-M0, M0+, M3 all represented; M4 TBA
● DIP prototyping modules, Arduino eval board form-factors
● Available through worldwide distribution
Design and production● All boards implement the mbed HDK
● Hardware is designed and/or made by ARM or 3rd parties
● mbed HDK enables anyone to build alternate board designs
TBA...
$49$13 $20
$45
SILICA I The Engineers of Distribution 2121
► Dedicated Developer Web Platform
● Custom Web 2.0 tools and environment focused on developers
● Simple route to get started, comprehensive resources and support
mbed Website
http://mbed.org
SILICA I The Engineers of Distribution 2222
mbed Compiler
► Lightweight Online Compiler
● Web 2.0 browser-based IDE with personal workspace “in the cloud”
● Nothing to install or configure, login from anywhere
● Industry leading compilation tools in the back end. It is a real tool
SILICA I The Engineers of Distribution 2323
mbed Library
► High-level Peripheral APIs
● Trading memory and CPU performance for ease of use
● Abstract software interfaces for controlling microcontroller hardware
● Intuitive peripheral access, encapsulation of implementation details
● Treat hardware and software the same
SILICA I The Engineers of Distribution 2424
Lab 1
mbed registration and hello world
SILICA I The Engineers of Distribution 2525
Registration
► mbed microcontroller enumerates as a Mass Storage Device (USB disk)
► double-click the mbed.htm file on the mbed USB disk
► Log in or sign up for a new account
► The mbed microcontroller contains your license to the compiler
SILICA I The Engineers of Distribution 2626
Getting Started
Useful resources linked
from the first page,
including very clear
links to “Hello World”
and the Getting
Started guide
Compiler linked from
front page
SILICA I The Engineers of Distribution 2727
Getting started
► Create or open a project in the Program Workspace
► Develop code in the text editor
► Save and compile
► Compiler outputs
● Errors and warnings
● -or-
● A downloadable binary
► Save to the USB flash disk
SILICA I The Engineers of Distribution 2828
Getting started
► Once the file has saved to the flash disk, it needs to be programmed into the microcontroller
► Press the button on the mbed module
► Your code will start running!
SILICA I The Engineers of Distribution 2929
Lab 2
Rapid Prototyping: Data Logging
SILICA I The Engineers of Distribution 3030
Example : Data Logging
Applications often include data logging capabilities, and access to the data often involves custom software and interface cables.
This example shows how standard methods and interfaces can be used to display, save and retrieve data from an application
► For the purposes of the experiment, we will be displaying and logging noise from an unconnected ADC
● Touching the pin will influence the noise
● It is a demonstration, imagine it is real data!
SILICA I The Engineers of Distribution 3131
Example : See the data
► The USB connection to mbed can also be used to provide a serial port
► Windows requires a driver, linux and Mac “just work”
► http://mbed.org/handbook/Windows-serial-configuration
► Standard C functions, printf and scanf
► This example displays 100 samples to a terminal application
SILICA I The Engineers of Distribution 3232
#include “mbed.h”
AnalogIn ain(p20);DigitalOut myled(LED1);
int main() {for (int i=0; i<300; i++) {
printf(“%.2f \n\r”, ain.read());wait (0.05);}
myled=1;}
SILICA I The Engineers of Distribution 3333
Example : Data Logging
► The mbed Flash disk is accessible from user code using the LocalFileSystem object
► Standard C file handling techniques apply
► fscanf for runtime configuration
► fprintf for data logging purposes
► This example logs 100 samples to a CSV file
SILICA I The Engineers of Distribution 3434
#include “mbed.h”
AnalogIn ain(p20);DigitalOut myled(LED1);LocalFileSystem fs(“fs”);
int main() {FILE *fp = fopen(“/fs/data.csv”,”w”);for (int i=0; i<300; i++) {
f printf( fp, “%.2f \n ”, ain.read());wait (0.05);}
fclose(fp);myled=1;
}
SILICA I The Engineers of Distribution 3535
Data quickly visible to a PC
Logging to a CSV file means
Excel can open the file and
interpret, manipulate or
plot the data.
While the program executes the
flash drive disappears from the
PC, and returns when the file is
closed
SILICA I The Engineers of Distribution 3636
GNDMISO – p6SCL - p7VccMOSI – p5nCS - p8
Extend it to store lots of data
► Perhaps a final system might want to store lots of data
● SD cards are ideal, ubiquitous and recognisable by everyone
► Hardware for an SD Card is minimal
● SPI Port connection using simple breakout
► As before, mbed keeps it simple
SILICA I The Engineers of Distribution 3737
Extend it to store lots of data
► Import the SDFileSystem Library into the project
► Include the SDFileSystem header
► Swap LocalFileSystem for SDFileSystem
► Everything else remains the same
SILICA I The Engineers of Distribution 3838
What about a USB drive?► USB Host hardware is minimal; a USB A connector
VCC -> VUD- -> D-D+ -> D+GND -> GND
SILICA I The Engineers of Distribution 3939
What about a USB drive?
► On your project, right click -> Import the files
for MSCFileSystem
► http://mbed.org/users/chris/programs/MSCUsbHost/5z8fm
► Add #include for MSCFileSystem
► Call it “fs”, as before
► The change in storage medium is transparent to
the application
SILICA I The Engineers of Distribution 4040
Summary
► There is huge opportunity for microcontroller applications
● A major barrier to adoption is simple experimentation
► mbed helps with getting started and rapid prototyping
● Fast turnaround of experiments and prototyping new ideas
● Try out new technology and new ideas
► Makes the technology very accessible
● Demo showed a start to finish prototyping example
● From getting a user started to enabling an application experiment
► Use at as a tool when you need to experiment!
SILICA I The Engineers of Distribution 4141
Summary
► A solution focused on prototyping has a broad appeal
► Engineers new to embedded applications
● Enables experimentation and testing product ideas for the first time
● Create designs where electronics and MCUs are not the focus
► Experienced engineers
● Provides a way to be more productive in the proof-of-concept stages
● Introduce 32 bit microcontroller technology to existing designs
► Marketing, distributors and application engineers
● Provides a consistent platform for demonstration, evaluation, support
● Make promotion of MCUs more effective and efficient
SILICA I The Engineers of Distribution 4242
mbed Lab-in-a-Box
SILICA I The Engineers of Distribution 4343
Freedom Lab-in-a-Box
AUP Registration
► To keep up with AUP offerings and ARM developments overall, register
to the ARM University Programme online:
www.arm.com/university
► Tell us about your ARM-based activities and feedback on our various
offerings
SILICA I The Engineers of Distribution 4545