Author Topic: Safety of 300uA pull to 12V on IO pin before MCU startup  (Read 2240 times)

0 Members and 1 Guest are viewing this topic.

Offline PsiTopic starter

  • Super Contributor
  • ***
  • Posts: 10385
  • Country: nz
Safety of 300uA pull to 12V on IO pin before MCU startup
« on: July 30, 2022, 06:22:33 am »
I have a circuit with 12V going to an ADC pin of ATMega809 through a 39k resistor (part of batt Vsense divider)
The MCU is powered from a 7805 output from that 12V source too.

When the power switch is closed the 7805 will take some time to startup but the ADC input gets 12V through the 39k instantly.  So for a very short time the GPIO maybe above VCC/AVCC and the protection diodes will try to
shunt that 300uA to VCC.

Is there any risk of damage to the MCU from this 300uA?

I would have expected it to be totally fine due to only being 300uA and only for a very short time until the 7805 starts. I also have 100nF across the ADC input so the cap has to charge first.
Although I guess if you cycle the power quickly the cap will already be charged.

But I'm trying to track down an issue where the MCU is getting damaged and develops an internal short on AVCC to GND. So I just thought I'd confirm that my understanding is correct and that 300uA isn't going to do shit so i need to look elsewhere for the issue.

Thanks.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline PsiTopic starter

  • Super Contributor
  • ***
  • Posts: 10385
  • Country: nz
Re: Safety of 300uA pull to 12V on IO pin before MCU startup
« Reply #1 on: July 30, 2022, 06:29:11 am »
My justification that it's fine is the pic below from datasheet.

Which seems to suggest the inputs will be fine as long as current is limited to 1mA into the port.

« Last Edit: July 30, 2022, 06:37:03 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: Safety of 300uA pull to 12V on IO pin before MCU startup
« Reply #2 on: July 30, 2022, 06:36:57 am »
I'm not familiar with ATmega behaviour, but this is the exact text and limiting values used in the SAM D21, for example. And there your use would allowed and perfectly within the spec.
Alex
 

Offline PsiTopic starter

  • Super Contributor
  • ***
  • Posts: 10385
  • Country: nz
Re: Safety of 300uA pull to 12V on IO pin before MCU startup
« Reply #3 on: July 30, 2022, 06:44:02 am »
I'm somewhat worried the AVCC pin might be a little more sensitive on this MCU vs preveious ATMegas.
It's one of the newer MCUs Microchip has released since they bought ATMEL and some of the peripherals are quite different register wise compared to an older ATMega, so I do wonder what else has changed inside the chip.

hm.. is it a good idea to use a zener or TVS to clamp AVCC under VCC?
I don't actually need the full 5V on AVCC since the ADC reference being used is the internal 2.5V ref.
« Last Edit: July 30, 2022, 06:46:14 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: Safety of 300uA pull to 12V on IO pin before MCU startup
« Reply #4 on: July 30, 2022, 06:55:10 am »
How exactly is your capacitor connected? Is it right on the pin with no further limiting?  Would not that make it discharge into the pin with the current limited only by the ESR when power disappears?

But also, if it is a resistive divider, then the pin would still only have the divided voltage no matter what. So, it will never see 12 V.
Alex
 

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 8218
  • Country: nl
  • Current job: ATEX product design
Re: Safety of 300uA pull to 12V on IO pin before MCU startup
« Reply #5 on: July 30, 2022, 07:01:00 am »
Some stuff might latch-up and then you MCU wouldn't work properly.
Place a schottky diode from the pin to VCC. And put a zener or a TVS, like 5.2V voltage on the supply rail. That will clamp the voltage and makes sure nothing will blow up. Reset controller or power good pin from the power supply could help, but if you use a 7805 then probably thats not an option.
 

Offline PsiTopic starter

  • Super Contributor
  • ***
  • Posts: 10385
  • Country: nz
Re: Safety of 300uA pull to 12V on IO pin before MCU startup
« Reply #6 on: July 30, 2022, 07:13:51 am »
How exactly is your capacitor connected? Is it right on the pin with no further limiting?  Would not that make it discharge into the pin with the current limited only by the ESR when power disappears?

But also, if it is a resistive divider, then the pin would still only have the divided voltage no matter what. So, it will never see 12 V.

yes, it will never see 12V, but it may rise faster than VCC does.

Yeah, cap is across the GPIO to GND, with divider feeding the cap.
You reckon all pins should have a resistor in series first, to limit back feeding current at power off from any caps?
The cap is only 100nF
Greek letter 'Psi' (not Pounds per Square Inch)
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: Safety of 300uA pull to 12V on IO pin before MCU startup
« Reply #7 on: July 30, 2022, 07:18:26 am »
Well, it is hard to tell, but the true current limiting resistor would be a resistor between the pin and the rest of the circuit. You don't have that right now. I don't know how much current this capacitor can deliver. It really depends on how your power supply behaves on power off.
Alex
 

Offline PsiTopic starter

  • Super Contributor
  • ***
  • Posts: 10385
  • Country: nz
Re: Safety of 300uA pull to 12V on IO pin before MCU startup
« Reply #8 on: July 30, 2022, 07:30:41 am »
Well, it is hard to tell, but the true current limiting resistor would be a resistor between the pin and the rest of the circuit. You don't have that right now. I don't know how much current this capacitor can deliver. It really depends on how your power supply behaves on power off.

Yeah, point taken.
I'm adding some 10k's in the lines now.
Easy thing to add and cost is trivial
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline gamalot

  • Super Contributor
  • ***
  • Posts: 1397
  • Country: au
  • Correct my English
    • Youtube
Re: Safety of 300uA pull to 12V on IO pin before MCU startup
« Reply #9 on: July 30, 2022, 07:50:56 am »
Since you say that this ADC input pin is used to sense the battery voltage, we can assume that the output of the voltage divider network you use is always less than 6V (the limit voltage given in the data sheet), then 300uA of current for your MCU is safe.

I'm a poet, I didn't even know it. |  https://youtube.com/@gamalot | https://github.com/gamalot
 

Offline PsiTopic starter

  • Super Contributor
  • ***
  • Posts: 10385
  • Country: nz
Re: Safety of 300uA pull to 12V on IO pin before MCU startup
« Reply #10 on: July 30, 2022, 07:55:11 am »
Since you say that this ADC input pin is used to sense the battery voltage, we can assume that the output of the voltage divider network you use is always less than 6V (the limit voltage given in the data sheet), then 300uA of current for your MCU is safe.

Yeah, that's how I read it too. I don't think the battery sense voltage is the issue.

The caps directly across the inputs are more of a concern if VCC falls away faster and they discharge into the IO pin with no current limit.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline gamalot

  • Super Contributor
  • ***
  • Posts: 1397
  • Country: au
  • Correct my English
    • Youtube
Re: Safety of 300uA pull to 12V on IO pin before MCU startup
« Reply #11 on: July 30, 2022, 08:31:47 am »
Since you say that this ADC input pin is used to sense the battery voltage, we can assume that the output of the voltage divider network you use is always less than 6V (the limit voltage given in the data sheet), then 300uA of current for your MCU is safe.

Yeah, that's how I read it too. I don't think the battery sense voltage is the issue.

The caps directly across the inputs are more of a concern if VCC falls away faster and they discharge into the IO pin with no current limit.

There is a resistor connected in series at the input pin of the ADC. In theory, if the resistor is greater than 330 ohms, it is safe for an input voltage of 5V. Although I don't know the exact value of this resistor(will not be greater than 14k ohms, which is the input impedance of the ADC given in the datasheet), in practice I don't think that 100nF cap would cause any trouble.

---

I just looked at the datasheet again and it states that the ADC is optimized for signal sources with less than 10kohm impedance. So if you're still concerned, you can connect an external 1kohm resistor in series with the ADC input.
« Last Edit: July 30, 2022, 09:13:52 am by gamalot »
I'm a poet, I didn't even know it. |  https://youtube.com/@gamalot | https://github.com/gamalot
 

Offline tom66

  • Super Contributor
  • ***
  • Posts: 7334
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: Safety of 300uA pull to 12V on IO pin before MCU startup
« Reply #12 on: July 30, 2022, 08:42:02 am »
It probably won't break the microcontroller permanently.

But one thing to be aware of, if this will ever happen outside of 'startup' then it can swamp the ADC.  The issue is, the ADC is only rated as producing accurate results from 0-Vdd for instance.  It won't be damaged if you go out of that range, but it also might not clip correctly.  In fact, it might even cause adjacent channels to misbehave (I have encountered this behaviour on both PIC32 and TI's TM4C series) which can be a really difficult bug to solve.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 13216
Re: Safety of 300uA pull to 12V on IO pin before MCU startup
« Reply #13 on: July 30, 2022, 09:57:49 am »
In PICs, passing current through the protection diodes of analog-capable pins can lead to all sorts of odd misbehaviors that don't cause permanent damage (but may require power-cycling to recover from), including disturbing or even stopping internal oscillators, shifting internal references which may result in unexpected BOR resets, and of course degrading or corrupting ADC results on other pins.  See Microchip TB3013 for details.  Anecdotally, passing current through the lower protection diode seems particularly problematic as that can lead to current diffusing into the substrate, and I have seen several instances where even a few hundred uA causes massive (>50%) internal oscillator frequency shifts.
 
The following users thanked this post: tom66, thm_w


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf