0
\$\begingroup\$

I have a resistor divider analog input circuit that has an off-board resistance applied in the form of a sensor. The off-board sensor/resistance can be anywhere from 300 Ω to 12 kΩ.

I see strange behavior on a new board design compared to the same exact circuit on a previous board design. The strange behavior is a sharp drop in ADC reading when reaching a certain resistance to the circuit.

I am simulating different resistance values for the off-board resistor using an Arduino controlling a digital potentiometer (Rtest in the schematic below). I used a voltmeter to measure the voltage drop over the off-board resistor to validate that what I am seeing is related to the circuit and not something to do with the ADC or ADC Ref.

What is even stranger is that if I short the input terminals I2 & G2 together (current path skips over the off-board resistor) and then un-short them, the ADC value goes back to what I would expect. If I power cycle the board, the voltage returns to the higher value until I short the terminals again. The change in voltage drop at the off-board resistor before and after shorting I2 & G2 is ~200 mV

enter image description here

The EXACT same analog input circuit does not demonstrate this behavior on the previous design. The difference between the older design and the newer design is the MCU, but the behavior is seen at the input terminals so the MCU should not be a variable.

There are other changes to the PCB layout (including the power planes) but the analog input changes at such a slow rate that it is basically a stable, DC resistor divider. There is just one ground plane in both the previous working design and the new design.

The chart below shows the ADC values as the potentiometer starts at 1 Ω and increases to 20 kΩ in single-count steps. The dark blue line is the previous board's behavior where you see a clean curve. The light-blue line is the new board design where you can see a sudden drop in the ADC-value curve. The drop in the chart corresponds to Rtest being ~2.5 kΩ.

enter image description here

What is also interesting is that the jump in ADC reading happens also when counting down from 20 kΩ to 1 Ω, but it is at a slightly different potentiometer count.

enter image description here

I am looking for an explanation. I have even removed capacitor C1 and TVS diodes D15, D23, and D20, but still see the same behavior.

enter image description here

Thanks anyone who can help shed some light on this!

\$\endgroup\$
5
  • 1
    \$\begingroup\$ Maybe your 5V supply or some other supply rail is unstable. Something like oscillation could well explain this. \$\endgroup\$ Commented Dec 22, 2022 at 0:08
  • 1
    \$\begingroup\$ zme, Lift the MCU pin away from contact and check again. The MCU pin does have non-linear devices at the pin. When you say you don't think it is the MCU, I'd like to be absolutely sure. Only way to do that is to lift the pin off the pad and check again. Better to check for sure and to be certain about this. It's not hard to check. \$\endgroup\$
    – jonk
    Commented Dec 22, 2022 at 2:59
  • \$\begingroup\$ Which MCU is it? What was the MCU change, was it MCU itself, or change to which ADC pin it goes? \$\endgroup\$
    – Justme
    Commented Dec 22, 2022 at 8:04
  • \$\begingroup\$ The supply rails are very stable. There is no oscillation on either the power supply rails nor the circuit itself. The MCU does not even have firmware on it when I am doing my testing now so the pin is just a high-impedance input. I just have no clue where the discharged energy is coming from when I short the terminals together. And the fact that the voltage remains lower after removing the jumper means that the discharged energy is not coming back into play \$\endgroup\$
    – zme
    Commented Dec 22, 2022 at 17:32
  • \$\begingroup\$ MCU is IMXRT1024 by NXP \$\endgroup\$
    – zme
    Commented Dec 23, 2022 at 1:57

1 Answer 1

1
\$\begingroup\$

It is the MCU.

The IMXRT1024 has pin-keeper circuitry, which is a schmitt-trigger that injects a small current into input pins to keep them at a stable level if they're floating.

Page 31 of the linked datasheet: Keeper Circuit Resistance

If the pin is at a low voltage, the MCU connects a ~100kOhm pull-down resistor to it, if it's at a high voltage, it connects a pull-up instead. That will mess up your measurement quite nicely. It also explains the hysteresis (and sudden jump) you're seeing.

There's likely a way to disable the pin keeper for each pin in software; I haven't dug into the datasheet enough to find out how, though.

\$\endgroup\$
2
  • \$\begingroup\$ Yep that was it! IDK why but the keeper is enabled by default on ADC pins. Seems an odd default setting to me given the impact on ADC readings... Thank you!! \$\endgroup\$
    – zme
    Commented Dec 29, 2022 at 18:28
  • 1
    \$\begingroup\$ The keeper is on by default to ensure that the MCU's digital input buffers don't draw excessive supply current when one of the pins is floating. A single floating input pin can cause more current draw than the entire rest of the MCU in sleep mode (due to CMOS cross-conduction). When you disable the keeper, also disable the digital input buffer to avoid this (if possible). I'm glad I could help! \$\endgroup\$ Commented Dec 29, 2022 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.