Embedded Software Design Peter R. Wihl (former Guest Lecturer)

Slides:



Advertisements
Similar presentations
Computer Architecture
Advertisements

INPUT-OUTPUT ORGANIZATION
Serial Communications Interface (SCI) Michael LennardZachary PetersBao Nguyen.
A Sample RTOS Presentation 4 Group A4: Sean Hudson, Manasi Kapadia Syeda Taib.
Input and Output CS 215 Lecture #20.
Programmable Interval Timer
CS-334: Computer Architecture
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
MotoHawk Training Model-Based Design of Embedded Systems.
Architectural Support for Operating Systems. Announcements Most office hours are finalized Assignments up every Wednesday, due next week CS 415 section.
1 Pertemuan 12 Input/Output Matakuliah: H0344/Organisasi dan Arsitektur Komputer Tahun: 2005 Versi: 1/1.
Coordinate Based Tracking System
ECE Department: University of Massachusetts, Amherst ECE 354 Spring 2006 Lab 2: Capturing and Displaying Digital Image.
INPUT-OUTPUT ORGANIZATION
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 15 Slide 1 Real-time Systems 1.
INPUT/OUTPUT ARCHITECTURE By Truc Truong. Input Devices Keyboard Keyboard Mouse Mouse Scanner Scanner CD-Rom CD-Rom Game Controller Game Controller.
ECE 265 – LECTURE 12 The Hardware Interface 8/22/ ECE265.
Chapter 7 Input/Output Luisa Botero Santiago Del Portillo Ivan Vega.
Lecture 111 Lecture 11: Lab 3 Overview, the ADV7183B Video Decoder and the I 2 C Bus ECE 412: Microcomputer Laboratory.
USART interrupt.
REAL-TIME SOFTWARE SYSTEMS DEVELOPMENT Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
Input and Output Computer Organization and Assembly Language: Module 9.
Hardware Definitions –Port: Point of connection –Bus: Interface Daisy Chain (A=>B=>…=>X) Shared Direct Device Access –Controller: Device Electronics –Registers:
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Principles of I/0 hardware.
Typical Microcontroller Purposes
Team 6. Code Modules Codec Bluetooth Module Rotary Encoder Menu State Machine.
Real-Time Operating Systems for Embedded Computing 李姿宜 R ,06,10.
Autonomous Helicopter James LydenEE 496Harris Okazaki.
2009 Sep 10SYSC Dept. Systems and Computer Engineering, Carleton University F09. SYSC2001-Ch7.ppt 1 Chapter 7 Input/Output 7.1 External Devices 7.2.
© 2012 xtUML.org Bill Chown – Mentor Graphics Model Driven Engineering.
Device Drivers CPU I/O Interface Device Driver DEVICECONTROL OPERATIONSDATA TRANSFER OPERATIONS Disk Seek to Sector, Track, Cyl. Seek Home Position.
Computers Operating System Essentials. Operating Systems PROGRAM HARDWARE OPERATING SYSTEM.
REAL-TIME SOFTWARE SYSTEMS DEVELOPMENT Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
AS Computing Data Transmission and Networks. Transmission error Detecting errors in data transmission is very important for data integrity. There are.
Communication Systems 3.1) Characteristics of a Communication System.
PROJECT - ZYNQ Yakir Peretz Idan Homri Semester - winter 2014 Duration - one semester.
CH10 Input/Output DDDData Transfer EEEExternal Devices IIII/O Modules PPPProgrammed I/O IIIInterrupt-Driven I/O DDDDirect Memory.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
CSCI1600: Embedded and Real Time Software Lecture 16: Advanced Programming with I/O Steven Reiss, Fall 2015.
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
IT3002 Computer Architecture
Embedded Systems February 10, Serial Interface - SPI  Serial Peripheral Interface  Synchronous communications  Clock supplied by the Master.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
Tiva C TM4C123GH6PM UART Embedded Systems ECE 4437 Fall 2015 Team 2:
SPiiPlus Training Class
Chapter 13: I/O Systems.
Real-time Software Design
Types of format of data transfer
CS501 Advanced Computer Architecture
Microprocessor Systems Design I
Computer System Structures
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
CS703 - Advanced Operating Systems
Real-time Software Design
CSCI1600: Embedded and Real Time Software
CSCI 315 Operating Systems Design
Module 2: Computer-System Structures
I/O Systems I/O Hardware Application I/O Interface
Operating Systems Chapter 5: Input/Output Management
Programmable Data Communication Blocks
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Co-designed Virtual Machines for Reliable Computer Systems
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Module 2: Computer-System Structures
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

Embedded Software Design Peter R. Wihl (former Guest Lecturer)

Overview Data flow practices (Throughput) Real time systems Software design overview Communication protocols An example software design Feel free to ask questions at any time

Execution Flow A diagram that describes the major steps in the sequential software flow. Illustrates each logical step and decision point in the overall design of the software. Provides a starting point for the design of the software. Is to embedded software as logical architecture is to hardware. Is mapped later to Routines, Functions or Objects

Before Designing Execution Flow 1.Identify which logical architectural modules are mapped to software. 2.Identify what time period all logical software function must be completed in. 3.Identify any additional overhead functionality due to modules mapped to software and/or characteristics of the physical design. ie. Polling/Interrupts

Logical Design Architecture Example

Physical Architecture Mapping

Logical Design Architecture Example

Role of Microcontroller Read 16-bit word from ADC Calculate Error Correction Code (2-bit) Inject possible error Detect if there is an error If there is an error correct it Write new 16-bit word to DAC

Execution Flow Diagram

Data Throughput in SW What is synchronous data flow? –Data arrives at regular intervals What is asynchronous data flow? –Data does not arrive at regular intervals What is isochronous data flow? –Data must be delivered within certain time constraints

Data Flow Practices Polling Interrupt triggered (blocking) Interrupt triggered (non-blocking) Event driven –Often referred to as interrupt driven

Sample Problem Need to receive 16 bytes into a buffer and then process the buffer Bytes arrive asynchronously

Polling Overview

Polling main do forever count = 0 while count < 16 while byte not ready nop get byte buffer[count] = byte incr count process buffer

Interrupt (Blocking) Overview

Interrupt Triggered (Blocking) interrupt rx_byte disable interrupts count = 0 while count < 16 get byte buffer[count] = byte incr count process buffer enable interrupts return main enable interrupts do forever nop

Interrupt (Non-Blocking) Overview

Interrupt Triggered (Non-blocking) interrupt rx_byte if count < 16 get byte buffer[count] = byte incr count else if count = 16 process buffer count = 0 return main count = 0 enable interrupts do forever nop

Event Driven Overview

Event Driven interrupt rx_byte if count < 16 get byte buffer[count] = byte incr count return main count = 0 enable interrupts do forever if count = 16 process buffer count = 0

Real Time Hard real time –Absolute deterministic response to an event Soft real time –Average response to an event

Embedded Software Practices Peter R. Wihl ECE 164 Spring 2004

Overview Data flow practices Real time systems Communication protocols Software design overview An example software design Feel free to ask questions at any time

Data Flow Types What is synchronous data flow? What is asynchronous data flow? What is isochronous data flow?

Data Flow Types What is synchronous data flow? –Data arrives at regular intervals What is asynchronous data flow? –Data does not arrive at regular intervals What is isochronous data flow? –Data must be delivered within certain time constraints

Data Flow Practices Polling Interrupt triggered (blocking) Interrupt triggered (non-blocking) Event driven –Often referred to as interrupt driven

Sample Problem Need to receive 16 bytes into a buffer and then process the buffer Bytes arrive asynchronously

Polling main do forever count = 0 while count < 16 while byte not ready nop get byte buffer[count] = byte incr count process buffer

Interrupt Triggered (Blocking) interrupt rx_byte disable interrupts count = 0 while count < 16 get byte buffer[count] = byte incr count process buffer enable interrupts return main enable interrupts do forever nop

Interrupt Triggered (Non-blocking) interrupt rx_byte if count < 16 get byte buffer[count] = byte incr count else if count = 16 process buffer count = 0 return main count = 0 enable interrupts do forever nop

Event Driven interrupt rx_byte if count < 16 get byte buffer[count] = byte incr count return main count = 0 enable interrupts do forever if count = 16 process buffer count = 0

Real Time Hard real time –Absolute deterministic response to an event Soft real time –Average response to an event

Trick Questions Which is better, hard or soft real time? Which design methods are hard real time? Which design methods are soft real time?

Communication Protocols What is a communication protocol? –An established set of conventions by which multiple systems exchange data The speech analogy –The sounds you can make are the communication medium –The language you use is the protocol

Sample Protocol ByteData 0Synchronization 1Payload size 2…2+sizePayload 2+size+1Packet checksum

Protocol Interrupt interrupt rx_byte get byte checksum = byte  checksum switch (state) SYNC if byte = sync checksum = byte state = SIZE SIZE size = byte if size > 0 count = 0 state = PAYLOAD else state = CHECKSUM PAYLOAD buffer[count] = byte incr count if count = size state = CHECKSUM CHECKSUM if checksum = 0 state = ACCEPT else state = SYNC ACCEPT drop byte return

Protocol Main main state = SYNC enable interrupts do forever if state = ACCEPT process buffer state = SYNC This is a simple event loop that provides mutual exclusion for the buffer

Time For A Break

Software Design Overview Requirements Analysis Architecture Design Implementation Module Testing Design Validation Testing

Example Problem I want to build a Heads Up Display for my car. I would like to see both my engine RPM and fuel economy on my windshield. My car has a serial diagnostic interface that provides this data.

Requirements System shall have a Heads Up Display (HUD) System shall interface with vehicle’s onboard diagnostic system HUD shall display current RPM HUD shall display current fuel economy (MPG)

Hardware Constraints Vehicle’s onboard diagnostic system –Needs a wake-up signal sent every 1 second –Operates at 10,500 bps Heads Up Display –256x128 pixels –Full display must be calculated and mirrored –Operates at 115,200 bps

Processor Requirements Processor shall have 2 UARTs 1.Vehicle’s onboard diagnostic system 2.Heads Up Display Processor shall have a timer –Vehicle’s onboard diagnostic system wake-up Processor shall have more than 8192 bytes of memory –Processed display image (4096 bytes) –Mirrored display image (4096 bytes)

Hardware Design

Software Architecture

Software Design Modules –Vehicle Diagnostic Interface (VDI) –RPM Data Formatting (RDF) –MPG Data Formatting (MPG) –Display Processing (DP) –Display Control Interface (DCI)

Software Design Modules –Vehicle Diagnostic Interface (VDI) –RPM Data Formatting (RDF) –MPG Data Formatting (MPG) –Display Processing (DP) –Display Control Interface (DCI) Main/Initialization

Vehicle Diagnostic Interface

interrupt rx_byte … rx_state = ACCEPT … return extract_data if data type = RPM extract RPM data rpm_format(data) else if data type = MPG extract MPG data mpg_format(data) return main … do forever … if rx_state = ACCEPT extract_data rx_state = SYNC …

Vehicle Diagnostic Interface interrupt timer wakeup = 1 return tx_wakeup send wakeup control block return main … do forever … if wakeup = 1 tx_wakeup wakeup = 0 …

RPM Data Formatting

MPG Data Formatting

Display Processing

Display Control Interface

Test Plan 1.Test functionality of every module 2.Test functionality of every module interaction 3.Test functionality of the final system

Implementation This is when you actually write your code.

Module Testing Simple implementations to test a single module or module interaction Total testing code will often be larger than the actual system’s code base Is this good or bad?

Design Verification Testing A scripted test plan that guides a tester through use of the system A table with the following: –Every system requirement –Whether or not the requirement was met