Secure Computation Laboratory

Professor Marten van Dijk

Advertisment

ECE3411: Microprocessor Applications Laboratory (Fall 2015)

Instructor: Marten van Dijk TA: Syed Kamran Haider

Course Introduction

The basis of sophisticated designs of modern digital systems that appear in products such as automobiles, appliances and industrial tools is the Micro Controller Unit (MCU); a microcomputer optimized for single-chip system design for controlling peripheral devices geared to real-time applications. We will use the Atmega328P microcontroller (from the Atmel MEGA series RISC microcontrollers) in a series of labs to design microcontroller based systems. In particular, we will explain how to read and use the Atmega328P datasheet and how to write self-explanatory C code for interfacing with the MCU and controlling peripheral devices. This includes initializing register values, writing Interrupt Service Routines (ISRs), constructing underlying Finite State Machines (FSMs), and using a task based programming approach based on hardware timers.

Throughout the course students will learn the basics of C (without advanced data structures that involve pointers) and learn how to use C to program a Micro Controller Unit (MCU). This class aims to educate engineering students with little coding background. I.e., as a prerequisite students are expected to have some experience with basic structures such as loops, if-else statements, arrays, etc. (e.g., as used in MATLAB).

This class offers an intermediary course which allows students to prepare themselves for MCU courses which expect students to have real experience with C, e.g., Bruce Land’s course at Cornell. Our goal is to use the new ECE 3431 class as a prerequisite to a to-be-developed advanced MCU applications lab where we will teach the topics including real time OS, networking protocols such as CAN bus and ZigBee, OLED displays, motor control applications and much more.

The class as presented here is the first offering of its kind at UConn: Previous offerings only intended to show students that peripherals can be manipulated/controlled by a MCU, however, Interrupt Service Routines (ISRs) and timers took the backseat and a more advanced understanding of how to program in C was not taught. The class as presented here, which does explain proper task-based programming with ISRs, has been fully developed by Marten van Dijk and Syed Kamran Haider:

  • Marten van Dijk, when hired at UConn in Fall 2013 (without any MCU experience, not even as a student decades earlier...), studied in detail Bruce Land’s open source material in order to prepare himself for teaching a MCU course in Spring 2014. As a result Marten decided to use a filtered down extraction of Bruce’s material and he developed new lab assignments. This work formed the basis for the course as presented here.
  • Syed Kamran Haider, having a Master's degree in Embedded Computing Systems, has an extensive experience in MCU programming and applications design. During his Master at NTNU, Norway, Kamran benefited greatly from TTK4155: Industrial and Embedded Computer Systems Design offered by Jo Arve Alfredsen in Fall 2011. With the wide variety and vast detail of the topics that TTK4155 offers, it has significant contributions towards the development of ECE3411.
Textbook: Elliot Williams, Make: AVR Programming, 2014.

Accessing Instructor's Material

The links below provide the student view of all the taught material. If you are a colleague faculty member, you can email at vandijk@engr.uconn.edu in order to get access to all the pptx, latex, and C source files together with all the solutions (which are omitted from the student view).
However, there is one catch: you need to acknowledge this course by adding (where appropriate) the following footnote to your slide decks:

Moreover, you need to suggest how the course can be improved and share with us the new quiz/final questions or lab problems as developed by you.

Student's Material

The links below provide all the lecture notes, labs and the class/lab quizzes. If you are a student following these lectures and want to get the solutions of the labs/quizzes, you can email at vandijk@engr.uconn.edu to first show what code/solution you have attempted by yourself, and then get the complete solutions.

Preliminary Resources

Before coming to the first lecture/lab:

  • Place the order of your MCU kit and other components mentioned in the Online Ordering List.
  • Make sure to have set up Eclipse/GCC & Atmel Studio; see Tools Setup which explains how to do this for your laptop, you do not have time for installing software during lab!
  • Sign up for Piazza.

Week Date Lecture Lab Textbook Reading Assignment
1 31 Aug Lec1a: Course Outline + Introduction to C-Programming Lab1a: Examples basic C-Programming
2 Sep Lec1b: Microcontroller introduction + General Purpose Digital Output (GPDO) Lab1b: Examples basic C-Programming Continued Ch1.
Ch2. till page 21
Ch2. 3
Ch2. 4
2 7 Sep Labor Day – no classes Labor Day – no classes
9 Sep QUIZ 1: C-Programming TEST 1: Basic C-Programming using Eclipse

Your Fail/Pass the first QUIZ and TEST is a good indicator for being able to successfully complete this course!

  • Courses dropped after Monday September 14th will have a “W” for withdrawal recorded on the academic record.

From now on:

  • You will need to submit a lab report each week Monday summarizing the preceding week’s lab solutions (see syllabus).
  • Each lecture will start with a 5 minute short quiz/question about the reading assignment, posted lecture notes for that lecture, and previous lab.
  • During each lab we will step-wise present (and post at Piazza) solution slides in order to keep the whole class in sync: you will have time to first code up your own answers.
  • Highly Recommended: Write and maintain easy to understand template solutions yourself: This allows you to pick and choose code segments during lab tests.

Week Date Lecture Lab Textbook Reading Assignment
3 14 Sep Class Question
Lec2a: Universal Asynchronous Receiver & Transmitter (UART)
Lab2a: AVR Board Setup (soldering) + LEDs (GPDO) Ch. 5 till page 97
16 Sep Class Question
Lec2b: General Purpose Digital Input (GPDI) + LCD Display
Lab2b: UART (recognizing strings)
Related Files: uart.h, uart.c
Ch2. 6
4 21 Sep Class Question
Lec2c: Interrupt Service Routine (ISR)
Lab2c: LCD + General Purpose Digital Input (GPDI)
Related Files: lcd_lib.h, lcd_lib.c
23 Sep QUIZ 2: GPDO, GPDI, LEDs, UART, LCD TEST 2: GPDO, GPDI, LEDs, UART (no LCD)

Week Date Lecture Lab Textbook Reading Assignment
5 28 Sep Class Question
Lec3a: ISRs + Timer 0 + Task based programming
Lab3a: Non-blocking UART + debounced switches (uses ISR) Ch. 9
30 Sep Class Question
Lec3b: Timers 0, 1, and 2
Lab3b: Non-blocking LCD
6 5 Oct Class Question
Lec3c: External Interrupt + Pin Interrupt
Lab3c: Non-blocking LCD continued Ch. 8
7 Oct QUIZ 3: Main focus: ISRs, Timers, nonblocking UART and LCD, External and Pin Interrupts TEST 3: Main focus: ISRs, Timers, nonblocking UART and LCD, External and Pin Interrupts

Week Date Lecture Lab Textbook Reading Assignment
7 12 Oct Class Question
Lec4a: External Interrupt + Task based programming
Lab4a: Human reaction time + Capture Interrupt Timer 1
14 Oct Lec4b: Review Session Lab4b: Stopwatch
8 19 Oct Class Question
Lec4c: Pulse Width Modulation (PWM)
Lab4c: Stopwatch continued Ch. 10
21 Oct QUIZ 4: Main focus: External Interrupt, PWM, Timers TEST 4: Main focus: External Interrupt, PWM, Timers

We will provide a prediction of your final score based on the average of your last three quiz/lab test scores.

  • Monday November 2nd is the last day to drop the course.

From now on:

  • We will not present any solution slides during lab: You will work on your own solutions during lab time and you can ask the instructor(s) questions and ask for explanations where needed.
  • From Lab6c onwards you are required to be even more independent: We will not lecture the new concepts, you will study the concepts with minimal guidance from the lab problem slides and you will extract information from the datasheet on your own.

Week Date Lecture Lab Textbook Reading Assignment
9 26 Oct Class Question
Lec5a: Analog-to-Digital Conversion (ADC)
Lab5a: PWM Ch. 7
28 Oct Class Question
Lec5b: Analog-to-Digital Conversion (ADC)
Lab5b: ADC Ch. 12
10 2 Nov Class Question
Lec5c: EEPROM + Watchdog Timer
Lab5c: Debugging using Atmel Studio
Related Files: lab5c_files.zip
Ch. 18: p. 387-396
Ch. 19
Ch. 20
4 Nov QUIZ 5: Main focus: PWM, ADC, EEPROM, Watchdog, Debugging TEST 5: Main focus: PWM, ADC

Week Date Lecture Lab Textbook Reading Assignment
11 9 Nov Class Question
Lec6a: Task based programming revisited + Real Time Operating System (RTOS) global understanding
Lab6a: EEPROM + Watchdog + Assembly
11 Nov Lec6b: Real Time Operating System (RTOS) task (process) scheduling Lab6b: Context switching and scheduling of tasks
Related Files: kernel.h
12 16 Nov Lec6c: Real Time Operating System (RTOS) Interactive Process Communication (IPC) Lab6c: Serial Peripheral Interface (SPI) Ch. 16
18 Nov QUIZ 6: Part of the quiz will be about RTOS TEST 6: Part of the lab test is about scheduling and IPC in RTOS (no SPI)

Week Date Lecture Lab Textbook Reading Assignment
23 Nov Thanksgiving Recess – no classes Thanksgiving Recess – no classes
25 Nov Thanksgiving Recess – no classes Thanksgiving Recess – no classes
13 30 Nov Class Question
Lec7a: Advanced Topics
Lab7a: SPI + Digital to Analogue Conversion (DAC)
2 Dec Lec7b: Advanced Topics Lab7b: Two Wire Interface (TWI/I2C) Ch. 17
14 7 Dec QUIZ 7: Main focus: SPI, I2C, DAC, Advanced Topics TEST 7: Main focus: SPI, DAC, RTOS (no I2C)

All material will be tested during a 115 minutes closed book final:

  • Attend the review session in the form of a Q&A during lecture and lab.
  • Come to office hours the day before the final.

Week Date Lecture Lab Textbook Reading Assignment
14 9 Dec Wrap-Up; Q&A Wrap-Up; Q&A
15 14-18 Dec Finals Week Finals Week

Disclaimer: The course schedule is subject to change.