<differentialpair />
Why use a differential pair?
A differential signal, such as USB D+ and D-, travels over a positive and a negative trace. If one route is longer than the other, the two halves of the signal arrive at different times.
<differentialpair /> tells a supported autorouter which two existing traces
form the pair and how much their routed lengths may differ. It does not create
electrical connections; add those with <trace />.
Use pcbTraceGap to request the edge-to-edge copper spacing between the two
traces. The pad pitch can require a wider separation at the endpoints.
Quick start with trace names
Give each <trace /> a unique name, then reference those names from
<differentialpair />.
export default () => (
<board width="32mm" height="20mm">
<connector
name="J1"
manufacturerPartNumber="TYPE-C-31-M-12"
footprint="jlcpcb:C165948"
pinLabels={{ pin8: "USB_DP", pin9: "USB_DM" }}
pcbX={-10}
pcbRotation={-90}
/>
<testpoint name="TP_DP" pcbX={12} pcbY={3} padDiameter="1.2mm" />
<testpoint name="TP_DM" pcbX={2} pcbY={-3} padDiameter="1.2mm" />
<trace name="USB_DP" from=".J1 > .USB_DP" to=".TP_DP > .pin1" />
<trace name="USB_DM" from=".J1 > .USB_DM" to=".TP_DM > .pin1" />
<differentialpair
name="USB_DATA"
positiveConnection="USB_DP"
negativeConnection="USB_DM"
maxLengthSkew={0.05}
/>
</board>
)
In this example:
USB_DPandUSB_DMcreate the electrical connections.<differentialpair />groups those connections for length matching.- The large center meander makes the route-length correction visible.
maxLengthSkew={0.05}allows an absolute routed-length difference of up to 0.05 mm.
The connector uses the real TYPE-C-31-M-12 footprint, but only one D+/D-
contact pair is labeled and connected here. The testpoints stand in for
downstream USB-device pins, so this is not a complete USB circuit.
Quick start with pin selectors
Use pin selectors when you want the pair declaration to identify each trace by a pin it connects to. Each selector must resolve to one pin that belongs to exactly one trace.
export default () => (
<board width="32mm" height="20mm">
<connector
name="J1"
manufacturerPartNumber="TYPE-C-31-M-12"
footprint="jlcpcb:C165948"
pinLabels={{ pin8: "USB_DP", pin9: "USB_DM" }}
pcbX={-10}
pcbRotation={-90}
/>
<testpoint name="TP_DP" pcbX={12} pcbY={3} padDiameter="1.2mm" />
<testpoint name="TP_DM" pcbX={2} pcbY={-3} padDiameter="1.2mm" />
<trace name="USB_DP" from=".J1 > .USB_DP" to=".TP_DP > .pin1" />
<trace name="USB_DM" from=".J1 > .USB_DM" to=".TP_DM > .pin1" />
<differentialpair
name="USB_DATA"
positiveConnection=".J1 > .USB_DP"
negativeConnection=".J1 > .USB_DM"
maxLengthSkew={0.05}
/>
</board>
)
Only one pin from each trace is needed. Here, .J1 > .USB_DP and
.J1 > .USB_DM select named pins and resolve to the two existing traces. A
component selector such as .J1 is not enough; select a specific pin.
Choosing trace names or pin selectors
| Use | When to choose it | Example |
|---|---|---|
| Trace name | The trace has a unique name. | positiveConnection="USB_DP" |
| Pin selector | The selected pin connects to exactly one trace. | positiveConnection=".J1 > .USB_DP" |
You may use a trace name for one connection and a pin selector for the other. Each value must ultimately resolve to exactly one trace in the same board or autorouted subcircuit.
If a selected pin connects to multiple <trace /> elements, use a trace name
to avoid an ambiguous match. In
phased autorouting, the routingPhaseIndex prop
assigns a <trace /> to a phase. Both traces in a pair must use the same value.
Route a pair through several pads
Give each two-pad section a positive and negative trace name. The example routes a connector through an ESD device and test points to an IC. Each polarity keeps its electrical net across all three sections. Each phase routes one pair and sees the copper from the preceding phase.
export default () => (
<board width={24} height={12} schematicDisabled routeRemaining={false}>
<pinheader name="J1" pinCount={2} pcbX={-8} pcbRotation={90} />
<chip name="D1" footprint="sot23" pcbX={-4} />
<testpoint name="TP1" footprintVariant="pad" pcbX={1} pcbY={1.5} />
<testpoint name="TP2" footprintVariant="pad" pcbX={1} pcbY={-1.5} />
<chip name="U1" footprint="soic8" pcbX={7} />
<autoroutingphase name="USB0" phaseIndex={0} autorouter="auto_local" />
<trace name="P0" path={["J1.pin1", "D1.pin1", "net.USB_P"]} routingPhaseIndex={0} />
<trace name="N0" path={["J1.pin2", "D1.pin2", "net.USB_N"]} routingPhaseIndex={0} />
<differentialpair name="PAIR0" positiveConnection="P0" negativeConnection="N0" pcbTraceGap={0.2} />
<autoroutingphase name="USB1" phaseIndex={1} autorouter="auto_local" />
<trace name="P1" path={["D1.pin1", "TP1.pin1", "net.USB_P"]} routingPhaseIndex={1} />
<trace name="N1" path={["D1.pin2", "TP2.pin1", "net.USB_N"]} routingPhaseIndex={1} />
<differentialpair name="PAIR1" positiveConnection="P1" negativeConnection="N1" pcbTraceGap={0.2} />
<autoroutingphase name="USB2" phaseIndex={2} autorouter="auto_local" />
<trace name="P2" path={["TP1.pin1", "U1.pin1", "net.USB_P"]} routingPhaseIndex={2} />
<trace name="N2" path={["TP2.pin1", "U1.pin2", "net.USB_N"]} routingPhaseIndex={2} />
<differentialpair name="PAIR2" positiveConnection="P2" negativeConnection="N2" pcbTraceGap={0.2} />
</board>
)
Properties
| Property | Type | Description |
|---|---|---|
name | string | Optional name for the differential pair. |
positiveConnection | string | Exact positive trace name or port selector. |
negativeConnection | string | Exact negative trace name or port selector. |
maxLengthSkew | number | Maximum absolute difference between the routed lengths, in millimeters. Accepts any non-negative distance and defaults to 0.1 mm. |
pcbTraceGap | number | string | Requested copper edge-to-edge gap between the pair. A number is in millimeters. |