ECE 320 · Week 7

Modern Computer: Embedded Systems

How an I2C address byte differs from an SPI chip-select edge.

Week 7 of 10 · Das Frite

ECE 320 · Week 7 · In class

How an I2C address byte differs from an SPI chip-select edge.

ECE 320 · Week 7 · In class

The lab captures one I2C transaction to the DS3231 and one SPI transaction through the MCP3008.

ECE 320 · Week 7 · Lecture

Two buses on one header

  • Ground
  • I2C
  • SPI

Other pins are dimmed. Colours as on the Das Frite pinout, where each pin's name is. The square pad is pin 1.

ECE 320 · Week 7 · Lecture

An I2C transaction

  1. Start: SDA falls while SCL is high.
  2. First byte: a 7-bit address, then one bit for read (1) or write (0).
  3. The addressed device pulls SDA low for one clock: ACK. No device, no ACK.
  4. Data bytes follow, each with its own ACK, then a stop: SDA rises while SCL is high.

Two wires, shared by every device on the bus, with pull-up resistors.

ECE 320 · Week 7 · Lecture

An SPI transaction

  1. The controller drives one device's chip select (CS) to its active level, usually low.
  2. It clocks SCLK; each clock moves one bit out on MOSI and one bit in on MISO at the same time.
  3. When enough bytes have moved, CS returns to inactive.

Every device gets its own CS line. The clock polarity and phase (the SPI mode) must match the device's datasheet.

ECE 320 · Week 7 · Lecture

Getting a clean capture

ECE 320 · Week 7 · Lecture

Linux, or a microcontroller?

Points to LinuxPoints to a microcontroller
Networking, a file system, many processesHard timing in microseconds
Large existing software to reuseInstant start, low standby power
Updates and remote loginSimple, single job, low cost

The proposal argues one stated requirement, not the whole table.

ECE 320 · Week 7 · Lab

Lab

  1. On the logic analyser, capture one I2C transaction to the DS3231 and one SPI transaction through the MCP3008.
  2. Label the address or the chip select and the bytes. Write a one-page proposal that names the two buses the project will use and says, against one stated requirement, why the project needs Linux rather than a microcontroller. Second pass: capture each bus once more and keep the second files in your notes.

ECE 320 · Week 7 · Lab

Lab (continued)

  1. Assemble the lab hand-in: One decoded I2C capture and one decoded SPI capture, each labeled with the address or the chip select and the bytes, and a one-page proposal that names the two buses and the reason the project needs Linux rather than a microcontroller.

ECE 320 · Week 7 · Lab

Hand in

One decoded I2C capture and one decoded SPI capture, each labeled with the address or the chip select and the bytes, and a one-page proposal that names the two buses and the reason the project needs Linux rather than a microcontroller.

ECE 320 · Week 7 · Homework

Homework

ECE 320 · Week 7 · Homework

Turn in

That comparison.

ECE 320 · Week 7 · Read

Read

On the lab site: Module 10, I/O. This week grades the two labeled captures and the proposal.

ECE 320 · Week 7 · Next

Week 8

A mocked bus returns a sample the library asked for.

Arrow keys or space to move, F for full screen, N for speaker notes, Home and End for the first and last slide. Print gives one slide per page.