AD8221 Rg Parasitics Cause Oscillation


I have 2 AD8221 layouts, one which works well, and one identical schematic, different layout which has oscillations on the output.

I have probed the inputs and they look good. If I remove my two resistors and open switches between RG terminals (for setting 2 other gains besides G=1 when I close a switch), there is no oscillation.

I found in the datasheet for AD8221 this: "Traces from the gain setting resistor to the Rg pins should be kept as short as possible to minimize parasitic inductance."

What kind (cap/ind series/parallel) and level of parasitics on Rg will cause issues? I know it must be parasitics on Rg because I have the other layout with the same circuit that works fine. I know it's Rg because removal of the loop with two sets of switches (open) and inductors fixes the oscillation.

Also is it possible to simulate this issue in the spice model? I have tried many simulations with parasitics that cause at most 80uV of oscillation at the output, but I'm seeing much more.

Supplies at +/- 5V, inputs at 500mV and Gnd with 100pF cap across them, Ref at Gnd. Again, the inputs look great, only the output has oscillation.

Thank you.