Epsilon Labs
The main purpose of this page is to demonstrate the use of PSPICE and MATLAB in USB compliance pre-testing. To keep things short, I will only briefly describe the USB testing requirements.

To be certified USB compliant; a device must pass a series of tests, one of which is the inrush current test. Inrush current is the short transient current surge that occurs when you first plug a USB powered peripheral into a PC’s USB port. The surge is due to the charging of the device’s various filter and bypass capacitors. The USB specification states that the maximum capacitive load that can be placed at the downstream end of a cable is 10 uF.
If you ensure that your device presents no more than a 10uF load while being connected, you should have no problem passing the test. However, in a device I recently designed, I used a Ferrite bead on the VBUS power line for noise reduction purposes and I wanted to see what effect it would have on inrush current.

Intel has written MATLAB scripts for analyzing the data collected from the various tests. The scripts are intended to be used with the USB test equipment suites from Agilent, Tektronix and others. I used these scripts in conjunction with data from PSPICE simulations to determine if my device would pass the inrush current test, before building actual hardware.
To perform the inrush current test, the instantaneous current drawn by the device is measured while it is being connected. The data is then integrated to yield the total charge transferred to the device. At a nominal VBUS voltage of 5.0V, the 10uF max load requirement represents a max charge transfer of 50uC (Q=CV).
The PSPICE test circuit for my device is shown in Figure 1.

V1 is a voltage source that provides a voltage step, which simulates the device connect.

V1 - 5.0V step, risetime = 10ns.
FB1 - Model of Murata BML21PG600 Ferrite Bead
C1 -  Model of Kemet 10uF, 10V Tantalum cap
L1 - The capacitor Equivalent Series Inductance (ESL).
R1 - Connector and cable resistance.
RL - Load resistance representing the device’s DC load (50mA).
The figures and data shown below are the outputs of the MATLAB inrush current test scripts.
Required Tests
Overall result: pass!
Inrush at 5.000V: 46.12uC  +/-4.77% at estimated 99% confidence
inrush passes

Although the current spikes at 4.0A, the device passed.
(The inrush threshold for all tests is 100ma.This is the maximum steady state current that can be drawn by any device when it is first plugged into a port)

The first test I performed was a baseline check using the circuit in Figure 1 but without the Ferrite Bead in the circuit.
Required Tests
Overall result: pass!
Inrush at 5.000V: 57.28uC  +/-4.77% at estimated 99% confidence
*** inrush failure! ***
(at 5.000V, maximum compliant inrush is 50uC)
*** waiver granted ***

This is actually a failure. If the inrush charge is less than 150uC you can ask for a wavier, but I want the test circuit to be within specification.

Required Tests
Overall result: pass!
Inrush at 5.000V: 46.86uC  +/-4.77% at estimated 99% confidence
inrush passes

So now, I know my real device needs a soft start circuit that will slow down the VBUS voltage risetime to a least 75usec. The Ferrite Bead and soft start circuit provide an added benefit of limiting the peak current.
To bring the device within spec, we can “soft start” the device by providing some means of limiting the input voltage risetime. A simple P-MOSFET with an RC circuit on the gate will usually suffice. However, I need to determine how much I need slow down the rise time.

I accomplished this by varying the risetime of the V1 step voltage until the device passed.
Test with the Ferrite Bead and V1 risetime = 75usec.
The next test is with the Ferrite Bead.