Peter Ulbrich
02: sensing, sampling, and codes. 03: computation, storage, and handoff.
The result must reach the output and cause a timely physical effect.
A controller computes the right value on time. The output can still fail.
| Question | Failure example | Design consequence |
|---|---|---|
| Correct? | A cable disturbance corrupts bits. | Robust signaling and integrity checks |
| Fresh and timely? | A valid command waits in a queue. | Bounds on delay, jitter, and data age |
| Available after a fault? | A frame or sender disappears. | Detection, bounded recovery, local fallback |
Retries improve delivery chances but consume the remaining time budget.
Communication requirements: Marwedel, 4th ed. (2021), §3.5.1. Error rates depend on medium and operating conditions.
Follow a motor-control loop from a numerical value to its physical effect.
First, a direct electrical output: how does a code become a voltage?
A digital-to-analog converter (DAC) maps a code to an electrical level.
The output level carries a command; a motor needs a power stage.
Task: add the DAC’s branch currents, then convert their sum to an output voltage.
Node: incoming current equals outgoing current.
\[I = I_0+I_1+I_2+I_3\]
Loop: signed voltage changes sum to zero.
\[\sum_k V_k=0,\qquad V_R=RI\]
Diagrams: Chen / Marwedel, after Jewett and Serway (2007). \(I_i\): branch currents; \(V_k\): signed voltages; \(R\): resistance. Signs follow the chosen arrows.
Goal: convert the summed current \(I\) to \(V_{out}\) while keeping the summing node near \(0\,\mathrm{V}\).
\[V_{out}=g(V_+-V_-),\qquad I_{in}\approx0,\qquad V_{out}\approx -R_f I\]
\(g\): open-loop gain; \(V_+,V_-\): input voltages; \(R_f\): feedback resistance. Assumptions: negative feedback, linear operation, sufficient output swing. Virtual ground is not a wire to ground.
Each switch applies either \(V_{ref}\) or 0 to its resistor branch.
Circuit: Chen / von der Brüggen (2024), based on Marwedel, Fig.3.51. \(x_0\): LSB; \(x_3\): MSB; \(R_1=R_f\) in our equations. Ideal switches and linear op-amp model.
For bit \(i\in\{0,1,2,3\}\):
\[I_i=\frac{x_iV_{ref}}{2^{3-i}R}\]
At the summing node:
\[I=\sum_{i=0}^{3}I_i=\frac{V_{ref}}{8R}\underbrace{\sum_{i=0}^{3}x_i2^i}_{X}\]
The total current is proportional to the numerical code \(X\).
\(x_i\in\{0,1\}\): bit values; \(X\): unsigned integer 0–15; \(V_{ref}\) [V]; \(R\) [Ω]; \(I_i,I\) [A]. Virtual-ground and ideal-switch assumptions apply.
\[V_{out}=-R_f I=-V_{ref}\frac{R_f}{8R}X\]
With \(R_f=R/2\) and \(V_{ref}=3.2\,\mathrm{V}\):
| Code | Integer \(X\) | Output |
|---|---|---|
| 0000 | 0 | \(0\,\mathrm{V}\) |
| 1000 | 8 | \(-1.6\,\mathrm{V}\) |
| 1010 | 10 | \(-2.0\,\mathrm{V}\) |
| 1111 | 15 | \(-3.0\,\mathrm{V}\) |
One code step changes the output by \(-0.2\,\mathrm{V}\) in this circuit.
Chosen ideal example: adequate negative supply and output swing. Sign and scaling are circuit-specific.
PWM encodes a value in the fraction of each period spent HIGH.
\[D=\frac{t_{HIGH}}{T_{PWM}}\]
For an ideal \(0/V_H\) pulse signal:
\[\overline{v}=D\,V_H\]
Figure: Marwedel (2021), Fig.3.59, p.187. \(D\): duty cycle; \(t_{HIGH},T_{PWM}\) [s]; \(V_H,\overline v\) [V]. Average voltage does not imply motor speed proportional to duty cycle.
Goal: generate programmable PWM pulses without software timing each edge.
Counter: \(k=0,\ldots,N-1\).
Source comparator: HIGH if \(k>r\).
\[f_{PWM}=\frac{f_{clk}}{N},\quad D=\frac{N-1-r}{N}\]
With \(f_{clk}=20\,\mathrm{MHz}\), \(N=1000\):
Figure: Marwedel (2021), Fig.3.60, p.188; power stages omitted in its schematic. \(f_{clk}\) [Hz]: timer clock; \(N\): ticks per period; \(r\): compare register. Chosen strict-\(>\) model; endpoint conventions and update latching vary by timer.
Unlike the PWM pulse train, a DAC keeps each level until its next update: zero-order hold (ZOH).
Original plot: P. Marwedel, via Chen / von der Brüggen (2024). Dashed: source signal; solid: held output. Ideal vertical steps omit settling time. Time axis follows the original example.
A signal limited to \(f_{max}\) can be reconstructed from ideal uniform samples if \(f_s>2f_{max}\).
\[z(t)=\sum_{s=-\infty}^{\infty}q[s]\,\operatorname{sinc}\!\left(\frac{t-sT_s}{T_s}\right)\]
\[\operatorname{sinc}(v)=\frac{\sin(\pi v)}{\pi v},\qquad \operatorname{sinc}(0)=1\]
\(t\) [s]: continuous time; \(s\in\mathbb{Z}\): sample index; \(T_s=1/f_s\) [s]; \(q[s]\) [V]: scaled sample value. \(f_{max}\) [Hz]: signal band limit. ADC/DAC gains and sign are matched for this pass-through example.
Problem: interpolate between samples while preserving every sample value.
Solution: a shifted sinc has weight 1 at its own sample, 0 at the others.
Original plot: P. Marwedel, via Chen / von der Brüggen (2024). Horizontal coordinate: \((t-sT_s)/T_s\); vertical: interpolation weight. Between sample instants, neighboring samples contribute.
Each colored curve is one weighted, shifted sinc; add their values at the same time.
Original plot: P. Marwedel, via Chen / von der Brüggen (2024). Staircase: held samples. Colored oscillating curves: individual interpolation terms, not successive output states.
The finite sinc sum follows the signal more closely than the held staircase.
Original plot: P. Marwedel, via Chen / von der Brüggen (2024). Blue: original; green: held samples; red: finite reconstruction. Quantization and omitted contributions prevent an exact match here.
Goal: reconstruct the original signal with minimal error.
| Stage | Problem | Approach |
|---|---|---|
| Input: anti-aliasing | Out-of-band content aliases. | Limit analog bandwidth before sampling. |
| Output: reconstruction | Conversion adds spectral images; the hold distorts the useful band. | Low-pass filter; compensate hold distortion where needed. |
An output filter removes spectral images, but cannot undo aliasing or quantization.
For a hold of duration \(T_s\), the normalized response is
\[H_{ZOH}(f)=e^{-j\pi fT_s}\operatorname{sinc}(fT_s).\]
| Limitation | Practical consequence |
|---|---|
| Infinite, noncausal sinc | Finite filters approximate it and add delay. |
| Quantized samples | Output filtering cannot restore the missing information. |
| Finite transition band | Leave margin between useful band and sampling limit. |
| Hold and settling | Account for amplitude droop, phase, and conversion dynamics. |
\(f\) [Hz]: frequency; \(T_s\) [s]: update period; \(j^2=-1\); normalized DC gain 1. \(|e^{-j\pi fT_s}|=1\); the sinc factor causes amplitude droop. A real control loop also pays the resulting delay.
A separate sensor, ADC, or DAC needs a transaction across a peripheral interface.
Topology, electrical conditions, traffic, and timing requirements guide the choice.
SCLK clocks bits; CS selects the target. Data can flow in both directions.
Example: CPOL=0, CPHA=0. MOSI/MISO names describe directions relative to the controller. Timing: Analog Devices AN-1248. SPI formats, CS timing, modes, and integrity checks depend on the device.
Two shared signal lines: SDA for data, SCL for clock.
S/Sr/P: START / repeated START / STOP; A/N: ACK / NACK. Example: 7-bit addressing, one register byte, two data bytes. NXP UM10204 Rev.7.0, §3.1. Clock stretching may extend SCL LOW.
| Example transaction | Clock count | Clocking time |
|---|---|---|
| I²C: write address, register, read address, two data bytes | \(5\times(8+1)=45\) | \(45/400\,\mathrm{kHz}=112.5\,\mu\mathrm{s}\) |
| SPI: 8-bit command, 16-bit response | \(8+16=24\) | \(24/2\,\mathrm{MHz}=12\,\mu\mathrm{s}\) |
Add the costs that the count does not include:
Clocking time is one component of response time; these configurations are examples.
An OS can run other tasks while this caller waits for HW.
Interrupts/DMA can hide HW latency with useful computation.
Example: immediate resumption at completion; transfer \(0.2\,\mathrm{ms}\), sample age \(2.0\,\mathrm{ms}\). Latency hiding improves CPU use; it does not shorten the transfer or guarantee a fresher output.
Our motor drive adds conditions that a short peripheral link may not face:
| Physical condition | Communication problem |
|---|---|
| Motor and power switching | Electromagnetic disturbance can corrupt edges or bits. |
| Cables and connectors | Propagation, reflections, attenuation, and connection faults matter. |
| Separate power domains | Local grounds can differ; receiver limits still apply. |
| Multiple communicating nodes | Access, load, and failures influence each other’s timing. |
The physical medium now motivates signaling, error handling, and controlled access.
Several nodes share a medium: protect the information and account for access time.
Single-ended: compare a signal with its reference ground.
Differential: compare the two wire voltages:
\[V_D=V_A-V_B\]
Common disturbance \(n\):
\[(V_A+n)-(V_B+n)=V_D\]
Limits: common-mode range, matching, thresholds, and termination.
Figures: Marwedel (2021), Figs.3.47/3.48. \(V_A,V_B,n\) [V]; \(V_D\): differential voltage. Differential signaling does not inherently require negative supply voltages; real receivers reject common-mode interference only within limits.
| Failure | Useful mechanism | Remaining limitation |
|---|---|---|
| Corrupted bits | Frame integrity check, e.g. CRC | Residual undetected errors; no authenticity |
| Lost or duplicate frame | Timeout and sequence counter | Application must choose a recovery action. |
| Late or stale command | Age/deadline check | Correct bits can still be unusable. |
| Misbehaving sender | Error confinement, policing, guardian | Different faults need different containment. |
Detection, recovery, and safe physical behavior are separate design steps.
Frame-level features depend on the protocol; sequence/age checks may belong to the application. Timestamp comparison needs a compatible clock basis or a justified bound on clock offset.
| Access mechanism | What happens when several nodes want to send? | Timing question |
|---|---|---|
| Contention / backoff | Nodes defer or retry after conflicts. | How many attempts and delays are possible? |
| Priority arbitration | The highest eligible priority wins. | What blocks it, and how much higher traffic exists? |
| Scheduled slots | Each node uses assigned windows. | When is its next window, and does the frame fit? |
Predictability follows from the mechanism and bounded assumptions.
CAN broadcasts frames; identifiers express message content and arbitration priority.
Generic high-speed CAN. ECU: Electronic Control Unit. Physical-layer and configuration limits constrain nodes, length, stubs, and termination.
0 is dominant; 1 is recessive. A node sending 1 stops when it reads 0.
Rows show intended identifiers, most significant bit first. Bit 1 is the second bit from the right. Example: two Classical CAN standard data frames; no higher traffic or errors shown.
Standard data-frame schematic, not proportional bit timing. Arbitration: 11-bit ID + RTR; Control: IDE + reserved bit + 4-bit DLC. Stuff bits add overhead. ACK does not confirm application acceptance or actuator effect. Bosch M_CAN Rev.3.3.1, §3.1.
Even the highest-priority ready frame waits for a frame already in progress.
Other priorities can also have bounds when traffic, frame sizes, and errors are bounded.
Illustrative timing model: one ongoing frame, one new high-priority frame, no further traffic/errors. Response time starts at readiness. Formal CAN response-time analysis is later material.
Time Division Multiple Access: each participant transmits in assigned windows.
Figure: Marwedel (2021), Fig.3.49, p.176. Based on the TDMA discussion cited by Chen, including E. Wandeler and L. Thiele, ASP-DAC 2006. Fixed slots are the model here; variants need their own bounds.
Model: \(P=10\,\mathrm{ms}\), one \(2\,\mathrm{ms}\) slot, transmission \(C=1\,\mathrm{ms}\).
\[W<P,\qquad R=W+C<P+C=11\,\mathrm{ms}\]
\(P\): cycle period; \(C\): transmission duration; \(W\): access wait; \(R\): readiness-to-completion time. Start only at slot boundary; frame fits with required reserves; next start is usable; bounded synchronization error; no faults.
Cycle excerpt: Chen / Marwedel, via TZM FlexRay Introduction. A1/B1/etc. label messages from nodes A/B/etc. A guardian is an additional mechanism; channel redundancy does not remove every common cause of failure.
IEEE 802.3 full-duplex operation; IEEE 802.1 Time-Sensitive Networking. A TSN-capable device alone does not establish an end-to-end bound: topology, configuration, traffic assumptions, and the selected mechanisms matter.
| Medium effect | Consequence for an embedded loop |
|---|---|
| Interference and fading | Delivery probability varies; recovery consumes time and energy. |
| Shared radio access | Contention or reserved opportunities influence access delay. |
| Sleep / wake-up operation | Energy savings can add latency before a transfer. |
| Changing connectivity | A local node needs behavior for a missing remote command. |
Examples include WLAN, Bluetooth, cellular systems, and IEEE 802.15.4-based networks.
Ask which delay and failure bounds the configured system actually supports.
The receiver must turn a valid, timely command into a physical action.
Motor photo: P. Marwedel, via Chen / von der Brüggen (2024). Diagram: generic motor drive.
A command update may precede its physical effect by a substantial interval.
Illustrative model: \(a(t)=0\) for \(t<T_d\); then \(a(t)=1-e^{-(t-T_d)/\tau}\). \(a\): normalized actuation; \(T_d=3\) ms; \(\tau=20\) ms. Not measured motor data. Saturation and rate limits require additional modeling.
\[\dot{x}=f(x,a,d),\qquad y=h(x)\]
\(u_{cmd}\): intended command; \(a\): actual actuation entering the plant; \(d\): disturbance; \(x\): plant state; \(y\): physical output; \(y_m\): measurement. Known commands support prediction; measurements correct state estimates. The actuator may alternatively be included inside the plant model.
A communications timeout is a detection mechanism. The appropriate output response depends on plant dynamics, stored energy, and the fault model; “keep last value” and “switch off” are not universal safe states.
Several actuation channels act on a common mechanical output.
Conceptual three-channel comparison, not a Shuttle schematic. Historical example: J. E. Tomayko, NASA-CR-182505 (1988), Ch.4.4: the Shuttle used quadruple redundant actuation with physical voting. Fault assumptions, common causes, and mechanical coupling remain decisive.
Sample age: \(A_{apply}=t_{apply}-t_{sample}=2.0\,\mathrm{ms}\).
The \(1.5\,\mathrm{ms}\) application deadline is missed despite a \(0.2\,\mathrm{ms}\) transfer.
\(A_{apply}\): sample age when the output applies its derived command. Actuator/plant response follows application and must be assessed separately. Bounds on individual stages compose only when their assumptions and event definitions are compatible.
| Boundary | Main mechanism | What must be established? |
|---|---|---|
| Code → signal | DAC, holding, reconstruction, PWM | Transfer function, signal quality, update behavior |
| Controller → peripheral | SPI / I²C transactions | Complete format, electrical compatibility, time cost |
| Node → node | Signaling, error checks, arbitration or slots | Bounded delay and a defined response to faults |
| Command → plant | Power stage, actuator dynamics, feedback | Actual effect, data freshness, local fault behavior |
Communication design connects the value’s meaning with its timing and physical effect.
DAC: Why does code 1010 produce −2.0 V in our circuit?
Reconstruction: Why do neighboring sinc terms vanish at a sample instant?
I²C: Why does the two-byte register read need 45 clocks?
CAN: Why does the high-priority frame take 1.1 ms after becoming ready?
TDMA: Which assumptions make the completion bound smaller than 11 ms?
PWM: What changes when \(N\) doubles at the same timer clock?
Actuation: What do a CAN ACK and a fresh command fail to prove?
Voting: Which failure point remains after voting before one actuator?
Fourth edition (2021)
Technical documentation: NXP I²C UM10204; Analog Devices SPI AN-1248; Bosch M_CAN Rev.3.3.1; IEEE TSN.