Skip to main content

Computers, Controllers, and Data Links

Learning Targets​

  • Situation: Correct converter code with corrupted byte order or missing samples.
  • Targets: Registers, data representation, links, buffers and timing.
  • Starting data: Twelve-bit code 1241 from the previous 1 V example.

Data Path and Representation​

  • CPU: Instructions operating on registers and memory.
  • Peripheral register: Hardware interface with possible read/write side effects.
  • FIFO: First-in, first-out storage with finite capacity.
  • Memory-mapped I/O: Register addresses accessed by load/store operations; different semantics from ordinary RAM.
  • Code example: 1241 = 0x04D9; big-endian bytes 0x04 then 0xD9.
  • Alignment: Low/high bit field and status bits explicitly defined.
  • Unsigned N bits: 0 through 2N−12^N-1.
  • Two's complement: −2N−1-2^{N-1} through 2N−1−12^{N-1}-1.
  • Accumulator: 64 × 4095 = 262080; at least 18 unsigned bits.
  • Fixed point: Integer plus agreed scale; floating point with finite significant precision.
  • Timestamp caution: Binary32 exact consecutive integers only through 2242^{24}; microsecond increments eventually lost.
ADC sample register connected through an interface to a CPU, RAM buffers and an output link, with acquisition and transport times marked separately
Figure 1. ADC sample register connected through an interface to a CPU, RAM buffers and an output link, with acquisition and transport times marked separately.

Memory and Scheduling​

  • SRAM/DRAM: Direct storage versus refresh-dependent dense storage.
  • Nonvolatile memory: Retention with endurance, erase and write-latency limits.
  • Polling: Worst-case gap between status checks.
  • Interrupt: Event service with masking, entry and priority delays.
  • DMA: Peripheral/memory transfers with bus and buffer-ownership requirements.
  • Double buffering: Concurrent filling and processing; completion before buffer reuse.
  • Example: 256 samples at 1 kS/s → 256 ms block interval; substantial first-sample waiting time.
  • Coherency: CPU/cache/DMA agreement on current bytes.
Link modelRequired agreementExample duration
SPIPolarity/phase, length, order, selection16 clocks at 2 MHz → 8 µs
I²CAddress, acknowledgment, pull-up, timingAddress plus 2 bytes: 27 clocks at 400 kHz → 67.5 µs
UART 8N1Baud, start/stop format, voltage levels10 line bits per byte
  • Overhead: Selection gaps, commands, start/stop conditions or clock stretching beyond simplified durations.
  • UART example: Two bytes/sample at 1 kS/s → at least 20 kbit/s; 17.4% of 115200 bit/s before extra framing.
  • Other links: CAN arbitration, USB/Ethernet packets, JTAG state and 1-wire slot timing; device-specific protocols.
  • Physical layer: UART logic versus RS-232 bipolar voltages; compatible transceiver required.
  • Integrity: Frame boundaries, sequence number and error detection.
  • Time meaning: Acquisition timestamp distinct from host arrival.
  • Counter wrap: Unsigned difference valid modulo the counter range; actual elapsed interval shorter than one wrap.

Practice​

  • Preparation: Hand trace or software model; low-aligned twelve-bit code, big-endian two-byte transfer, 1 kS/s.
  • Prediction: 0x04/0xD9, 8 µs SPI time, 2000 bytes/s raw storage.
  • Execution: Correct transfer, swapped bytes, missing sequence number and 64-sample sum.
  • Observation: Word format, acquisition time and arrival time separately.
ItemExpectedTrace/result
Code frame0x04, 0xD9—
SPI duration8 µs plus overhead—
Raw storage2000 bytes/s—
AccumulatorAt least 18 bits—
  • Optional extension: 100 ms versus 300 ms processing per 256 ms block.
  • Carry forward: Frame format, link budget and buffer deadline.

Exercises​

  1. Bytes: Big-endian two-byte representation of 0x0123.
  2. SPI: Twenty-four clock periods at 2 MHz.
  3. UART: Line rate for three bytes/sample, 1 kS/s, 8N1.
  4. Sum: Bits required for 16 maximum twelve-bit codes.
  5. Buffer: Fill time for 128 samples at 2 kS/s.
Answers and reasoning
  1. Answer: 0x01 then 0x23.
  2. Answer: 12 µs before overhead.
  3. Answer: At least 30 kbit/s.
  4. Answer: 16 unsigned bits; maximum sum 65520.
  5. Answer: 64 ms.

Continue​

Reference​

  • Reading: Paul Horowitz and Winfield Hill, The Art of Electronics, third edition, Chapter 14.
  • Lesson material: Original explanations, calculation examples and exercises; reference sections for further study.