Clocking, Timing Budgets and Reset
Build a timing budget for a real interface from datasheet numbers, choose and specify a clock source, and design a reset and power-sequencing scheme that always brings a board up correctly.
Two ways in. Work the material, or if you already know this, go straight to the project and prove it.
Where this sits
- Used by tracks
- Digital PCB DesignerEmbedded Hardware Prototyper
How this skill is structured
- 1. Concepts — the ideas stated plainly, with the equations worth memorising.
- 2. Worked example — one real problem solved end to end, numbers included.
- 3. Tool demonstration — do the thing in a real open-source tool.
- 4. Resources — the specific free readings and videos, and what part of each to use.
- 5. Project — built alone, producing something a reviewer can check.
- 6. Competence checklist — what you must be able to do. This is also the audit rubric.
1. Concepts
Read these first. Tick each one when you could explain it to someone else without notes.
2. Worked example
Will this SPI flash work at 50 MHz?
ProblemA microcontroller drives a SPI flash. MCU t_co(max) = 8 ns after the SCK edge. Flash requires t_setup = 5 ns and t_hold = 5 ns. Trace lengths are 40 mm for SCK and 60 mm for MOSI, both on outer layers. Can you run 50 MHz?
- 150 MHz means a 20 ns period. SPI mode 0 launches data on one edge and captures on the next, so the available window is half a period = 10 ns.
- 2Flight times: SCK at 40 mm x 6 ps/mm = 240 ps. MOSI at 60 mm x 6 ps/mm = 360 ps.
- 3Setup check: the data must arrive at the flash's pin at least 5 ns before the clock edge arrives at the flash's pin.
- 4Data arrives at: t_co(max) + t_flight(MOSI) = 8 + 0.36 = 8.36 ns after the launching clock edge at the MCU.
- 5The capturing clock edge arrives at the flash at: 10 ns (half period) + t_flight(SCK) = 10 + 0.24 = 10.24 ns after the launching edge.
- 6Setup margin = 10.24 - 8.36 - 5 = -3.12 ns. NEGATIVE. The interface fails setup at 50 MHz.
- 7Find the maximum frequency: we need half_period + 0.24 - 8.36 >= 5, so half_period >= 13.12 ns, period >= 26.24 ns, f_max = 38 MHz. Round down to a standard divider: 33 MHz or 25 MHz.
- 8Hold check at the lower frequency: data changes at t_co(min) + t_flight(MOSI). If t_co(min) is 2 ns, data changes at 2.36 ns after the launching edge. The previous capture edge arrived at 0.24 ns. Hold margin = 2.36 - 0.24 - 5 = -2.88 ns. Also negative!
- 9Hold violations are not fixed by slowing the clock — the equation has no frequency term. The fixes are: lengthen the data trace, shorten the clock trace, or use a device with a larger t_co(min). Here, adding 30 mm to MOSI adds 180 ps — not nearly enough.
- 10Re-read the datasheets. Often t_co(min) is not specified, in which case you must assume zero and this analysis says the interface cannot meet hold at any frequency — which is obviously false in practice. That is the signal that you are misreading the timing model: SPI mode 0 launches on the falling edge and captures on the rising edge, so the hold check spans half a period too, not zero. Redo it with the correct edges.
- 11Corrected hold check: the capture edge of interest is a full half-period before the next data change. Hold margin = 10 + 2.36 - 0.24 - 5 = 7.12 ns. Passes comfortably.
- 12Lesson: the arithmetic is easy; identifying which edges launch and which capture is where the errors are. Draw the waveform with both chips' timing diagrams side by side before writing any equations.
AnswerNo at 50 MHz — setup margin is -3.1 ns. Maximum is about 38 MHz, so run at 33 MHz or 25 MHz. And always draw the launch/capture edges from both datasheets' timing diagrams before computing; the edge relationship, not the arithmetic, is where timing analyses go wrong.
3. Tool demonstration
Build a reusable timing budget spreadsheet and learn to measure and match trace lengths in KiCad.
4. Resources
Free and, wherever possible, openly licensed. The note tells you which part to actually use — do not read them cover to cover.
5. Project — build this on your own
About 3 hours. This is the artifact that proves the skill. Work it without a walkthrough.
Produce the complete clocking, timing and reset design for a real board: a microcontroller with an external crystal, a SPI flash, an I2C sensor and a UART link to a host, plus a power supervisor.
Deliverables
Acceptance criteria — how you know it is good enough
If you want to push further
- Add a second clock domain (e.g. an audio codec on its own oscillator) and design the domain crossing, including the FIFO or handshake and the synchroniser.
- Measure a real crystal's startup time and drive level on hardware and compare to the vendor's negative-resistance guidance.
6. Competence checklist
Tick these honestly. If you are auditing this skill, this is your rubric — you should be able to demonstrate every line from the project you just built.