EE345M Embedded and Real-Time Systems Lab (3/07/11 version)
EE380L.6
 Real-time Operating Systems
Credit for both EE345M and EE380L.6 will not be allowed. Graduate students should register for EE380L.6 and undergraduates should register for EE345M.
Class
: ACA1.104, Monday, Wednesday, Friday 11-11:50am
Office Hours: Tuesday 12-1pm, Wednesday 10am-10:45, Friday  1-2pm
Instructor: Jonathan W. Valvano, ENS627, 471-5141
email valvano@mail.utexas.edu   (put "EE345M" or "EE380L" in the email title)
Web page http://users.ece.utexas.edu/~valvano 
Unique Numbers, Lab ENS252A:
16620 16930 MW 9:30AM-11:00AM
16625 16935 MW 12:30PM-2:00PM
16630 16940 MW 2:00PM-3:30PM
16640 16950 TTh 6:30PM-8:00PM
Text: none
Optional reference Text: MicroC/OS-III: The Real-time Kernel, Third Edition, Jean J. Labrosse. This is a nice book, but it cost $200 and includes a STM32 board (not our board, but similar). It covers general OS topics, explains the use of MicroC/OS-III and includes details of the M3.  There is also a second edition MicroC/OS-III that is both a book and a board. The 3rd edition is nicely written but specific for the MicroC/OS-III.
Great TAs
:                 

Raffaele Cetrulo, rcetrulo@mail.utexas.edu
Karthik Sankar, krsankar@mail.utexas.edu 
EE445L TAs:                 
Justin Capogna, jcapogna@gmail.com  
Arindam Goswami, goswamiarindam@gmail.com
Jungho Jo, jungho.jo@mail.utexas.edu
Lecture notes and lab manual http://users.ece.utexas.edu/~valvano/EE345M/ 
Development board: On about Feb 1, we will pass out the TI Stellaris LM3S8962 development kit    Each student will get one kit to keep. If you destroy it or loose it, you will be responsible for buying a replacement costing about $89 plus shipping.
Reference materials: Data sheets for most of the devices used in this class are available as pdf files on the class website. See     http://users.ece.utexas.edu/~valvano/Datasheets  Data sheets for devices used in EE319K, EE345L EE345M and EE380L.6
    http://www.keil.com/uvision/ Information about the compiler/debugger system
We will use 32-k limited version of the Keil uVision4 see http://www.keil.com/arm/mdk.asp   Download it.  A large number of software examples for the LM3S8962 will be available by installing the StellarisWare(R).
Old Exams
http://users.ece.utexas.edu/~valvano/EE345Moldquiz/ 
Other references: For programming in C, see the EE312 text, or C programming book
Prerequisites: EE345L or EE345S. This class is the third in a sequence of three microcontroller laboratories. I expect you to have experiences with assembly language, serial ports (SCI and SPI), periodic interrupts, ADCs, edge triggered interrupts, FIFO queues and C programming.  We will be using the Arm Cortex-M3, and we expect the prior experiences for most students would have been with a different microcontroller. You are also expected to understand how the DFT is used to observe digitally sampled data in the frequency domain.
Teaching philosophy
I strongly encourage students to take an active role in this class.  There will be a copious amount of action in this class: debugging, soldering, screwing, cutting, and testing. Questions are welcome before, during and after class. Please feel free to email, visit or call me if you have questions.
Specific Objectives of EE345M/EE380L.6
The primary objective of EE345M/EE380L.6 is for the students to develop the ability to design real-time systems. This class allows students to combine principles of microcomputer interfacing, software development, digital logic and analog circuits into the design of microcomputer-based systems.
ARM architecture, and C programming
    Minimally intrusive debugging
    Performance measures
Synchronization methods
    Busy-wait, interrupt, DMA, periodic polling, priority interrupts
Embedded Communication Systems
    Serial network protocols, layered software, CAN, Ethernet, and USB
Real time operating systems
    Foreground and background thread scheduling
    Synchronization using spinlock and blocking semaphores
    Interthread communication
Digital Device Interfaces
    SD drive interface using SPI, file systems
    Diodes, transistors, DC motors, servos, stepper motors, relays, solenoids,
    Optical sensors, IR distance sensors and contact switch sensors
Time Domain Interfaces
    Input capture/output compare, frequency, period and pulse width measurements,
    Pulse-width modulation
Data Acquisition Systems
    Op amp amplifiers, analog low pass filters, ADC, FIFO queues, digital filters
Control systems
    Open loop and closed loop, Linear and Nonlinear,
    Bang-bang control, incremental control, PID Control
The purpose of EE345M/EE380L.6 is to provide students an in depth understanding of real-time operating systems, real-time debugging, and embedded systems. After the successful conclusion of EE345M/EE380L.6 students should be able to design real-time embedded systems, such as motor controllers, data store systems, data acquisition systems, communication systems and robotic systems.
Attendance: Students are expected to attend all lectures, which are at 10 o'clock in the morning.  Since there is no book, fundamental material will be presented in class, and the details can be found in data sheets and library files provided by the manufacturer. Some lecture material will be posted on the web, while other lecture material  will only be presented in class.   If you decide that you do not want to come to every lecture, please drop this class.
EE345M Grading: 40% Laboratory
    15% Quiz1, closed book, Friday February 25, 11-11:50am, in ACA1.104
    15% Quiz2, open book, open book, Friday April 1, 11-11:50am, in ACA1.104
    30% Final, part closed book part open book, Monday May 16, 2-5pm, regularly scheduled
Please notice the dates for the exams; there will be no re-tests, make-ups, or incompletes. Class attendance will be used for deciding grades in borderline cases. I will not use A- grades, but otherwise I plan to use +/- grading. I have no expected grade cutoffs or expected GPA for this class. You can view the previous GPA for classes at UT at www.MyEdu.com. This web site reports I give a GPA in EE345M of 3.48.  All professors want a 5 on their teaching evaluation, and all students want an A. However, I feel both should only be awarded for excellence. 
EE380L.6 Project: The graduate student will attend the lectures, take the exams, and perform the labs. In addition to all the regular EE345M assignments, the graduate student will design, build, debug, and document an extra lab project involving the design, implementation and testing of an embedded system with a real-time operating system. The complexity of this project should be equivalent to one of the regular labs. The project  should be approved in advance by the instructor. A 1/2 page written proposal concerning the project is due by the end of February. The project must be demonstrated to a TA by the last class day of the semester. Project report is due to the instructor the first Monday after classes are over. You are free to choose a project in your field of interest. It must include an embedded system and a real-time operating system of your design. You must write microcomputer software and/or build microcomputer hardware. It must actually be built and tested. The report will be typed double spaced. The minimum page count is 15 and the maximum page count is 20 (including hardware diagrams, but not software listings.) The grading policy for the report has four parts:
    25% English style, grammar, spelling, clarity of discussion, objectives
    25% Neatness, hardware diagrams, data flow graphs, call graphs
    25% Engineering quality, how well it works, creativity, correctness
    25% Evaluation and test procedures, how do you verify its correctness.
EE380L.6 Grading: 
    80% Regular EE345M grade
    20% Project 
Lab Partners: All labs should be performed with a partner. The lab partnership must be registered with your TA (a simple hand written note signed by both students will suffice) at least a week before the assignment is due. Once registered, the partnership will continue. A partnership can be dissolved only after discussion with the TA. Both partners must be present during the demonstration. It is expected that both partners will contribute to all aspects of each lab, and both partners are expected to be present during the check out. The point values are the same for all labs. The TA will sign your software listing when you demonstrate your system. All parts of the assignment must be demonstrated to a TA by the end of your lab period the week shown in the column labeled "Demo/Report". Any EE345M/EE380L TA is authorized to checkout your lab.  The report (hardware, software, data and plots) are due one day after the demonstration is due. Please consult with your TA for specific due dates for your lab section.
EE345M/EE380L Laboratories (1/15 version)
1. Real-time clock, oLED Display, ADC and serial port drivers on the LM3S8962 board running on an Arm Cortex-M3 (review of EE345L)
2. Real-time operating system kernel (thread switching and synchronization)
3. Blocking semaphores, priority scheduling, performance measures, dumping RTOS profile data to the PC
4. Microphone input, digital filters, FFT, display spectrum on the oLED
5. Solid state disk, SPI, address translation, layered software, file system
Formula 0001 Racing Robot  (teams of 3, 4 or 5)
6. Distributed data acquisition using a controller area network (CAN) of IR distance sensor, Ping))) distance, wheel RPM 
7A. Moving and turning, PID control
7B. Sensor design and interfacing
7C. Control algorithm, system performance analysis
 

Lab Schedule

Week

First session

Second session

Friday 10am

Comments

1/17

none

none

 

no lab activities

1/24

Meet the TA,

1 PrePrep, Select partners

 

Keil uVision4 demonstration

1/31

1 Prep

 

 

Spectrum analyzer demo

2/7

1 Demo 

2 Prep

1 Report

 

2/14

 

 

 

 

2/21

 

2 Demo 

 

2 Report

Quiz 1 is 2/25

2/28

3 Prep

 

 

 

 

3/7

3 Demo 

4 Prep (bonus)

3 Report

4 Prep (on line)

There is a hard deadline on Lab 3. If Lab 3 is not demonstrated by second session, revert to Lab 2 and complete rest of labs with Lab 2 OS.

3/21

4 Demo

5 Prep

4 Report

 

3/28

5 Demo 

6 Prep

 

Quiz 2 is 4/1

4/4

5 Report

6 Demo 

6 Report

 

4/11

 

7A Prep

 

 

4/18   7A Demo  

 

4/25

 

 

7B Demo

 

5/2

 

7C Demo

7C Report

Turn in equipment by 5/6

No lab 1/19-21

Prep = you turn in your lab preparation
Demo = you demonstrate your lab to the TA
Report = you turn in your complete lab report to the TA

Lecture Schedule (rough draft)  

Week

Topic

1/19

Modular programming, call graphs, synchronization, data flow graphs, show differences between busy-wait and interrupt synchronization, uVision4 compiler, device drivers, quality software, friendly

1/24

Arm architecture, instruction set, stack, interrupt servicing, lab environment, debugging techniques, intrusiveness, monitor, output to scope, simulator, periodic interrupts

1/31

RTOS,  threads, TCB switching, spinlock semaphores, draw initial TCB, performance measures (response time, throughput), use of the FIFO, and thread communication,

2/7

Blocking semaphores,  add cooperative multitasking priority scheduling, debugging 

2/14

Critical sections, debugging of the RTOS, time jitter, microphone interface, rail-to-rail single supply circuits 

2/21

Analog filters, Digital filers, FFT, graphics

F 2/25

Quiz 1 in ACA 1.104, covering material in Labs 1, 2, 3

2/28

DFT, windowing, SD interface using SPI,  DMA

3/7

DMA, File system

3/21

Controller area network, FIFO queue, layered software

3/28

Transistor interfaces (TIP120, L293, IRF540), motor interfacing, Pulse width modulation,  Input capture, simple period measurement,

F 4/1 Quiz 2 in ACA 1.104,  covering material in Labs 1, 2, 3, 4, 5

4/4

Control systems, PID control systems

4/11

Fuzzy logic, Fixed rate scheduler

4/18

MicroC/OS-II, Vxworks, effect of sampling jitter,

4/25

Team work, testing and the design process

M 5/2

course review and evaluation

W 5/4

Robot preliminary competitions 3rd floor ENS

F 5/6

Robot final competitions 3rd floor ENS

F 5/6

all Lab notebooks are due to the TA  

F 5/6

Turn in Lab Equipment so that we won't bar your registration

5/16

Final exam, Monday, 2-6pm, Time/place regularly scheduled

     No lab activities occur during the week of January 19.  During the week of January 24-27, please go to your scheduled lab sessions in ENS252C to get a demonstration of the lab equipment.  We will be using the TI TI Stellaris LM3S8962 development kit this semester. It will be extremely convenient for both partners to have a working board.  Each student will get exactly one board on about Feb 1. If you loose it or destroy it, you can purchase another from Keil.  For more information on purchasing a replacement kit, go to the TI web site listed above. Lab partners will be selected in your lab the week of January 24-27. The Lab 1 preparation is due at the beginning of your second lab session the week of February 1.  The lab preparations (hardware diagrams and syntax-free software source code printouts) are due at the beginning of your lab period. In other words, please type your software into the PC before lab. Attendance in lab is required. All software for lab, and tests must include comments. All hardware must include R&C values specifying tolerance and type (e.g., 5% carbon), and chip numbers (be very specific e.g., OPA2350PA). Pin numbers are required only for lab, not for the exams.
    Students are encouraged to go to the last 1 hour of the other lab periods, but the first priority will be to the regular students. During the first 15 minutes of lab, the TA will collect preparations. For the next 15 minutes, the TA will lead a lab discussion session. The remaining lab time is available for debugging and lab checkout. At the end of the semester please verify with the checkout counter that your record is clear. All reports must be given to the TA by Friday May 6, 5pm.

Sections from the EE345L book that might help with the labs

1.6. Digital Logic And Open Collector
2.11. Debugging Strategies
4.5.4. 6812 Interrupt Vectors And Priority (Review)
7.6. SCI Interrupt Interfaces
7.7. SPI Interfaces
Lab Example SCI12.H SCI12A.C (Review)
8.4. Transistors Used For Computer Controlled Current Switches
8.5.5. Pulse Width Modulated DC Motors
8.5.6. Interfacing EM Relays, Solenoids, And DC Motors
Figure 8.70 (IRF540, 6N139)
6.2.1. General Concepts
6.2.2. Output Compare Details
6.2.3. Periodic Interrupt Using Output Compare (Review)
6.2.5. Pulse Width Modulation
6.1.1 Basic Principles Of Input Capture
6.1.2. Input Capture Details
6.1.3. Real Time Interrupt Using An Input Capture
6.1.4. Period Measurement (Not 32-Bit)
6.4.1. Using Period Measurement To Calculate Frequency
5. Threads
14.1., 14.3 CAN Network
15. Digital filter fundamentals, design, implementation and analysis
Covered on the exams, but not necessary for the labs
6.1.5. Pulse Width Measurement
6.3. Frequency Measurement
6.3.1. Frequency Measurement Concepts
6.3.2. Frequency Measurement with frequency resolution of 100Hz
6.5. Measurements Using Both Input Capture And Output Compare
6.5.1. Period Measurement with period resolution of 1ms
6.5.2. Frequency Measurement with frequency resolution of 0.1Hz
11.2.7.5 Subtraction Circuits
11.2.7.6 Instrumentation Amp (AD620)

Legal Stuff: The 12th class day is February 2. The drop policy has recently changed. See your academic advisor or the Dean of Students for more information. Course evaluation is conducted on the last class day in accordance with the Measurement and Evaluation Center form. The final exam is at the time and place stated in the course schedule. The University of Texas at Austin provides upon request appropriate academic adjustments for qualified students with disabilities. Students with disabilities may request appropriate academic accommodations from the Division of Diversity and Community Engagement, For more information, contact Services for Students with Disabilities, 471-6259, http://www.utexas.edu/diversity/ddce/ssd/. March 28 is the last day an undergraduate student may, with the dean’s approval, withdraw from the University or drop a class except for urgent and substantiated, nonacademic reasons.

Scholastic dishonesty:
"Faculty in the ECE Department are committed to detecting and responding to all instances of scholastic dishonesty and will pursue cases of scholastic dishonesty in accordance with university policy. Scholastic dishonesty, in all its forms, is a blight on our entire academic community. All parties in our community -- faculty, staff, and students -- are responsible for creating an environment that educates outstanding engineers, and this goal entails excellence in technical skills, self-giving citizenry, an ethical integrity. Industry wants engineers who are competent and fully trustworthy, and both qualities must be developed day by day throughout an entire lifetime. Scholastic dishonesty includes, but is not limited to, cheating, plagiarism, collusion, falsifying academic records, or any act designed to give an unfair academic advantage to the student. The fact that you are in this class as an engineering student is testament to your abilities. Penalties for scholastic dishonesty are severe and can include, but are not limited to, a written reprimand, a zero on the assignment/exam, re-taking the exam in question, an F in the course, or expulsion from the University. Don't jeopardize your career by an act of scholastic dishonesty. Details about academic integrity and what constitutes scholastic dishonesty can be found at the website for the UT Dean of Students Office and the General Information Catalog, Section 11-802." 
You are encouraged to study together and to discuss information and concepts with other students. You can give "consulting" help to or receive "consulting" help from such students in oral form. However, this permissible cooperation should never involve one student having possession of a copy of all or part of work done by someone else, in the form of an email, an email attachment file, a portable storage device, or a hard copy. Copying of any part of a program is cheating without explicit reference to its source. If we find two programs that are copied, there will be a substantial penalty to both students, e.g., failure in the course. Students who cheat on tests or in lab will fail. Prosecution of cases is very traumatic to both the student and instructor. It is appropriate to use software out of the book, class website as long as all copy-pasted software is explicitly referenced. Copy-pasting software from current or past EE345M students is scholastic dishonesty. Policies concerning the use of other people's software in this class:
    · I strongly encourage you to study existing software.
    · All applications and libraries must be legally obtained. E.g.,
        You may use libraries that came when you bought a compiler.
        You may use software obtained from the web.
        You may copy and paste from the existing source code.
    · You may use any existing source code that is clearly referenced and categorized:
        original: completely written by you,
        derived: fundamental approach is copied but it is your implementation,
        modified: source code significantly edited to serve your purpose,
        copied: source code includes minor modifications.

The University Honor Code is "The core values of the University of Texas at Austin are learning, discovery, freedom, leadership, individual opportunity, and responsibility. Each member of the University is expected to uphold these values through integrity, honesty, trust, fairness, and respect toward peers and community."  http://registrar.utexas.edu/catalogs/gi09-10/ch01/

Many manufacturers will send free samples to students. There are no required parts you need to sample in EE345M this semester, so this information is for reference only. Devices come in many sizes and shapes. So, when requesting samples be sure to specify the package you want: big surface mount, tiny surface mount, or DIP.   You will need register with an official University email address (e.g., YourName@mail.utexas.edu) rather than a junk email address (e.g., aol.com or gmail.com)
Analog Devices http://www.analog.com/en/index.html
Maxim http://www.maxim-ic.com/
Texas Instruments http://www.ti.com 
SamTec
http://www.samtec.com/  Click Samples, register

Cool chips, but not needed Spring 2011
AD8032ANZ  rail-to-rail dual op amp

MAX1247ACPE+ 12-bit ADC, such as the  (A or B, with or without +)

MAX492CPA rail-to-rail dual op amp  (any plastic DIP, with or without +)

MAX494CPD rail-to-rail quad op amp  (any plastic DIP,  with or without +)

MAX539ACPA single 12-bit SPI interface DAC (ACPA or BCPA)

MAX6225ACPA+  2.500V analog reference (with or without +) (ACPA or BCPA)
MAX5154ACPE dual 12-bit SPI interface DAC (ACPE or BCPE)

TLC2272ACP rail-to-rail dual op amp
TLC2274ACN rail-to-rail quad op amp
INA122P rail-to-rail instrumentation amp
OPA2350PA rail-to-rail dual op amp
LM4041CILPR adjustable shunt reference

SD-115-G-2 (could use two for LM3S8962 Board)

SD-110-G-2 (could use two for LM3S2110 Board)


Places to buy prototyping boards and other parts
In Austin

AlTex Electronics 832-9131
Frys Electronics 733-7000
Radio Shack multiple

Internet sales

BG Micro, Dallas http://www.bgmicro.com/         Freescale http://www.freescale.com/
All Electronics, Los Angeles http://www.allelectronics.com/   Technological Arts http://www.technologicalarts.com
Digikey http://www.digikey.com/   Maxim http://www.maxim-ic.com/
Mouser Electronics www.mouser.com   Fairchild http://www.fairchildsemi.com/
Jameco, Belmont CA http://www.jameco.com/   Texas Instruments http://www.ti.com/

Curious about my research? See
http://users.ece.utexas.edu/~valvano/research