Frequency Compensation for Sense Amplifiers
Sense resistors typically have parasitic series inductance. This adds an additional zero to closed-loop feedback circuits. Zeros are usually good for loop stability, but they also pass along switching noise. Such noise accompanying the current-sense waveform can be filtered out with a low-pass filter that also amplifies the current waveform. An amplifier designed to do this can also provide loop compensation.
Sense Amplifier
The following diagram shows such a current-sense amplifier designed to reject a switching frequency of 40 kHz or more.

The amplifier stage has a transfer function which is approximately the inverse of its feedback divider transfer function. (This assumes that the op-amp has high gain well beyond the bandwidth of the divider.) The ideal-op-amp transfer function for this amplifier stage is:

where Rf is R2, Ri is R3, and Cf is C1. From this gain equation, the dc gain is 6. The zero is at a frequency of 1/2×p×(R2 || R3)×C1 or about 9.55 kHz. The pole is around 1.59 kHz, at the -3 db point on the output (blue) trace. The pole frequency filters noise effectively at 1/10 or more of the switching frequency (that is, –20 dB or more of filtering).
Beware, however, that the fast edges of switching waveforms can "blow across" the U1 op-amp input circuit and through the passive forward path of C1 – the same path that forms the feedback path. Because U1 is an active low-pass filter, it fails to filter once amplifier gain begin to approach unity at its unity-gain frequency. And for voltage-feedback op-amps, this is usually low; op-amps are essentially high-gain integrators.
An optional, purely passive, RC integrator stage – a pre-filter – can be placed between sense R and amplifier input. If its pole frequency (equal to 1/2×p×R×C) is set equal to the sense R zero frequency, an all-pass circuit results. More explicitly, the condition for a flat frequency response going into the amplifier is:
R× C = L1/R1
In this case, switching edges cannot "blow by" the filter because it remains a low-pass filter (if C leads are kept short to minimize series inductance) to a very high frequency. That leaves the amplifier to do loop compensation.
The amplifier transfer function is multiplied to that of the sense R stage. Without the RC pre-filter, the resulting circuit transfer function (with voltage output at node 3) shows a roll-off in magnitude due to the amplifier pole that is arrested in its downward plummet by the sense R zero at 31.8 kHz. (Note that the vertical minor divisions are in half-dB increments, and that 3 dB up, the orange curve intersects the zero frequency of 31.8 kHz.) The two curves then rise with a slope of 20 dB/decade.

Without the passive pre-filter, the amplifier pole can be set to cancel the sense-R zero, resulting in an overall frequency response with a zero at 1/2×p×(Ri || Rf)×Cf. Unlike the parasitic zero of the sense R, this zero can be placed by choosing passive component values of the amplifier.
On the phase plot (below), the sense-resistor zero at 31.8 kHz begins to affect the overall phase a decade below, or around 3.18 kHz. As can be seen, the phase (blue) plot inflects about there and bottoms out soon thereafter. Zeros continue to have an effect on phase for another decade above their break frequency, and the plot begins to show a rolling over toward a horizontal asymptote as 100 kHz is approached.

The phase lead contributed by the zero (whether the sense-R or amplifier zero) adds algebraically to the phase lag or delay elsewhere in the loop and helps to increase phase margin.
Closure
Parasitic sense-R inductance emphasizes switching noise (undesirable) while adding phase margin to the current feedback loop it is in (usually desirable). The sense amplifier can have multiple functions: low-pass noise filter, current-waveform amplification, and current-feedback-loop frequency compensation. The simple amplifier presented here does all three. If switching noise is inadequately filtered by it, precede it with a passive RC filter with pole set to cancel the parasitic zero of the sense R, and use the remaining amplifier pole and zero for phase-lag loop compensation.
Ó
Dennis L. Feucht, 2000