CSCE 336: Embedded Systems
Spring 2023

Instructor

Jeffrey Falkinburg
Computer Science and Engineering
368 Avery Hall
jfalkinburg2@unl.edu
Office Hours:
(See Canvas) via Zoom
and by appointment.

Teaching Assistants

Undergraduate TAs:
See Canvas
Office Hours:
TBD

Course Information

Tuesday Lecture: 9:30-10:45am in Avery Hall 119
Thursday Lecture: 9:30-10:45am in Avery Hall 119
Optional Thursday Lab: 11:00am-12:15am in Avery Hall 119

For detailed information on this course please see the course syllabus in html or pdf format.

Course Description

Embedded Systems are everywhere. Every time you look at your watch, answer the phone, take a picture, or turn on the TV you are interacting with an embedded system. Embedded systems are also found in cars, airplanes, and robots. They far outnumber traditional computers (which also contain embedded processors) and learning to design and program embedded systems is a critical skill that is necessary for many industry and scientific jobs.

In this course you will learn the basics of designing, interfacing, configuring, and programming embedded systems. We will make use of the Arduino platform, which is an inexpensive, popular embedded system used by hobbyists, researchers, and in industry, to implement the techniques learned in class. By the end of the course you will have mastered the basics of embedded system design and programming. This course will help to prepare you for cutting edge careers in industry and research.

Datasheets and other useful documents

Assignments

See the course schedule below for reading assignments and the general topics covered in the course. Unless otherwise noted, assignments are due at the start of class on the due date.

Assignment Due Date
Course Survey Weds, Jan 25th, 5pm
HW 1 (pdf,code) Start of class, Thurs, Feb 2nd
Lab 1 (pdf) Start of class, Thurs, Feb 9th
HW 2 (pdf) Start of class, Thurs, Feb 16th
Lab 2 (pdf, lab2_button_count.ino, lab2_button_count.cpp) Start of class, Thurs, Feb 23rd
HW 3 (pdf,code) Start of class, Thurs, Mar 2nd
Test 1 from prior year: 2019 For review for test on Tuesday, Mar 7th in class
Lab 3 (pdf,Ultrasonic Sensor Datasheet,Servo Datasheet) Friday, Mar 10th (close of business)
HW 4 (pdf,code) close of business, Thurs, Mar 23rd
Project 1 (pdf)
Project Report Template (Word Doc)
Project Report Rubric (pdf)
L298N Datasheet (pdf)
Bitbucket Repos: Tuesday, Mar 21st (end of class)
Checkpoint 1 - "Robot Assembly/Schematic" Tuesday, Mar 21st (close of business)
Checkpoint 2 - "Robot Motion", Tuesday, Mar 28th (end of class)
B-Functionality - "Wall Following", Thursday, Mar 30th (in Lab) Competition, Thursday, Mar 30th (in Lab)
Code and Written Report: Tuesday, Apr 4th, 2023 (beginning of class)
Competition Times
Lab 4 (pdf, Lab 4 Code(Lab4_irq.ino or Lab4_irq.cpp)
End of Class, Thurs, Apr 13th
HW 5 (pdf) close of business, Tues, Apr 25th
Project 2 (pdf)
Checkpoint 1 Code: (test.ino)
Checkpoint 2 Code: (project2.ino, ir_decoder.cpp, ir_decoder.h)
Project Report Template (Word Doc)
Project Report Rubric (pdf)
IR Sensor Datasheet (pdf1,pdf2)
Checkpoint 1 - "IR Decoding", Thursday, Apr 20th (in Lab)
Checkpoint 2 - "Robot Motion with IR Remote", Tuesday, May 2nd (in Lab)
A-Functionality - "Wall Following with Obstacle Avoidance, Thursday, May 11th (in Class and Lab)
Competition, Thursday, May 11th (in Class and Lab)
Written Report, Friday, May 12th by close of business (4:30pm)
Competition Times
Test 2 from prior year: 2019 For review for test on Tuesday, May 9th in class
Lab 5 - Bonus Lab (pdf)
Lab 5 Code(LCD_Starter_Code.cpp, pong.cpp, pong.h)
Joystick Module Datasheet
Friday, May 12th (Close of Business)
For assignments that require electronic code submission, you can do so on Canvas
*Note html versions of assignments may lack some formatting or pictures found in the pdf version.

Recommended Course Books

Marilyn Wolf, Computers as Components, Fourth Edition: Principles of Embedded Computing System Design, 4th ed. Morgan Kaufmann, 2016
Available in the book store or purchase online. Readings from this book are specified in the format Wx.x, where x.x indicates the chapter and subsection.

David Russell, Introduction to Embedded Systems, 2010.
Available for free download when on the UNL campus. Good reference for embedded C programming. Do not print out this book, it is less expensive to order a printed copy than to print it yourself. Readings from this book are specified in the format Rx.x, where x.x indicates the chapter and subsection. Note: this book is specifically designed for the Arduino platform, but there are some differences between the version of the Arduino used in the book and the version we are using in class. So be careful!

Edward Lee and Sanjit Seshia, Introduction to Embedded Systems, A Cyber-Physical Systems Approach, 2011.
Available for free download. Do not print out this book, it is less expensive to order a printed copy than to print it yourself. There are no specific readings from this book, but it is a good reference for those interested in exploring some subjects further.

Brian W. Kernighan and Dennis M. Ritchie, C Programming Language (2nd Edition), 1988. ISBN: 0131103628
A wiki-style C "text book" alternative
Another online C text book
C Frequently Asked Questions from the days of Usenet
Suggested references for those with little prior C programming experience. There are no specific readings from these, but they are good references.

Lab Kit / Equipment List

Please purchase the items listed below. I recommend you check with the EE shop First (SEC 122), all equipment can be purchased online as well. If you look through the homeworks, labs, and projects we will be using many of the items in the following kits.

Course Schedule

Below is an approximate schedule of course topics. These are subject to change, assignments will be announced in class. Readings are recommended and will be added as the semester progresses, so make sure to check back often; however, the best resource for this course is attending class and taking good notes. The course is roughly broken into regular class lectures on Tuesday and Thursday and then lab-style lectures on Thursday where a Labture is specified. Typically during labtures there will be a short topic-specific lecture followed by a hands-on, small group, in class lab assignment.

Week Class Topics Lab Reading
Week 1, Jan 23 course intro, c programming R2.1, R2.2, R2.4
Week 1 Additional Readings: Basic C Types
More on Basic C Types
Bit Operations
More Bit Operations
Fixed width types
Why use uint8_t
C Pre-Processor and Macros
How not to write code and the output (really, try compling it)
Pointers
Function Pointers
Apollo Guidance Computer
Week 2, Jan 30 embedded system design, arduino intro, basic circuit diagrams R2.5, R2.6, R2.7, R2.8, W1.1, W1.2, W1.3
Week 3, Feb 6th instruction sets, registers and mem access, digital I/O Arduinos W2.1, W2.2, R6.*
Week 2 and 3 Additional Readings: Basic circuit elements
How to read a schematic
Arduino Uno R3 schematic
How to read a datasheet
Atmega328 datasheet
Register-based digital I/O
Another register-based digital I/O (just make sure to use bit operations (|=,&=) and not binary value!)
Arduino-function digital I/O
AVR memory map overview (see datasheet as well)
Directly accessing memory/registers with C macros (but for ARM, not AVR)
Directly accessing memory in assembly
Program counter (general info)
Read up on the AVR Program Counter in the datasheet. Reading the program counter is not straight forward, but somtimes necessary.
Week 4, Feb 13 registers and memory, debugging W3.1, R7.*
Week 5, Feb 20 debugging, timers timers and I/O R4.*
Week 4 and 5 Additional Readings: Debugging an Arduino UNO without a debugger
Platform IO Debugging Documentation
Suggestions for debugging ES
More debugging suggestions
JTAG
Another JTAG link
Yet another JTAG link
Viewing assembly output
Arduino build process overview
General info on timers
AVR timers
Week 6, Feb 27 timers and PWM PWM and servos R8.*
Week 7, Mar 6 analog to digital converters (A2D) and review Begin Project 1 Test 1(tentative)
Week 6 and 7 Additional Readings: Read section 16 in the datasheet on the Timer/Counter1 with PWM
Details of Arduino millis fuction (and how it uses Timer0)
Sparkfun PWM
Arduino PWM (including analogWrite)
Wikipedia PWM
Fast versus Phase/Freq Correct PWM
How servos work
More on how servos work
Wikipedia ADC
Sparkfun ADC
More ADC
Week 8, Mar 13 Spring Break 13-17 Mar
Week 9, Mar 20 CPU bus, communication protocols (UART, SPI, RS485) Continue Project 1 A2D W4.1, R10.1 to R10.1.3
Week 8 and 9 Additional Readings: Parallel versus Serial, UART (sparkfun)
Serial Communication (Wikipedia)
Parallel Communication (Wikipedia)
Serial Comms, UART, RS232, RS485
UART (Wikipedia)
UART (sparkfun)
More UART (but beware, code examples for a different processor)
Interfacing a UART to USB-UART converter (TTL, RS232, USB, etc)
SPI (sparkfun)
SPI (wikipedia)
SPI (arduino)
Week 10, Mar 27 Project 1 Competition
Week 11, Apr 3 Begin Project 2
Week 12, Apr 10 interrupts interrupts, communication W3.1.4, W3.2, R9.*
Week 13, Apr 17 I2C, peripherals, sensors, Embedded Operating Systems, power management, embedded algorithms, program optimization, review i2c R10.1.2, W6.1, W6.2, W6.3
Week 12 and 13 Additional Readings: Interrupts
More Interrupts
Interrupts, very broadly (wikipedia)
List of all interrupts on AVR
AVR Libc Interrupt Reference
AVR pitfalls of reentrant code
I2C (warning code examples not for Arduino)
I2C (sparkfun)
I2C (wikipedia)
I2C aka Wire Library (arduino)
Week 14, Apr 24 W5.5, W5.6, W5.7
Week 15, May 1 Working on Project 2 Robot Motion with IR Remote
Week 16, May 8 Project 2 Competition Test 2