ECE 473 - System Design with Microcontrollers
CRN 14453 - Fall 2013


Lecture:
  Tuesday, Thursday 8:30-9:50 am; STAG 323

Lab:
   W 1100-1350 : Ben(11-2), Shijia (12-2)
   R 1000-1250 : Ben(10-1)
   F 1100-1350 : Ben(11-2), Shijia(12-2)

(Note: "NOSPAM" = "orst")
Instructor:
  Roger Traylor
  Office: KEC3095
  E-mail:traylor@ece.NOSPAM.edu
  Office Hours: Tu, Th 3:30-5:00 or by appointment

TAs:
  Ben Buford
  Office: DB203
  E-mail:bufordb@engr.NOSPAM.edu
  Office hours by email appointment

Shijia Lin
  Office: DB203
  E-mail:linshi@onid.NOSPAM.edu
  Office hours by email appointment


About This Class

The purpose of this course is to equip students to competently design small embedded microcontroller systems. This course uses a microcontroller system as a component in electronic system design. The Atmel ATMega128 microcontroller provides extensive I/O and peripherals. Therefore this microcontroller will be considered to be a flexible logic component to be embedded into a system.

This is a design course. This means that you will be expected to show considerable creativity, resourcefulness and persistence. You will need to read long datasheets, improvise around problems, and extract information from obscure sources. You will need to apply material from many of the courses you have already taken. You will have to find solutions on your own from incomplete specifications. Welcome to the real world of design.

There is a considerable reading load for this class. Consider this typical for doing non-trival design work. The number of pages is large and the material can be obtuse. I will not be looking for detailed bit-by-bit details but clear understanding of concepts and how to apply them. Quasiweekly self evaluations may be provided to check your understanding.

Lab assignments will require a detailed design based on a general specifications. Step-by-step instructions are not be provided. Detailed designs will be generated by the student. Complete designs to be graded include C and/or assembly language code, digital and analog circuit schematics, and documentation.

I will expect your in-class participation. Some of you will have innovative solutions and approaches that need to be shared. Be prepared to voice your opinion, strut your stuff, and show your code.

You may work in groups on homework and projects if you wish. Sharing of design approaches, philosophy, flow charts or coding ideas is strongly suggested. However, sharing of detailed information such as design calculations, or actual code is not approved and will meet with the strongest action that I can bring.

A mail reflector (or group, list) for the class will be established by the beginning of class. The mailgroup is how I communicate with you outside the classroom. It can also be used as an interactive forum where you discuss problems and solutions. Such usage is encouraged. Students who register early for ECE473 are automatically added to the class mail list. You may initially not be on the if you register late. You should be added within a day or so. The name of the class list for ECE473is: ece473-001-f13@engr.NOSPAM.edu (NOSPAM = orst). You will not be able to post to this list from any other than your engr account.

Where ever you do your code development, back it up. Many sad stories here.

Commit yourself to learning either vim or emacs. To write code, you need to use a programming editor. I can almost guarntee you are surely going to do a lot of programming in your career. So use an efficient tool. So,... don't fight it, once you catch on, you will never go back. I do everything in vim.


Schedule and Assignments


Period Date Lecture Topics Lab Work Reading and
Self Evaluation
1 Tuesday
Oct 1
Intro to ECE473
Intro and Motivation
  -Microcontrollers vs. microprocessors
  -Microcontrollers as logic devices
  -Microcontrollers as reusable hardware
  -Commonly used uCs
  -RISC vs CISC....any difference?
Mega128 Overview
  -ALU
  -Registers and Stack
  -Instruction execution timing
  -Flash, SRAM, EEPROM, External Memory
  -Timers and Counters
  -Interrupts
  -USART
  -SPI
  -TWI
  -A/D Converter/Comparator
Lab 1 - Testdrive the Tools
  -Get everything running and ready to go
  -Due in lab, 10/9-11. (1 wk)
AVR tools for Mac: AVR CrossPack
AVR tools for Linux: (Ubuntu)
AVR tools for other Linux distros (source compile)
USB Programmer in Virtualbox
lab1_code.c
Makefile
ATmega128 Datasheet
  -pgs. 0-11, (upto ALU section)
Microprocessor Reports
  -AVR brings RISC to 8-bit World
Atmel Whitepaper
  -C compiler for AVR
2 Thursday
Oct 3
The vi Editor
An Exercise with vi:   lcd functions.c
Port I/O
  -In, out, bidirect, tri-state modes
  -Pull up and pull down options
  -DC and AC characteristics of ports
  -drive strength in mA
  -hardware interfacing
Vi Help
  -Basic vi help
  -Vim for C programmers
Atmel Application Note
  -Efficient C Coding for AVR
AVR Datasheet
  -pgs. 5-7, Pin Descriptions
  -pg. 318, DC Characteristics
  -pgs. 66-70, I/O Ports
EDN Article
  -About ESD Diodes
Microchip EMC Newsletter
  -What is ESD? (pgs2-3)
Self-Evaluation
  -Self Evaluation - wk1
  -Schematics for self eval
3 Tuesday
Oct 8
Switch Debouncing
  -Switch debouncing techniques
Debugging Techniques
    -Controlability and observability
    -A debugging methodology
    -Code for testing lab 2
Discussion of Lab 2
    -Time multiplexed display and switches
Lab 2 - LED and Pushbutton Interface
  -Add LED display and pushbuttons.
  -Due in lab, 10/23-25
Lab 2 Skeleton code
Example LED display test code
Embedded Muse
  -A Guide to Debouncing
EDN Design Idea
  -A DSP-style debouncer
4 Thursday
Oct 10
GNU Compiler
Assembly Language & GCC
GNU Make
Inclass Exercise
Self-Evaluation
  -Self Evaluation - wk2
5 Tuesday
Oct 15
Lab 1 Code differences
Embedded Programming
  -Writing good embedded code
  -How embedded coding is different
  -Hints on coding
Avr-libc
  Character Operations
  Strings
  Busy-wait loops
  Standard Integer Types
  General Utilities
Printing with a2ps
  -a2ps -P printer lcd.c (default)
  -a2ps -P printer -1 lcd.c (one up)
  -a2ps -P printer -4 lcd.c (four up)
  -a2ps -P printer -1 --font-size=9 lcd.c (9 pt. font)
O'Reilly ONLamp.com
  -Write great code (article only)
Embedded Systems Design
  -Debugging Embedded C
Atmel Applications Journal
  -Programming uCs in C
Electronic Engineering Times
  -C usage in embedded apps
6 Thursday
Oct 17
Interrupts
  -Motivation for interrupts
  -Polling versus Interrupts
  -Priorities and vectors
  -Enable/disable scheme
  -Interrupt latency and timing budget
  -Volatile type modifier
  -GCC optimization levels
  -In class problem
  -Makefile
  -What's Happening?
  -Answer
Avr-libc, interrupts section
Lab 3 Discussion
Lab 3 - Interrupts and SPI
  -Add encoders, bar graph. Using interrupts.
  -TCNT0 setup
  -Due in lab, 11/6-11/8.
AVR Datasheet
  -pgs 15-17, Interrupt and reset handling
  -pgs 11-12, Status register GIE bit
  -pgs 60-62, Interrupts
Embedded in Academia
  -9 ways to break code with volatile
Self-Evaluation
  -Self Evaluation - wk3
7 Tuesday
Oct 22
Serial Peripheral Interface (SPI)
  -Motivation for SPI
  -Clock and data timing
  -Master/Slave Operation
  -SPI Setup
  -How the LCD display uses SPI
  -Inclass exercise
    bar_graph_simple_skel.c
AVR Datasheet
  -pgs. 163-170 SPI
Embedded.com
  -Introduction to SPI
8 Thursday
Oct 24
8-Bit Timer/Counters, TCNT0 & TCNT2
    -Clock sources
    -Modes of Operation
    -Timer and counter modes
    -Asynchronous operation
    -Example of TC0 initialization
    -TCNT0 and TCNT2 differences
Lab discussion
    -Encoder operation
    -Decoder glitches
    -How to "scope out" SPI transactions
In-class Programming Work
    broken shift register
    bar_graph_demo_skel.c
    bar_graph_demo.c
AVR Datasheet
  -pgs. 93-111 TCNT0
  -pgs. 145-160 TCNT2
Atmel Application Note
  -AVR130 Setup and use of AVR Timers
AVR Freaks
  -DN024 Timer/Counter Basics
Self-Evaluation
  -Self Evaluation - wk4
9 Tuesday
Oct 29
16-Bit Timer/Counters TCNT1, TCNT3
  -Clock sources
  -Modes of Operation
  -Setting up Timer/Counter 1, 3
  -Multi-tasking a timer/counter ISR
Lab 4 - Alarm Clock
  -Make a alarm clock.
  -lcd helper code(example only)
  -header file for above
  -Due in lab, 11/20-22.
AVR Datasheet
  -pgs. 112-142 TCNT1 and TCNT3
  -pgs. 143-144 TCNT1,2,3 Prescalers
10 Thursday
Oct 31
Inclass coding - Using timers and counters
  -exercise 1
  -exercise 2 (bonus)
EDN Article
  -Sine waves from uCs
11 Tuesday
Nov 5
Industry Overview
  -2013 Salary Survey
  -Salary Survey of Embedded Developers
12 Thursday
Nov 7
Analog Comparator, ADC
  -ADC background
  -Differential or single-ended
  -Noise cancellation
  -ADC Examples
Inclass coding - ADC voltmeter
adc_skel.c lcd_functions.c lcd_functions.h Makefile
USART
  -Serial communication with RS-232
  -Hardware for RS232 interface (MAX232)
  -Clock generation
  -Frame formats
  -Initialization (baudrate, parity, etc.)
  -Transmission and reception
  -Example code
    -echo PC terminal
    -board comm with IR xcvr
AVR Datasheet
  -pgs. 227-229 Analog Comparator
  -pgs. 230-245 A to D Converter
  -pgs. 54-55 Voltage Reference
  -pgs. 171-197 USART
  -DN021 Using the ADC
Self-Evaluation
  -Self Evaluation - wk6
13 Tuesday
Nov 12
Two Wire Serial Interface (I2C)
  -Features
  -Transmission modes
  -3.3 to 5V interfacing
Lab 5 - Remote Temperature Sensor
  -Make a remote temperature sensor.
  -twi_master.c
  -twi_master.h
  -lm73_functions.h
  -lm73_functions_skel.c
  -thermo3_skel.c
  -uart_functions.h
  -uart_functions.c
  -Due in lab, 12/4-6
AVR Datasheet
  -pgs. 198-226, TWI
Embedded.com
  -I2C overview
  -Newtorking Processor Peripherals with I2C
Phillips Application Note
  -I2C Bidirectional level shifter
  -Phillips I2C Manual
  -Phillips I2C Usage with a uC
14 Thursday
Nov 14
Using EEPROM
Using Program memory for storage
Inclass coding - Thermometer
  thermo3_skel.c
  lcd_functions.c   lcd_functions.h
  twi_master.c   twi_master.h
  lm73_functions_skel.c   lm73_functions_skel.h
  Makefile.thermo3
  all the above in tar file
AVR Datasheet
  -pgs. 19-24, EEPROM Memory
Atmel Application Note
  -Accessing the EEPROM
  -Self Evaluation - wk7
15 Tuesday
Nov 19
Power Management and Sleep Modes
  -ADC Noise reduction mode
  -Minimizing Power Consumption
Reset Sources
  -Watchdog Timer
  -Brownout Interrupt
XDIV/Sleep code
Reset/Brownout code
Watchdog code
Embedded Muse
  -Great Watchdogs
AVR Datasheet
  -pages 52-56, Watchdog Timer
  -page 50, Brownout Detection
Embedded Systems Design
  -Power Management
16 Thursday
Nov 21
Project management with git
  -Into to git
  -Git Quick Reference
  -ProGit
17 Tuesday
Nov 26
JTAG
  -Manufacturing test usage
  -In circuit debugging
  -JTAG for chip programming
Bootloaders
  -Flash memory partitioning
  -Advantages
Lock bits and Fuse bits
  -Lock bits for security
  -Fuse bit functions
Final Project: FM Clock Radio
  -Finish the FM alarm clock radio.
  -si4734.h
  -si4734.c
  -Due 12/13 (Friday of finals week)
Self Evaluation
  -Self Evaluation - wk9
18 Thursday
Nov 28
Thanksgiving Break- No class
  -Enjoy your turkey. Code while you eat.
19 Tuesday
Dec 3
Architecting the Final Project
  -Open discussion of how to approach the final project.
20 Thursday
Dec 5
Project Demonstrations in Class
  -TBA
Class Presentations
  -TBA
Final Project Due Friday
Dec 13, by 5pm
Implied By Design