Visual Embedded System Programming Has Arrived! Alex Doboli, Ph.D. Department of Electrical and Computer Engineering State University of New York at Stony Brook Email: adoboli@ece.sunysb.edu Simona Doboli, PhD Department of Computer Science Hofstra University, Hempstead NY Eddie Currie, Ph.D. Resonance Publications Inc ©Alex Doboli 2008 Overview • Efforts on variety of teaching materials on embedded systems – reconfigurable, mixed-signal, trade-offs, high-level • Modern & future-generation embedded systems require holistic knowledge and skills on analog, digital, software and networking – Systems and networks • Based on Cypress Semiconductor’s PSoCTM mixed-signal reconfigurable architecture & PSoC Express ©Alex Doboli 2008 Developed Teaching Material • Sequence of courses based on PSoC (freshman to senior and firstyear graduate): – Introduction to Electrical and Computer Engineering (freshman) • Visual Programming – Design of Mixed-Signal Embedded Systems (senior/grad) – Senior Design (Hofstra University) • Teaching material: – Textbook – Lab book – Lecture slides – Course projects – Exercises – Research papers and papers on education ©Alex Doboli 2008 Textbooks • A. Doboli, E. Currie, "Introduction to Mixed-Signal Embedded Design", ISBN: 978-0-9814679-0-0, 2008 (www.cypress.com/cua/) • D. Van Ess, E. Currie, A. Doboli, "Laboratory Manual for Introduction to Mixed-Signal Embedded Design", ISBN: 978-09814679-1-7, 2008 (www.cypress.com/cua/) ©Alex Doboli 2008 Presentation Structure • Requirements of modern embedded systems • Supporting technology (reconfigurable SoC & design tools) • Introduction to ECE • Design of embedded, mixed-signal systems • Senior design project (Hofstra University) • Conclusions ©Alex Doboli 2008 Requirements of Modern Systems Signal sensing/data acquisition – data processing & data storing – actuation – data communication (networking) ©Alex Doboli 2008 Requirements of Modern Systems A: Integrated mixed-domain electronic systems: – Integrated signal acquisition, processing, control & actuation – Co-design of analog, digital, firmware, and software Sensing front-ends – Challenges: Background on analog, digital, high-level programming, firmware, compilers, and OS ©Alex Doboli 2008 Requirements of Modern Systems (cont’d) B: Reconfigurable systems: – PSoC: digital, analog, I/O ports, interconnect, supply & clock – Customize architecture to produce performance optimal design • precision, speed, real-time, energy/power consumption, cost, reliability, etc. – Challenges: • complex performance and trade-offs in analog, digital and software • circuit nonidealities and nonlinearities • difficult system integration and testing C: Networked systems: – Efficient data transfer among networked embedded systems – In PSoC: SPI, UART, I2C, PCI, USB, etc.. ©Alex Doboli 2008 Requirements of Modern Systems (cont’d) • Mixed-domain embedded systems involves broad knowledge: – Industry feedback suggests that knowledge is acquired primarily as industry experience over a long period of time – Difficult to understand the cross-disciplinary issues that in designing modern embedded applications • Currently provided by unrelated EE, CE & CS disciplines – Reconfigurable platforms & Visual Programming tools help focusing on system and network of systems design • Used for introductory courses (no assembly or C programming) ©Alex Doboli 2008 PSoC Mixed-Signal Array (Cypress) ©Alex Doboli 2008 Visual Programming in PSoC Express Visual Programming: – Emphasis: designing the structure of an implementation rather than representing that structure in a programming language – Compositional development rather than procedural algorithms – Programming: identifying the building blocks and then interconnecting the blocks to produce the data flow of the application Advantages: – Reuse – Less emphasis on data structures – Programs are illustrative, easy to understand and modify ©Alex Doboli 2008 Visual Programming in PSoC Express • Mechanism: – code libraries for pre-defined and tested software modules – Input/output, signal conversion/processing and networking functions • Operates above Cypress’ PSoC Designer: – PSoC Designer which transparently “builds” an executable • Device library: – Input: acceleration, airflow, CapSense, distance, expanders, humidity, light sensors, pressure, remote devices, resistance, temperature, etc. – Output: banked I/O, digital output, display, expanders, fans, high brightness LEDs, PWMs, I2C slave/master, wireless USB, etc. • Control logic: – – – – – table lookups, FSM, priority encoders, status encoders, etc. Process: selects I/O devices, sets up FSM, etc. (functionality) Simulation: designer can test the system’s logic “Build” command: creates the associated firmware Designer selects the target hardware and makes the pin assignments ©Alex Doboli 2008 Visual Programming in PSoC Express • PWM motor controller: – Input: potentiometer – Output: PWM – Functionality: Priority encoder to implement the necessary I/O transfer function: If-Then-Else statements for logic – I2C slave interface to monitor the design from a PC ©Alex Doboli 2008 Introduction to ECE (freshman) • Goal: – Introduce basic theoretical and engineering concepts and demonstrate them through hands-on experiments • Challenges: – System vs. circuits – Relevant details without loosing focus – Variety of concepts (signals, circuits, algo’s, etc.) – Digital, analog (software?, networking?) – Hands-on experiments? ©Alex Doboli 2008 Introduction to ECE • Objectives: – Signals, data, performance constraints, trade-offs – Sensors, basic circuits in analog frontends, digital circuits – Embedded software, networking, web applications ©Alex Doboli 2008 Introduction to ECE (Lectures) • Introduction (1 week): – Applications (telecom, manufacturing, automotive, gaming, etc) • System description (3 weeks): – – – – Electrical signals (currents, voltages, conservation laws) Digital data & analog-digital conversion Basic system modules (e.g., frontends, processor, memory etc.) Performance (speed, cost, power, etc.) & design trade-offs (cost – speed – power/energy) • Sensing front ends and actuation (3 weeks): – Analog front ends, basic sensing principles (temperature, capacitive sensors, GPS, RFID, imagers), signal conditioning, filtering, ADC – Parameters: gain, stability, bandwidth, precision, etc. • Embedded processing (4 weeks): – Data processing in hardware and software – Counters, logic gates and other digital circuits used to detect events – Real-time algorithm (variables, instructions, programming, etc) • Networks of systems and web programming (2 weeks): – Main networking concepts – Simple web applications (HTML, JavaScript, SQL, security) • Future trends (1 week) ©Alex Doboli 2008 Introduction to ECE (Lab) • System description (2 weeks): – Specification of the real-time temperature mapping system, including functionality, and performance constraints in PSoC Express • Sensing front ends (5 weeks): – – – – Interfacing temperature sensors to PSoC Measuring the sensor output voltage Plotting the characteristics of the sensor Connecting the sensor to an amplification stage based on PSoC’s reconfigurable analog blocks – Changing the amplification of the block – Connecting an ADC to the front-end – Relating the digital data to the observed ADC waveforms and to the sensor voltage output • Embedded processing (5 weeks): – Building a counter module using the reconfigurable digital PSoC blocks – Developing a simple C program for PSoC’s microcontroller – Connecting the counter to the microcontroller. • Networks of systems and web programming (2 weeks): – Transmitting data to, and from, a central server to embedded boards – Writing a simple web program to display the temperature map ©Alex Doboli 2008 Design of Mixed-Signal Embedded Systems • Goal: Fundamental concepts and skills on designing and building embedded systems: 1. Integrated presentation of analog, hardware, software & netw. 2. Performance & cost optimized through trade-off analysis 3. Implementing embedded systems on reconfigurable platforms • Specifics: 1. High-level specifications express abstract data flow for signal acquisition and conversion, control procedures & actuation 2. Examples in C language 3. Comprehensive treatment of design trade-offs, trade-off formulation & analysis: • Speed, cost, power consumption, and precision • Different design solutions for each targeted performance 4. Emphasis on performance modeling ©Alex Doboli 2008 Design of Mixed-Signal Embedded Systems • Applications based on SoC: – Implementing new functionality (e.g., data encryption) – Developing new interfacing capabilities (AMS frontends) – Improving performance by customizing the reconfigurable analog and digital hardware of the SoC • Expected Outcomes: Students learn to – Utilize combination of analog and digital modules and develop software drivers for interfacing new devices – Develop system-level designs including specification, profiling, debugging & trade-off exploration/optimization – Customize the reconfigurable architecture for implementing new functionality and obtaining better performance ©Alex Doboli 2008 Design of Mixed-Signal Embedded Systems • Challenge: – Proper presentation “interface” between EE, CE & CS topics – Common ground for students with different backgrounds – Liaison for topics covered in more traditional courses • Abstraction levels: – – – – Analog: macromodels with nonidealities and nonlinearities Digital: FSM and basic blocks (registers, adders) Microcontroller: instruction set architecture level Software: three-layer structure – assembly, API routines, C • Advantages: – Theoretical signal representation, sampling, quantization, precision, feedback, model composition, modularity, hierarchy – Electronic issues for speed-precision-cost-power trade-offs – Impact of circuit nonidealities on operation and performance ©Alex Doboli 2008 Design of Mixed-Signal Embedded Systems • Integrated presentation of analog, digital & software: – Analog signals at I/O ports, analog signal conditioning, filtering, ADC, interrupt service routines, digital signal processing, firmware, software for control, and actuation by PWM’s and power transistors ©Alex Doboli 2008 Design of Mixed-Signal Embedded Systems • Identification & formulation of inter-domain performance trade-offs: – Cost-accuracy-speed-energy/power consumption trade-offs in mixedsignal design: • signal bandwidth – conversion accuracy – software latency • cost – speed (hardware-software partitioning for speed) • flexibility – speed (addressing modes & data mapping to memory) ©Alex Doboli 2008 Design of Mixed-Signal Embedded Systems Chapter 1. Introduction (1 week) • Types of embedded applications • Importance of performance requirements for design • Summary of mixed-signal embedded architectures • Top-down design flow (Design refinement. Performance modeling. Testing) Chapters 2&3. Mixed-signal embedded SoC architectures (3 weeks) • Mixed-signal SoC architectures • Microcontroller core. Instruction set • Memory system • Interrupts • I/Os. ISR and drivers ©Alex Doboli 2008 Design of Mixed-Signal Embedded Systems Chapters 4 &5. Digital subsystem (3 weeks) • • • • Principles of RTL (Register Transfer Level) design Basic digital building blocks (timers, counters, CRC generator) Dynamic reconfiguration Developing application specific co-processors using reconfigurable architectures Chapters 6&7. Analog building blocks (2 weeks) • • Basics of switched capacitor analog circuits Presentation of basic building blocks (ideal op amps, comparators, gain stages, integrators) ©Alex Doboli 2008 Design of Mixed-Signal Embedded Systems Chapter 8&9. Analog filters and converters (3 weeks) • Filter characteristics • Filter types • Circuit non-idealities and their impact on filter performance • Mapping filters to building blocks) • Analog to digital converters (ADC characteristics. DS ADC) • Digital to analog converters Chapter 10. System level trade-off analysis (2 weeks) • System performance modeling • Trade-offs • Trade-off analysis (cost – speed – power/energy consumption – number of pins) • System optimization ©Alex Doboli 2008 Design of Mixed-Signal Embedded Systems • 12 lab sessions of 3 hours each • Underlining theme: Constructing a temperaturecompensated, fan controller • Motivation: – Typical examples of projects an engineer will design when employed in industry – Incorporate analog, digital and software design – Introduce some basic control theory concepts – Require the use to several different types of digital serial communication protocols ©Alex Doboli 2008 Design of Mixed-Signal Embedded Systems • Grading based on 3 projects: – Vending machine controller, encryption, networked temperature controller ©Alex Doboli 2008 Developed Teaching Material • A. Doboli, E. Currie, "Introduction to Mixed-Signal Embedded Design", ISBN: 978-0-9814679-0-0, 2008 (www.cypress.com/cua/) • D. Van Ess, E. Currie, A. Doboli, "Laboratory Manual for Introduction to Mixed-Signal Embedded Design", ISBN: 978-09814679-1-7, 2008 (www.cypress.com/cua/) ©Alex Doboli 2008 Senior Design (Hofstra University) • Goal: Alert system that reacts to animals left in parked cars under high temperature Armed LED Remote Start Signal Temperature Sensor Disarmed LED Alarm Start Relay Controller (PSoC) Motion Sensor Remote Start Relay Strobe Light Relay Arm Signal Disarm Signal Detect high temp in parked cars AC Relay Generate warning signals ©Alex Doboli 2008 Senior Design (Hofstra University) • PSoC Express: • Functionality: ArmSignal = ON DISARM DisarmSignal = ON ARMED DisarmSignal = ON Temp>38oC and Motion > 80% ALARMED DisarmSignal = ON RESET ©Alex Doboli 2008 Senior Design (Hofstra University) • PSoC Express: • Design completed in short time (prototyping) • Cross-disciplinary (analog, voltages, etc.) • Focus on system design ©Alex Doboli 2008 Conclusions • Complete course material for a one-semester course: – Senior undergraduate and first-year graduate students in ECE – To be published as a textbook – Also available at www.cypress.com – Evaluation copy please contact cuap@cypress.com • Goal: Teach fundamental, theoretical concepts and practical skills on designing and building embedded systems: 1. Integrated presentation of analog, digital & software 2. Performance & cost optimized through trade-off analysis 3. Implementing on PSoC reconfigurable platform ©Alex Doboli 2008