I am wondering what the safe transient peak current is for an Atmel AVR output pin.
In my specific application I am driving a STP16NF06L logic level MOSFET directly from an ATTiny85 output pin with an 8Khz PWM. Without a dedicated gate driver there is a trade off between gate current flow and heat dissipation due to switching time.
The Arduino hardware specs (e.g. Uno) suggests a 20mA maximum and the Atmel datasheet suggests an absolute maximum of 40mA sink/source current for an individual IO pin.
The total gate charge is 7.3 nC, so there is a transient spike in current when the gate charges and discharges.
Some tutorials don't use a gate resistor (theoretical 200mA peak current!), forum posts suggest a 220 ohm gate resistor (theoretical 20mA peak current).
I used an oscilloscope to measure voltage drop across a 100 ohm gate resistor which indicated a 25mA peak source and 30mA peak sink currents flowing for 200 nanoseconds. See here for details.
So what I'd love to understand is whether it is safe to expose an Atmel AVR to peak current loads under 40mA for less than 200ns.
I don't understand. Why would it not be?
While you are analyzing current though the processor bear in mind there are other limits (per-port and per-VCC-GND pair).
Thanks, my other pins are digital inputs, so my overall current usage should be well below the 200mA max for an ATTiny85.
The Arduino Uno board spec states: "Each pin can provide or receive 20 mA as recommended operating condition." So I assume sinking 40mA continuously would be bad for the Microcontroller, the 20mA limit must be based on some physical constraint.
I am sourcing/sinking 25ma/30ma every 125 us, but only for apx 200 ns.
So my question is - is it acceptable to exceed the Ardunio 20mA recommended operating condition in this way? Will my design be reliable, or will my microcontroller eventually fail?
25mA every 125uS for 200nS (using direct port manipulation?) should be fine, limited to no more than 8 pins all at once for a DIP (200mA total), 12 pins on a SMD part (300 mA total), and spread among the ports per the datasheet:
3. Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:
ATmega48A/PA/88A/PA/168A/PA/328/P:
1] The sum of all IOH, for ports C0 - C5, D0- D4, ADC7, RESET should not exceed 150mA.
2] The sum of all IOH, for ports B0 - B5, D5 - D7, ADC6, XTAL1, XTAL2 should not exceed 150mA.
If IIOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current greater than the listed test condition.
4. Although each I/O port can sink more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:
ATmega48A/PA/88A/PA/168A/PA/328/P:
1] The sum of all IOL, for ports C0 - C5, ADC7, ADC6 should not exceed 100mA.
2] The sum of all IOL, for ports B0 - B5, D5 - D7, XTAL1, XTAL2 should not exceed 100mA.
3] The sum of all IOL, for ports D0 - D4, RESET should not exceed 100mA.
If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater than the listed test condition.
Thanks.
Port manipulation is through an 8Khz PWM. The 200 ns spike is due to the capacitive load of the MOSFET gate. I know the duration of the spike as I measured with an oscilloscope.