Low-Cost Microcontrollers Examples and Applications for Embedded Systems João Carlos Martins joao.martins@ipbeja.pt Engineering Dept 1st Workshop on Applied Signal Processing IPBeja 15th May 2014
Outline What are Embedded Systems Microprocessors VS Microcontrollers Anatomy of a Microcontroller Microcontrollers examples A small computer platform (RPi) Embedded Systems Programming Embedded Systems Applications Conclusions 2
Embedded Electronic Systems Examples: Mobile phone / smartphone / PDA / Tablet Washing machine / microwave oven / kettle/ tootbrush Digital watch, digital camera, gamepad TVs, VCR, BluRay, music players, toys A modern cars has about 100 processors All these devices have embedded electronic systems: a processor, sensors, actuators, buttons, displays, Today its hard to find an electronic appliance without a microprocessor 3
C vs M Microprocessor ( M or MPU) General purpose device Composed by a central processing unit (CPU), memory and I/O External peripherals are added dependent on the application Ex: ARM, MIPS: Mobile, Appliance Devices Intel, AMD: Computer/Server platforms Microcontroller ( C or MCU) Device targeted for applications CPU, memory, I/O, and several peripheral modules: ADCs/DACs, Timers, PWM, communications interfaces (SPI, UART, ), sensors, integrated in a single package SoC: System on Chip Distinction between M and C is blurred 4
Anatomy of a Small MCU A complete (basic) computer system on a chip (SoC) Low processing power (compared to a MPU) High integration level Low-power consumption Integrate analog functions Low-cost (<< 1) Often substitute several discrete electronic components Typically process 8 to 16 bit of data (although 32 bit are also becoming common) Main function is for control rather than computation Come in packages of 8 to about 100 of pins Normally do not use an Operating System (OS) Software runs directly on hardware Microcontrollers are used in real-time systems (can be used with a RTOS also) 5
A Tiny Example ATMEL ATtiny4 0.30 6 pins (2NC) 512 Bytes Flash 32 Bytes SRAM 12MHz (Up to 12 MIPS) 8-bit AVR CPU 54 Instructions 4 bi-directional I/O pins: 2 PWM Channels, 16-bit Timer/Counter 4 External ISR 4 channel 8-bit ADC Vcc: 1.8 to 5.5 V Active Mode Consumption: 200µA at 1MHz and 1.8V (<0.1µA at 1.8V in sleep mode) 6
The Arduino Platform Microcontroller ATmega328 Price: 20 Clock Speed 16 MHz Vcc 5 V Input Voltage: 7 12 V Input Voltage limits: 6 20 V 14 Digital I/O Pins: 6 PWM SPI 6 Analog Input Pins (10-bit) UART TTL communication DC Current per I/O Pin: 40 ma DC Current for 3.3 V Pin: 50 ma Flash Memory 32 KB 0.5KB used for bootloader SRAM 2 KB EEPROM 1 KB http://arduino.cc/en/main/arduinoboarduno Several other boards: http://arduino.cc/en/main/products 8
From: http://www.arduinobrasil.com/2011/01/uno/ Arduino Platform Anatomy 9
Arduino Platform Platform can be complemented with several stackable hardware shields: GSM shield Ethernet shield WiFi shield Motor driver shield etc 10
Arduino IDE Platform Programmed with the Arduino opensource software Programmed with the Arduino programming language a subset of C++ Ex: LED blinking sketch: void setup() { pinmode(13, OUTPUT); } void loop() { digitalwrite(13, HIGH); delay(1000); digitalwrite(13, LOW); delay(1000); } 11
Arduino IDE 12 From: ios Sensor Apps with Arduino
TM4C123GH6PM MCU Fabricated by Texas Instruments Tiva C Series http://www.ti.com/lit/ds/symlink/tm4c123gh6pm.pdf Based on the ARM Cortex -M4F IP core: 32-bit 80MHz Thumb-2 mixed 16-/32-bit instruction IEEE754-compliant single-precision FPU 16-bit SIMD vector processing unit Harvard architecture Hardware division and fast digital-signal-processing MAC Ultra-low power consumption with integrated sleep modes Memory: 32 KB SRAM; internal ROM, 256 KB Flash, 2KB EEPROM 13
TM4C123GH6PM MCU From: Embedded Systems: Introduction to ARM Cortex-M Microcontrollers, 2013 14
Tiva C Series MCU JTAG Interface for test and debug Up to 43 General-Purpose I/O (GPIOs) 12 Several General-Purpose Timers with Several Modes 2 Watchdog Timers Modules ADC: 12-bit, 2 ADCs, 12 channels; single and differential 8 configurable UARTs 4 Synchronous Serial Interface (SSI) 4 Inter-Integrated Circuit (I2C) Interface 2 Controller Area Network (CAN) modules Universal Serial Bus (USB) Controller 2 Analog Comparators 2 Pulse Width Modulation (PWM) modules: 16 PWM outputs Vcc: 3.3V limits: 3.15-3.63V 15
Tiva C Series TM4C LaunchPad Evaluation Board Tiva C Series TM4C LaunchPad Evaluation Board (EK-TM4C123GXL) Price: $12.99 80MHz 256KB Flash 32KB RAM 2-KB EEPROM On-chip ROM with drivers and boot loaders Two12ch 12-bit ADCs (1 MSPS) 16x Motion PWM channels 24x Timer/Capture/Compare/PWMs 3x Analog comparators 4x SPI/SSI, 4x I2C, 8x UART USB Host/Device/OTG 2x CAN Low-power hibernation mode 43x GPIO pins 16
Tiva C Series TM4C1294 Connected LaunchPad Tiva C Series TM4C1294 Connected LaunchPad Board $19.99 120MHz 32-bit ARM Cortex-M4 CPU with FPU 1MB Flash, 256KB SRAM, 6KB EEPROM, Integrated 10/100 Ethernet MAC+PHY, data protection hardware, 8x 32-bit timers, dual 12-bit 2MSPS ADCs, motion control PWMs, USB H/D/O 17
The LaunchPad Ecosystem The LaunchPad functionalities can be extended with BoosterPacks: http://www.ti.com/ww/en/launchpad/boosterpacks.html add-on boards that follow a pin-out standard by TI Examples: WiFi BoosterPack LCD BoosterPack Capacitive Touch BoosterPack RF BoosterPack Radio Module L298 Motor Control BoosterPack, etc 18
Tiva C Series LaunchPad IDEs Several IDEs: Texas Instruments Code Compose Studio (CCS) IDE based on Eclipse ARM Keil uvision Both have: Editor, assembler, compiler and simulator Download and debug software to the real MCU Programmable in C or assembly Energīa Open-source electronics prototyping platform Similar to the Arduino framework for the TI LaunchPad community. Includes an IDE based on Processing. 19
ARM Keil uvision IDE 20
MSP430 MCU Family By Texas Instruments Example: MSP430G2553 MCU MSP Mixed Signal Processor 16-bit RISC architecture 16-bit registers (R0-R15) 16MHz 16KB Flash 512B RAM 8ch 10-bit ADC, 200 ksps Analog comparator Two 16-bit Timers Up to 1x I2C, 2x SPI, 1x UART Up to 24 I/O Low-power: 0.1 μa RAM retention; 0.4 μa Standby mode (VLO); 0.7 μa real-time clock mode; 220 μa / MHz active Ultra-Fast Wake-Up From Standby Mode in <1 μs 21
MSP-EXP430G2 LaunchPad Evaluation Board Price: $9.99 20 pin DIP socket for easy breadboarding/prototyping on-board emulation: program and debug without additional tools. Support all MSP430 Value Line MCUs 14 and 20 pin DIP Can be used as a flash programmer. Compatible with all BoosterPacks Great general purpose LaunchPad: Includes buttons and LEDs for quick hands-on Low power operation: great for batteryoperated applications 22
MSP430 LaunchPad Several IDEs: TI Code Composer Studio (CCS) IAR Embedded Workbench MSPGCC Both have: Editor, assembler, compiler and simulator Download and debug software to the real MCU 23
The Raspberry Pi Platform Credit-card-sized single-board computer SoC Broadcom BCM2835 based on ARM11core (ARMv6 ISA) 700MHz, 512MB RAM (Model B) GPU: Broadcom VideoCore IV @ 250 MHz; OpenGL 2.0; MPEG-2, h.264/mpeg-4 SD card storage Linux OS Python is the main programming language (not quite a MCU) 24
Raspberry Pi Peripherrals Model B: Price: 28 Two USB 2.0 ports (can be extended with a USB HUB) Video output: Composite RCA and HDMI (no VESA) Native storage: SD Card (can be used HDD via USB) 10/100 Mbit/s Ethernet 8 GPIO, UART, I²C bus, SPI bus, I²S audio, +3.3 V, +5 V Video input connector for camera module Power: 300mA (3.5W) Linux: Arch Linux ARM, Debian GNU/Linux, Gentoo, Fedora, FreeBSD, NetBSD, Raspbian OS, RISC OS, Slackware Linux Development boards: RasPiComm, Clocks & Timing, Sensors, Stepper Motor Drivers, etc (2.5 million boards had been sold at February 2014! First units came out at February 2012) 25
Raspberry Pi Anatomy 26 Image from: http://makersguildfc.com/2013/06/04/intro-to-raspberry-pi/
Programming Languages C programming language C programming language C programming language Assembly (ISA dependent on each device) Python Java 8 release: Support for ARM embedded devices Run on embedded platforms such as Raspberry Pi and Lego Mindstorms EV3 Allow Java-based applications to support the internet-ofthings 27
Applications The platforms described cover the main electronic applications. Complemented with additional sensors/actuators any scenario application can be coped with at least one of these platforms. The combination of hardware, software, and information constitutes the new paradigm: the Internet of Things (IoT). The imagination is the limit. 28
Conclusions The available set of hardware and software tools opened the embedded systems world to a larger and larger audience The Internet helps the spread of documentation and projects and ideas Together with the general availability of network connections these systems are make possible a new set of applications: the Internet of Things (IoT). The next (current) generation of software applications will (are) no longer be desktop centred. 29
The End Thanks for your attention! 30