1 SILICA I The Engineers of Distribution 1 Joe Bungo ARM mbed Hello World

2 SILICA I The Engineers of Distribution 2 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)

3 SILICA I The Engineers of Distribution 3 ARM Ltd

ARM 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, 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

4 SILICA I The Engineers of Distribution 4 ARM Connected Community – 800+

5 SILICA I The Engineers of Distribution 5 Huge Range of Applications

IR Fire Detector Exercise Utility Intelligent Intelligent toys Machines Energy Efficient Appliances Meters Vending Tele-parking

Equipment Adopting 32-bit ARM

6 SILICA I The Engineers of Distribution 6 Huge Opportunity For ARM Technology 35+ 100+ billion accumulated billion after next 7 yrs processors shipped

1998 2013 2020

7 SILICA I The Engineers of Distribution 7 From 1mm3 to 1km3

1mm3 1km3

10¢ $1000

Mobile Home Mobile Computing Server Embedded Consumer Enterprise PC HPC

8 SILICA I The Engineers of Distribution 8 ARM Cortex Advanced Processors

ARM Cortex™-A family:

● Applications processors for feature- Cortex-A57 rich OS and 3 rd party applications ...2.5GHz Cortex-A53 Cortex-A15 ARM Cortex-R family: Cortex-A9 ● Embedded processors for real-time Cortex-A8 signal processing, control applications Cortex-A7 Cortex-A5 Cortex-R7 ARM Cortex-M family: Cortex-R5 Cortex-R4 ● -oriented processors Cortex-M4 for MCU, ASSP, and SoC applications Cortex-M3 Cortex-M1 Cortex-M0 SC300 SC000 Cortex-M0+

<12k gates... 9 SILICA I The Engineers of Distribution 9 ARM Cortex family

Cortex-A8 Cortex-R4 Cortex-M3 ° Architecture v7A ° Architecture v7R ° Architecture v7M ° MMU ° MPU (optional) ° MPU (optional) ° AXI ° AXI ° AHB Lite & APB ° VFP & NEON support ° Dual Issue

10 SILICA I The Engineers of Distribution 10 Rapid Prototyping for Microcontrollers

11 SILICA I The Engineers of Distribution 11 What’s happening in Microcontrollers?

► 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

12 SILICA I The Engineers of Distribution 12 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

13 SILICA I The Engineers of Distribution 13 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

14 SILICA I The Engineers of Distribution 14 Rapid Prototyping

► Rapid Prototyping helps industries create new products ● Control, communication and interaction increasingly define products ● Development cycles for microelectronics have not kept pace

3D Moulding 3D Printing 2D/3D Design Web Frameworks

15 SILICA I The Engineers of Distribution 15 mbed Rapid Prototyping Platform

► Complete Hardware, Software and Web 2.0 Solution

Dedicated Developer Website Lightweight Online Compiler

High-level Peripheral APIs Prototyping Form-Factor

16 SILICA I The Engineers of Distribution 16 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 ● 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!

17 SILICA I The Engineers of Distribution 17 mbed SDK

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

18 SILICA I The Engineers of Distribution 18 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

19 SILICA I The Engineers of Distribution 19 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

TBA... $49 $45 $13 Design and production $20 ● All boards implement the mbed HDK ● Hardware is designed and/or made by ARM or 3 rd parties ● mbed HDK enables anyone to build alternate board designs

20 SILICA I The Engineers of Distribution 20 mbed Website ► Dedicated Developer Web Platform ● Custom Web 2.0 tools and environment focused on developers ● Simple route to get started, comprehensive resources and support

http://mbed.org

21 SILICA I The Engineers of Distribution 21 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

22 SILICA I The Engineers of Distribution 22 mbed Library ► High-level Peripheral APIs ● Trading memory and CPU performance for ease of use ● Abstract software interfaces for controlling microcontroller hardware ● Intuitive peripheral , encapsulation of implementation details ● Treat hardware and software the same

23 SILICA I The Engineers of Distribution 23 Lab 1 mbed registration and hello world

24 SILICA I The Engineers of Distribution 24 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

25 SILICA I The Engineers of Distribution 25 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

26 SILICA I The Engineers of Distribution 26 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

27 SILICA I The Engineers of Distribution 27 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!

28 SILICA I The Engineers of Distribution 28 Lab 2 Rapid Prototyping: Data Logging

29 SILICA I The Engineers of Distribution 29 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!

30 SILICA I The Engineers of Distribution 30 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

31 SILICA I The Engineers of Distribution 31 #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; }

32 SILICA I The Engineers of Distribution 32 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

33 SILICA I The Engineers of Distribution 33 #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++) { fprintf(fp,“%.2f\n”, ain.read()); wait (0.05); } fclose(fp); myled=1; }

34 SILICA I The Engineers of Distribution 34 Data quickly visible to a PC

While the program executes the flash drive disappears from the PC, and returns when the file is closed

Logging to a CSV file means Excel can open the file and interpret, manipulate or plot the data.

35 SILICA I The Engineers of Distribution 35 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

GND MISO – p6 SCL - p7 Vcc MOSI – p5 nCS - p8

► Hardware for an SD Card is minimal ● SPI Port connection using simple breakout ► As before, mbed keeps it simple

36 SILICA I The Engineers of Distribution 36 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

37 SILICA I The Engineers of Distribution 37 What about a USB drive? ► USB Host hardware is minimal; a USB A connector

VCC -> VU D- -> D- D+ -> D+ GND -> GND

38 SILICA I The Engineers of Distribution 38 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

39 SILICA I The Engineers of Distribution 39 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!

40 SILICA I The Engineers of Distribution 40 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

41 SILICA I The Engineers of Distribution 41 mbed Lab-in-a-Box

42 SILICA I The Engineers of Distribution 42 Freedom Lab-in-a-Box

43 SILICA I The Engineers of Distribution 43 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 45 SILICA I The Engineers of Distribution 45