Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Re: ATtiny26 schematic

2004-12-31 by David D. Rea

On Wed, 2004-12-29 at 20:44 -0500, ethan@bufbotics.org wrote:

> 4) No pull-ups needed on MOSI, MISO & SCK. I understand that they aren't
> needed if I'm not using those 3 pins for general I/O use, but according to
> the same AppNote mentioned above (AVR042), in figure 5 on page 6, they
> recommend 4.7k resistors in between the pin and any I/O load.  SOOOOO,
> even though I didnt connect anything in my schematic, let's pretend I was
> going to use B0-2 for something else.  Do I need a resistor in the
> following situations:
>     * using a pin as output
>     * using a pin as input
>     * using a pin as PWM output
>     * anything else?

What you use the pin for in "real life" is fairly irrelevant - the 4K7
resistors are there to limit current to any other circuitry while you're
in programming mode. They're meant to keep the programmer from sourcing
excessive current to other portions of your circuit.

Just be careful with these if you're doing anything high speed. Say for
instance you've got your 4K7 resistor between the programming line and
the "outside world" and that outside world happens to be the gate of a
FET. And you happen to be using that FET as a PWM driver for something
big. Remember that you have an R-C LPF at that point, created by the
current-limiting resistor and the (potentially sizable) gate capacitance
of the FET.

So you set up your FET-gated PWM'd jobbie, set the PWM frequency for
1MHz, and nothing happens. This is probably because the FET's gate
voltage is never getting above the threshold voltage since you're just
barely starting to charge the gate cap with each PWM cycle.

The 4K7 resistors also work the other way around. Let's say you've got a
voltage divider between Vcc and Ground, giving you a sampling voltage to
detect a low battery condition. And since there aren't any ADC inputs
muxed into the SPI port, let's say you're doing some spiffy schottkey
effect stuff with the digital IO port to determine if your batteries are
low. Work with me here people :)

If that's the case, then your voltage divider would normally force the
voltage on that programmer line. But since you've got the 4K7 resistor
in there, it the programmer can pull the line either way it wants. In
normal (non-programming) operation, the leakage current on the IO pin is
very low, so microamps at most flow through the 4K7 limiting resistor,
thus keeping your measurement error minimal.

OK enough hot air out of me for a while... :)

Dave

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.