cathy wicks, [email protected] jonathan valvano, … · segmented display (lcd) available on some...

33
Embedded, RTOS, and IoT Market share Complexity Parallelism Verification Cathy Wicks, [email protected] Jonathan Valvano, [email protected] Daniel Valvano Mark Easley John Gracia Why ARM M4?

Upload: lamthuy

Post on 27-Jul-2018

233 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Embedded, RTOS, and IoT

• Market share

• Complexity

• Parallelism

• Verification

• Cathy Wicks, [email protected]

• Jonathan Valvano, [email protected]

• Daniel Valvano

• Mark Easley

• John Gracia

Why ARM M4?

Page 2: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Outline

1. LaunchPad ecosystem (Mark)

2. Demonstrations (All)

– Unpack and blink

– TI-RTOS

– Questions and answers

3. Embedded system education (Jon)

– Courses, Books and Labs

– Competition

4. IoT demonstration (Mark)

Page 3: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

TI LaunchPad™ development kit

20/40-pin Standardized Pinout Add BoosterPack

Jumper to your own hardware BYOB – Build Your Own

Boosterpack

Segmented Display (LCD)

Available on some

LaunchPads

User LEDs

Isolation Jumper Let’s you isolate Target

Page 4: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

LaunchPad is TI’s common denominator

4

TI Wireless: Sub-1GHz, NFC/RFID, Wi-Fi, ZigBee, BLE, Bluetooth

Analog, sensors, displays & more from TI, 3rd parties & Maker community

Modular hardware enables developers to explore new ideas quickly

MSP430 (Ultra-Low Power)

TM4C (ARM Cortex M4F)

C2000 (Real-time Control)

Hercules (Safety)

LaunchPads featuring TI MCUs & BoosterPack interface

CC3200 (MCU + WiFi)

Page 5: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

TI LaunchPad development kit

• Students should have their own board

MSP432 LaunchPad $13

TM4C LaunchPad $13

Connected LP $20

Page 6: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

RTOS demonstration overview

• Configure Code Composer Studio • Import examples into workspace

• TI RTOS

• WorldShapers_TIRTOS_MSP432 • Threads, stacks

• Hardware-triggered tasks

• Semaphores

CCS and TI-RTOS are already installed

Page 7: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

MSP432-EDUMKII

System Bus

fourUART

24channelsADC14

eightSPI

fourTimerA

fourI2C

Timer32

RTC

GPIO/SSI

Cortex M4 64k RAM

P1.5P5.0P1.6P5.7P3.7

LCD

P5.6P2.4P2.6

LED

GPIO

P2.7 BuzzerPWM

P1.3P1.2

PC/graderUART

P3.3P3.2

BluetoothUART

GPIO/I2C

GPIO

Analog

Buttons P3.5P5.1

P4.6P6.5P6.4P3.6

Light

Temperature

P4.3

P6.0P4.4P4.1

P6.1P4.0P4.2

Microphone

Joystick

Accelerometer

Analog

Analog

0) Unpack LaunchPad and MKII

1) Connect MKII to LaunchPad

Page 8: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

MSP432 drivers

8

2) Open Device Manager

3) Connect LaunchPad USB to PC

and power up the two boards

4) Watch installation

Make note of the COM port

Page 9: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Configure CCS

File->Switch Workspace

choose Other…

Page 10: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Configure CCS

2) Select all

C:\Users\Administrator\Desktop\Valvano_TI_RTOS

3) OK

1) Browse

Page 11: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Configure CCS

1) Project->Import CCS Projects

2) Click them all

3) Click Finish

WorldShapers_TIRTOS_MSP432

Page 12: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Debug

• Build

– Compile and link

• Debug

– Download and starts debugger

• Run

• Play game

•Quit debugger

Page 13: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

WorldShapers_TIRTOS_MSP432

• See how project

links to TI RTOS

– Open Includes

Derived from a

TI RTOS example project

Page 14: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

TI-RTOS

CCS and TI RTOS are already installed

Your Application

TCP/IP

Real-Time OS Kernel

Microcontroller Target

Standardized cross-platform APIs

USB,MSC,HID,CDC

FATFile

System

IPCMulticore

comm

Debug and Instrumentation

I/O drivers

You can teach

Applications

Interfacing

RTOS

Page 15: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

WorldShapers_TIRTOS_MSP432

• BSP.c

– My I/O drivers for EDUMKII

• WorldShapersMain.c

– 3 main threads

– 1 periodic task

– Semaphore used for mutual exclusion

Teach interfacing

Use RTOS to teach applications

Page 16: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Threads

• Three main threads “thread”

– Look like main programs

– Have priority

• I/O-triggered thread “task”

– Looks like an interrupt

service routine

R0R1...

SPPCPSR

Stack

Program

Thread

R0R1...

SPPCPSR

Stack

Program

Thread

R0R1...

SPPCPSR

Stack

Program

Thread

Page 17: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

WorldShapersMain.c

• Search for “thread”

– Manage: timeout, sleep, wait on event, kill

• MoveEnemiesThread (low priority)

– Implements AI of enemies

• GameThread (middle priority)

– Execute player dynamics

– Runs about 30 Hz

• SoundThread (high priority)

– Outputs sound to buzzer

– Runs at 1.4 kHz

Page 18: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

WorldShapersMain.c

• Search for “SlowPeriodicTask” – Triggered by periodic clock

– Looks like an ISR

• Search for “stack” – Each thread has its own stack

• Search for “main” – See how four threads are created

Page 19: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Semaphores

• Semaphore_pend

– Decrement counter

– Block if < 0

void Thread1(void){

Init1();

while(1){

Semaphore_pend(MutexHandle);

// exclusive access

Semaphore_post(MutexHandle);

// other processing

}

}

void Thread2(void){

Init2();

while(1){

Semaphore_pend(MutexHandle);

// exclusive access

Semaphore_post(MutexHandle);

// other processing

}

}

•Semaphore_post

– Increment counter

– Wake up one blocked if needed

Search for “semaphore”

• pend

• post

• construct

Page 20: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Change the loading screen

20

• Edit line 592 – Add your name

• Edit 110-114

• Build

• Debug

• Run

• Questions?

Page 21: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Educational objectives

• Outcomes, Measureables • Career opportunities

• Economic growth

• Student feedback

• Educational effectiveness • Improved performance

• Reduced resources

• Educational team

Embedded Systems

ME EE

CS BME Civil

Aero

Why are

we here?

Page 22: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Takeaway: Bottom up (what?)

• Bottom up: From simple to complex • Transistors → Gates → Computer → Systems

• Assembly → C → Java/C++ → LabVIEW

• Abstraction

• Understand → Put it in a box → Use the box

• Systems

• Take two systems→ Connect → New system+

Page 23: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Takeaway: See one, do one, teach one

• Equipment must work

• Assignments must be clear

• Assignments must be relevant

• Tasks support learning objectives

• Professors must do labs

Students learn by doing

Students learn by teaching

Page 24: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Takeaway: Empower students

• Students should have their own DVM

• Show labs to friends and parents

• Encourage them to work beyond lab

• Find sources of free parts

• Give simple stuff away

• Mentor their careers

• Job versus grad school

• Online presence

Students need to learn outside of lab

Page 25: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Courses, books and labs

Introduction to Embedded Systems

Freshman, MOOC

System Level Design

Junior, PCB, IoT

Real-time Operating Systems

Senior/grad ,CAN, Robot

• Cortex-M4

• serial, SPI, ADC,

• timer, PWM, DMA

• interrupt controller

• JTAG debugger

• floating point

$13 EK-TM4C123GXL, 43 I/O pins, 32k RAM, 256k RAM, 80 MHz, USB, CAN

EK-TM4C1294XL, 90 I/O pins, 256k RAM, 1M ROM, 120 MHz, Ethernet

MSP-EXP432P401R, 67 I/O pins, 64k RAM, 256k ROM, 48 MHz, low power $20 $13

Page 26: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Applications

• Compiler, simulator, debugger • TI: Code Composer Studio

• Keil uVision

• TExaS (simulation, grading, LA, scope)

• Circuit design and PCB layout • PCB Artist

• Eagle (100 by 80 mm, 2 layers)

• Circuit Maker (Altium)

• Design tools • TI: WEBENCH, Filter Pro

Page 27: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Introduction to embedded systems

Volume 1 (freshmen EE or BME) • Switches and LEDs

• Design and Debugging

• Finite State Machine

• Interrupts

• DAC output

• LCD graphics interface

• Fixed-point

• ADC input

• UART and distributed

• Capstone design - video

game

• Assembly or C programming

• Design and Debugging

– Simulation, logic analyzer, scope

9,295 sold, 507 pages, $34

Page 28: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Embedded Systems – Shape the World

• What is and isn’t a MOOC? – Spring 14, 15, 16, 17

– over 110,000 enrolled

– over 2.5 million video hits

– over 7% got certificates

– 2/3 who started, finished

– 95% approval rate

• Lab kit + teaching videos

• LaunchPad simulator, graders, voltmeter, scope

• Have done both Wi-Fi and BLE in MOOC

Physical kit increased completion rates

Page 29: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Interfacing and systems

Volume 2 (junior EE)

• Graphics device driver

• Alarm clock

• Stepper or DC motor

• Music player

• Temperature acquisition

• Wi-Fi and IoT

• Capstone design - open ended,

PCB, Power • Hardware/software debugging

• Design and debugging

• Analog, power, computer

4,274 sold, 600 pages, $44

Page 30: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Real-Time Operating Systems

Volume 3 (senior/grad EE) • Memory manager, device driver

• Thread switching RTOS

• Blocking semaphores

• Priority scheduler

• Digital and analog filters, FFT

• Digital control systems

• File system

• CAN or Ethernet network

• Autonomous robot racing

MOOC starting 9/2017 on edX http://ow.ly/ophC301Aa0p

3,061 sold, 485 pages, $30

Page 31: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

Support for teaching

Website (download and edit) • Examples for TM4C123, TM4C1294, MSP432

• PowerPoint slides

• Lab manual, data sheets

• http://users.ece.utexas.edu/~valvano/

LaunchPad tester

http://users.ece.utexas.edu/~valvano/arm/tester/

edX: Intro until Dec, RTOS-BLE Fall 2017

http://ow.ly/ophC301Aa0p

Adopt a book →

Free parts for LaunchPad tester

Page 32: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

For more information

39

Jonathan Valvano [email protected] http://users.ece.utexas.edu/~valvano/

EE319K Introduction

EE445L Interfacing and systems

EE445M Real-time operating systems

https://www.edx.org/course/embedded-systems-shape-world-utaustinx-ut-6-10x

https://www.edx.org/course/embedded-systems-shape-world-multi-utaustinx-ut-6-20x

http://users.ece.utexas.edu/~valvano/Volume1/E-Book/VideoLinks.htm

http://edx-org-utaustinx.s3.amazonaws.com/UT601x/RTOS.html

Mark Easley

Cathy Wicks [email protected]

Page 33: Cathy Wicks, c-wicks@ti.com Jonathan Valvano, … · Segmented Display (LCD) Available on some LaunchPads ... Program Thread. ... • Keil uVision • TExaS

IMPORTANT NOTICE FOR TI DESIGN INFORMATION AND RESOURCES

Texas Instruments Incorporated (‘TI”) technical, application or other design advice, services or information, including, but not limited to,reference designs and materials relating to evaluation modules, (collectively, “TI Resources”) are intended to assist designers who aredeveloping applications that incorporate TI products; by downloading, accessing or using any particular TI Resource in any way, you(individually or, if you are acting on behalf of a company, your company) agree to use it solely for this purpose and subject to the terms ofthis Notice.TI’s provision of TI Resources does not expand or otherwise alter TI’s applicable published warranties or warranty disclaimers for TIproducts, and no additional obligations or liabilities arise from TI providing such TI Resources. TI reserves the right to make corrections,enhancements, improvements and other changes to its TI Resources.You understand and agree that you remain responsible for using your independent analysis, evaluation and judgment in designing yourapplications and that you have full and exclusive responsibility to assure the safety of your applications and compliance of your applications(and of all TI products used in or for your applications) with all applicable regulations, laws and other applicable requirements. Yourepresent that, with respect to your applications, you have all the necessary expertise to create and implement safeguards that (1)anticipate dangerous consequences of failures, (2) monitor failures and their consequences, and (3) lessen the likelihood of failures thatmight cause harm and take appropriate actions. You agree that prior to using or distributing any applications that include TI products, youwill thoroughly test such applications and the functionality of such TI products as used in such applications. TI has not conducted anytesting other than that specifically described in the published documentation for a particular TI Resource.You are authorized to use, copy and modify any individual TI Resource only in connection with the development of applications that includethe TI product(s) identified in such TI Resource. NO OTHER LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE TOANY OTHER TI INTELLECTUAL PROPERTY RIGHT, AND NO LICENSE TO ANY TECHNOLOGY OR INTELLECTUAL PROPERTYRIGHT OF TI OR ANY THIRD PARTY IS GRANTED HEREIN, including but not limited to any patent right, copyright, mask work right, orother intellectual property right relating to any combination, machine, or process in which TI products or services are used. Informationregarding or referencing third-party products or services does not constitute a license to use such products or services, or a warranty orendorsement thereof. Use of TI Resources may require a license from a third party under the patents or other intellectual property of thethird party, or a license from TI under the patents or other intellectual property of TI.TI RESOURCES ARE PROVIDED “AS IS” AND WITH ALL FAULTS. TI DISCLAIMS ALL OTHER WARRANTIES ORREPRESENTATIONS, EXPRESS OR IMPLIED, REGARDING TI RESOURCES OR USE THEREOF, INCLUDING BUT NOT LIMITED TOACCURACY OR COMPLETENESS, TITLE, ANY EPIDEMIC FAILURE WARRANTY AND ANY IMPLIED WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUALPROPERTY RIGHTS.TI SHALL NOT BE LIABLE FOR AND SHALL NOT DEFEND OR INDEMNIFY YOU AGAINST ANY CLAIM, INCLUDING BUT NOTLIMITED TO ANY INFRINGEMENT CLAIM THAT RELATES TO OR IS BASED ON ANY COMBINATION OF PRODUCTS EVEN IFDESCRIBED IN TI RESOURCES OR OTHERWISE. IN NO EVENT SHALL TI BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL,COLLATERAL, INDIRECT, PUNITIVE, INCIDENTAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES IN CONNECTION WITH ORARISING OUT OF TI RESOURCES OR USE THEREOF, AND REGARDLESS OF WHETHER TI HAS BEEN ADVISED OF THEPOSSIBILITY OF SUCH DAMAGES.You agree to fully indemnify TI and its representatives against any damages, costs, losses, and/or liabilities arising out of your non-compliance with the terms and provisions of this Notice.This Notice applies to TI Resources. Additional terms apply to the use and purchase of certain types of materials, TI products and services.These include; without limitation, TI’s standard terms for semiconductor products http://www.ti.com/sc/docs/stdterms.htm), evaluationmodules, and samples (http://www.ti.com/sc/docs/sampterms.htm).

Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265Copyright © 2017, Texas Instruments Incorporated