Author Topic: SAMD21 - Voltage on analog input trickles into 3.3V rail  (Read 2129 times)

0 Members and 1 Guest are viewing this topic.

Offline VulpeculaTopic starter

  • Newbie
  • Posts: 8
  • Country: de
SAMD21 - Voltage on analog input trickles into 3.3V rail
« on: January 18, 2022, 09:51:33 am »
Hey there!

I have observed a rather strange thing regarding a circuit, where the voltage of a 7.4V 2S LiPo battery gets divided down with a voltage divider (ratio: 1kOhm/3kOhm) and is then fed into an analog input pin of a SAMD21 microcontroller. The circuit is turned on and off by a pushbutton controller which is connected to the enable-pin of a buck converter. Also, the battery is always connected to that voltage divider and the connection does not get cut off in case the circuit is turned off.

Here's the strange thing: When turned off, I can measure a voltage between 0,8V and 1V on the 3.3V rail and a current of 2.5mA coming from the battery. Changing the resitor values (without changing the ratio) does lower the voltage and the current of course. For instance: 100kOhm/300kOhm lowers the voltage on the 3.3V rail to 0.4V and the current to 0,15mA.

Can someone explain why this happens? My best guess is, that when the 3.3V rail on the microcontroller is turned off, something inside the SAMD21 lets current seep through. But after all, I do not know enough about the internals of those microcontrollers so maybe some of you guys can tell me what is going on here.

Thanks and greetings
Vulpecula
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12855
Re: SAMD21 - Voltage on analog input trickles into 3.3V rail
« Reply #1 on: January 18, 2022, 10:11:44 am »
Your MCU is getting parasitic power via its input protection diodes.


EEVblog #831 - Power A Micro With No Power Pin!

Forum thread: https://www.eevblog.com/forum/blog/eevblog-831-power-a-micro-with-no-power-pin!/
« Last Edit: April 18, 2022, 08:15:26 pm by Ian.M »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11238
  • Country: us
    • Personal site
Re: SAMD21 - Voltage on analog input trickles into 3.3V rail
« Reply #2 on: January 18, 2022, 06:00:10 pm »
Yes, all pins on SAM D21 have clamping diodes, and if there is no VDD voltage, but there is a voltage on the pin, then the VDD diode opens and powers the VDD rail.
Alex
 

Offline nemail2

  • Regular Contributor
  • *
  • Posts: 206
  • Country: at
Re: SAMD21 - Voltage on analog input trickles into 3.3V rail
« Reply #3 on: June 25, 2022, 01:27:54 pm »
how would you stop this, let's say for the UART pins where you have your USB/UART converter connected during development all the time, even if the power source for your DUT is temporarily turned off? Is there an easy fix for that, if I'm too lazy/annoyed to disconnect the USB/UART adapter everytime I disconnect power from my SAMD21?
Boron rhymes with moron
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12855
Re: SAMD21 - Voltage on analog input trickles into 3.3V rail
« Reply #4 on: June 25, 2022, 01:42:00 pm »
Get a USB<=>UART converter that senses target power to set its logic levels and also disables its outputs when target power is not present.

Alternatively mod your existing USB<=>UART converter by adding 74LVC1T45 dual supply level translating buffers, with the target side powered from target Vcc, which are guaranteed to go Hi-Z if one supply is missing.  They also bring the benefit of target level conversion over the range 1.8V to 5.5V.  Strap their DIR pins according to whether the signal is an input or output.  If you've got two signals in the same direction you could use 74LVC2T45 buffers, for a reduction in board area and component count.
 
The following users thanked this post: nemail2, tellurium

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11238
  • Country: us
    • Personal site
Re: SAMD21 - Voltage on analog input trickles into 3.3V rail
« Reply #5 on: June 25, 2022, 05:02:46 pm »
In most cases you don't really need to worry about it. There are rare cases where this effect causes problems and there you need to act according to the situation, but in most cases it is fine.
Alex
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8637
  • Country: gb
Re: SAMD21 - Voltage on analog input trickles into 3.3V rail
« Reply #6 on: June 25, 2022, 05:08:20 pm »
You can get some really funky things happening through those protection diodes. If your device needs to work in a high EMI environment you may find picked up energy feeding into the I/O pins gets through to the Vdd rail through the protection diodes, pushing that rail's voltage up until something fails from over-voltage. There are times when a simple LDO doesn't cut it for a power supply, and you need a regulator with the ability to clamp Vdd as well as regulate it.
 

Offline TimFox

  • Super Contributor
  • ***
  • Posts: 7942
  • Country: us
  • Retired, now restoring antique test equipment
Re: SAMD21 - Voltage on analog input trickles into 3.3V rail
« Reply #7 on: June 25, 2022, 05:56:10 pm »
(I posted this anecdote previously.)
When RCA first introduced their "COS-MOS" line (4000-series higher-voltage CMOS), I attended a presentation by an RCA field engineer.
He related a personal story:  he had been tasked with verifying the toggle-frequency spec on an MSI counter.
He set up the equipment late on Friday, and returned Monday morning to document the measurements.
The result was horrible:  the maximum toggle frequency was way below the specification.
He then found that he had forgotten to turn on the bench power supply:  the square wave from a low-impedance source had produced enough voltage on the supply rail (through the protection diodes) for the counter to function badly.
No problems after powering-on the external supply.
 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 6958
  • Country: ca
Re: SAMD21 - Voltage on analog input trickles into 3.3V rail
« Reply #8 on: June 25, 2022, 06:16:04 pm »
Ref. SAMD21 injection current specs, VDD <=3V is 15mA but for VDD= 3-3.6V it's only 1mA.
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8637
  • Country: gb
Re: SAMD21 - Voltage on analog input trickles into 3.3V rail
« Reply #9 on: June 25, 2022, 06:53:24 pm »
(I posted this anecdote previously.)
When RCA first introduced their "COS-MOS" line (4000-series higher-voltage CMOS), I attended a presentation by an RCA field engineer.
He related a personal story:  he had been tasked with verifying the toggle-frequency spec on an MSI counter.
He set up the equipment late on Friday, and returned Monday morning to document the measurements.
The result was horrible:  the maximum toggle frequency was way below the specification.
He then found that he had forgotten to turn on the bench power supply:  the square wave from a low-impedance source had produced enough voltage on the supply rail (through the protection diodes) for the counter to function badly.
No problems after powering-on the external supply.
That kind of thing happens a lot with ULP MCUs, like the MSP430.
 

Offline eugene

  • Frequent Contributor
  • **
  • Posts: 493
  • Country: us
Re: SAMD21 - Voltage on analog input trickles into 3.3V rail
« Reply #10 on: June 26, 2022, 03:11:41 pm »
I occasionally teach a few different courses at a local community college. I couldn't begin to count the number of times students wired the inputs and outputs of logic gates but didn't supply power to the IC, yet the circuit still worked!
90% of quoted statistics are fictional
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: SAMD21 - Voltage on analog input trickles into 3.3V rail
« Reply #11 on: June 26, 2022, 05:10:02 pm »
(I posted this anecdote previously.)
When RCA first introduced their "COS-MOS" line (4000-series higher-voltage CMOS), I attended a presentation by an RCA field engineer.
He related a personal story:  he had been tasked with verifying the toggle-frequency spec on an MSI counter.
He set up the equipment late on Friday, and returned Monday morning to document the measurements.
The result was horrible:  the maximum toggle frequency was way below the specification.
He then found that he had forgotten to turn on the bench power supply:  the square wave from a low-impedance source had produced enough voltage on the supply rail (through the protection diodes) for the counter to function badly.
No problems after powering-on the external supply.

it's actually what happened when the very first ARM processor was tested, they fired it up and it worked, they tried to measure the consumption as they  had no way of knowing what the power draw would be and found there was none. They had forgotten to power it and it was running on the power from an input pin. It's often told in relation to how low power it was and how much lower than they expected.
 

Online DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5896
  • Country: es
Re: SAMD21 - Voltage on analog input trickles into 3.3V rail
« Reply #12 on: June 26, 2022, 05:26:48 pm »
Yep, thats' the clamping diodes, most mcu pins are like this:


Simplest way is to just put a 100Ohm resistor to the VDD rail, the clamping diodes will dump the current into it.
Not good for battery powered because that will cause permanent VDD current consumption when ON.

For more power-critical circuits, you can use this simple circuit.
When VDD is present, Vb >= Analog input, so the transistor can't turn on, there's no extra current consumption.
When it's gone, VDD itself goes near 0V providing a path for the base current flow.
Anything >0.7V will turn on the transistor and clamp the voltage. 0.7V shouldn't cause any problem.

« Last Edit: June 26, 2022, 05:56:54 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Online peter-h

  • Super Contributor
  • ***
  • Posts: 3694
  • Country: gb
  • Doing electronics since the 1960s...
Re: SAMD21 - Voltage on analog input trickles into 3.3V rail
« Reply #13 on: June 29, 2022, 02:42:05 pm »
Use much higher value resistors for that voltage divider.

I do this with the ADC of a 32F417, 3.3V powered, to measure a +5V rail. I use a 100k/10k divider, so the max current that can source is 5V/100k=50uA. This is OK because the Zin of that ADC is pretty high, so check that yours is too.

There are other solutions but they involve more components; basically clamping the max input voltage just below the VCC of the micro, to the upper input protection diode doesn't turn on. The limit for that is normally VCC+0.2V, or if going below GND it is VSS-0.2V.

This touches on the interesting topic that capacitor-switching delta-sigma ADCs (those that deliver a 2's complement value) actually work around 0V and can sense below zero, down to about -0.2V :)
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf