Re: 2313 output pin problem

Robert Baruch <[email protected]> Tue, 23 Dec 2003 13:59:33 -0500
Newsgroups gmane.comp.hardware.avr.general
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Anderas Strodl wrote:

| I have a board here using all the SPI pins as outputs. I am using the
| SPI interface for programming and I didn't have
| to change any fuse-bits.

Looking closely at the pin diagrams in figures 41 through 43 in the 2313
manual, successful use of PB5-7 without blowing SPIEN could depend on
the setting of DDRB. Looking at the logic diagrams, it seems like if you
have
circuitry connected to the pin that considers a high-impedance input as
a 0, then you can probably get away with setting the direction as an
*input* pin. Then setting the pin's bit on PORTB to 0 results in
high-impedance, and setting it to 1 results in the internal pullup
transistor becoming active, which would look like a 1.

Basically, having SPIEN at 0 disables the ability to use the pin as an
output for pins PB5, 6, and 7.

Apparently, if you really need PB5-7, for something, you have to use a
parallel programmer because only parallel programmers (at least for the
2313) can blow the SPIEN fuse and enable the normal use of PB5-7...

| I don't know the exact wiring of your "alf"-type programmer, but I am
| assuming
| it is a simple parallel port adapter which consists mostly of wire.

I think the wires-only programmer is known in avrdude as a "bsd"
programmer. In any case, the schematic I used is here:
http://www.bsdhome.com/avrdude/avrdude.pdf

Basically, it has a buffer between the LPT and the device to be
programmed. No resistors on the outputs.

| I imagine your connections to look something like the following:
|
|           o +5V
|          _|_
|          \ /  I assume you are using a red LED which normally have
|          _V_  a forward voltage of 1.65 Volts
|           |
|          _|_
|         |   |
|         |   |
|         |___|
| AVR PB7   |    __  PB7 LPT port__
| o---------+---|__|---o--------|__|----
|              external       internal
|              protection     protection
|              resistor       resistor

~ Someone has way too much patience.

Aside from the LED limiting resistor being at the top instead of the
diode, and the lack of a protection resistor, that's right... except
that when I have finished programming, I disconnect the programmer so
that the only things left are the LED and its resistor.

So since the programmer has a buffer directly driving the AVR pin,
there's no voltage divider anywhere, and the AVR gets programmed and
verified properly.

| Don't try to remove any protection resistors you might have connected in
| the IO line. I already have burned 2 AT90S2313s while using a adaptor
| without these in a circuit where I used the SPI lines as output lines.

Good advice! So far I haven't hooked up anything to outputs that has a
low-impedance path in it -- just the LED, and later I'll be hooking up
the gates of MOSFETs, so there's basically minimal current being drawn.

Thanks,

- --Rob

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE/6JCV3n80I35hhEsRAieJAJ9LWSo5+JHYLtm3eCiXVIyYnmWfXQCgsOpV
Lu3yO2cTh3b5Lw/osWZvJio=
=ibyo
-----END PGP SIGNATURE-----