SD Card Interface PCB Layout Guide

An SD card interface looks like a simple four wire bus, and at low speed it is. At the rates used by modern cards, however, the clock and data lines behave as a synchronous transmission line, and the socket adds a connector, a card and a user who inserts it while the board is powered. Layout decides whether the interface works at the highest speed the card supports or falls back to a slower mode.

What an SD Card Interface Involves

The interface provides a clock, a command line and one or more data lines, plus power, ground and often a card detect switch. Communication begins in a slow single bit mode and, if both sides support it, moves to a four bit mode at a higher clock rate. The negotiation means a board that works but has marginal signal integrity may still function, just at a lower speed than intended.

Timing is referenced to the clock in both directions. The card samples the command and data lines on one edge of the clock, and it returns data on another, with a specified setup and hold window. Anything that shifts the data edges relative to the clock, including different trace lengths or different loading, eats into that window.

The socket itself is a mechanical component with a defined pad geometry and a card insertion depth. The electrical design cannot ignore the mechanical arrangement, because the trace length from the controller to the socket pads is fixed by where the socket sits, and the socket placement often determines whether the routing can be kept short.

Bus Modes and Signal Rates

The default mode runs at a few hundred kilohertz and is very tolerant of layout. High speed mode raises the clock to tens of megahertz, and the newer ultra high speed modes use a separate voltage and a higher rate with tighter timing. Each step reduces the margin, so the routing that works in the default mode may fail at the highest rate without any change to the firmware.

Signal integrity at these rates depends on the trace impedance, the termination and the loading of the card. The card presents a capacitance at the end of the line, which with the trace inductance forms a resonance that can cause overshoot on the clock. A small series resistor at the controller end, typically a few tens of ohms, damps that overshoot and is often the difference between a link that works and one that does not.

Where the card is connected through a socket, the contact resistance of the mating interface also enters the picture. It is small in a good socket, but it varies with wear and with contamination, and it introduces a change in the effective line impedance that the design has to tolerate. Keeping the trace impedance controlled limits the effect of that variation.

SD card socket mounted on a controller board

Clock, Data and Command Lines

Route the clock as a controlled impedance trace with a continuous return path and keep it away from the data lines, because the clock is the strongest and the fastest signal in the interface. The three times the trace width separation rule is a reasonable starting point, as described in our guide to the three W rule, and the separation matters most where the lines run in parallel for a long distance.

Keep the command and data lines length matched to each other and, where the controller allows it, to the clock. clock skew of a few hundred picoseconds is significant at the highest rates, and it appears as a reduction in the timing window rather than as a hard failure. Matching within a few millimetres is normally adequate.

Where the socket is mounted remotely from the controller, the additional length has to be included in the timing budget. The rules for a link of this kind are the same as for any source synchronous bus, and our article on high frequency data bus routing covers the loss and crosstalk budget that sets the practical length limit.

Pull Ups and Drive Strength

A pull up resistor on each data and command line keeps the bus defined when the card is not driving it, and their value affects the edge rate. A small resistor gives fast edges but draws current from the driver when it pulls the line low, while a large resistor gives slow edges that may not satisfy the setup time at high speed. The datasheet value is a starting point rather than a fixed rule.

The drive strength of the controller output also matters, and many modern controllers allow it to be programmed. A stronger drive produces faster edges and more overshoot, while a weaker drive produces a cleaner waveform with slower edges. Where the trace is long and the card capacitance is significant, a moderate drive with a series damping resistor usually gives the best eye.

Pull ups on the data lines should not be fitted where the controller already provides them internally, because parallel pull ups load the bus and slow the edges without benefit. Checking the internal configuration register before adding external resistors is a small step that avoids a common duplication error.

SD card interface traces routed on a PCB

Power, Decoupling and Insertion Events

The card draws current in bursts when it writes to its internal flash, and those bursts can reach several hundred milliamperes for a short period. The supply has to hold its voltage during that burst, or the card will reset in the middle of an operation. A bulk capacitor of a few microfarads in addition to the local ceramic capacitor is the standard remedy.

Decouple the supply at the socket rather than only at the controller, and provide a short return path to the ground plane. Cards with a metal shell should have that shell connected to ground, both for shielding and to define the reference for the signal lines, which is also a layout decision that influences how well the interface behaves after the card is inserted.

Insertion and removal of a card while the board is powered creates an event that the interface has to survive. The card detect switch should be debounced in hardware or firmware, and the signal pins should be protected so that a discharge from a charged user does not reach the controller. This is one of the few interfaces where a user can touch the contacts directly, and the protection belongs close to the socket. The routing rules that keep the high speed lines healthy are the ones described in our guide to microstrip and stripline routing.

Layout of the Card Socket

Place the socket where the card can be inserted without obstruction and where the routing to the controller is short. The socket usually defines the pad geometry, and the pads are often fine pitch, so the escape routing has to be planned before the socket is placed rather than afterwards.

Keep the clock trace on a single layer where possible, with an unbroken ground plane beneath it. Where a layer change is unavoidable, provide a return via next to the signal via so that the return current can follow the trace. A pair of vias without a return path is a discontinuity that produces reflections on the fastest line in the interface.

The mechanical design should hold the socket flat against the board. A socket that is lifted at one end by a foreign object or by solder wicking during assembly has pads that are not coplanar, and the resulting contact resistance varies with the card and with temperature. Where the socket is a push push type, the card retention force should be specified so that vibration does not move the card during operation.

Bring-up and Common Failures

A card that is not detected at all is usually a power or card detect problem rather than a signal integrity problem. Check the supply at the socket under load, confirm that the detect switch reads correctly, and verify that the command line idles at the correct level before looking at the clock.

A card that is detected but fails during initialisation points at the command and clock timing. Reduce the clock rate in the firmware and see whether the failure disappears. If it does, the layout or the pull ups are marginal at the higher rate, and the fix is a cleaner routing path or a different damping resistor rather than a firmware workaround.

A card that works during reading but fails during writing points at the supply. Writing draws the largest current bursts, and a supply that sags during those bursts will reset the card. Measuring the supply at the socket with a scope, triggered on the write, shows whether the voltage is collapsing; adding capacitance at the socket is the usual fix. The same method of measuring at the point of use rather than at the source is described in low cost signal quality improvements.

FAQ

How long can the traces to an SD card socket be? At the highest speeds, keep them as short as the mechanical layout allows, typically under a few centimetres. At default speed, much longer traces work reliably.

Do I need a series resistor on the clock? Many designs work without one, but a resistor of a few tens of ohms at the controller end is cheap insurance against overshoot when a long trace meets the card capacitance.

Should the card shell be grounded? Yes. Grounding the shell gives the interface a defined reference and improves immunity. Provide multiple ground connections to the plane rather than a single narrow trace.

Leave A Comment