12
\$\begingroup\$

My usual method of reprogramming AVRs (so-far limited to ATtiny13 and ATtiny2313) is to disconnect the chip from the host circuit, plug it into another breadboard with all of the ICSP hookups in place, program, then replace. However, I keep hearing that one can program the chip in place (which is, I understand, the whole point of ICSP).

Are there any special hardware considerations one has to take into account before programming the chip in situ? For instance, I worry that the ICSP process may damage circuit components connected to the same AVR pins which are used for ICSP. Does one occasionally need to add diodes or some other kind of buffering to protect these components?

I know this question sounds kind of vague, and I guess it is - but I've not provided details of my particular circuit because I'm interested in more general rules of thumb. I.e. does one never have to worry about this, or does the answer really depend on the particular circuit the MCU is a part of?

\$\endgroup\$

3 Answers 3

15
\$\begingroup\$

I've used ISP for just about every AVR board I've done; it's nothing to be afraid of. The AVR ISP mkII manual gives a pretty good summary of the limitations you need to look out for in the "Target Interface" section. Basically, if you run the MISO/MOSI/SCK pins directly to the programmer and have about 820 ohms between them and the rest of the circuit (and aren't doing anything funky with the reset pin) you're okay. I wouldn't worry about the ISP damaging other components; it's not a high voltage programmer. The signals all run at 5V, so if it can damage an external component, so can your microcontroller.

If you're really stuck with a board that doesn't permit ISP programming, I'd at least try to use a ZIF socket for your programming board. They're pricey, but it will greatly improve your quality of life.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks for the link - that's exactly what I'm after. I'm not actually using a real AVR ISP - just an appropriately programmed arduino. (!) I'm replacing this with a Bus Pirate in a few days, so throwing together a board with ZIF sockets is definitely something I'm planning to do. My current procedure is extremely ugly! \$\endgroup\$
    – Tim
    Oct 30, 2010 at 2:23
1
\$\begingroup\$

Use a jumper or a switch so that you can physically disconnect the ICSP header. This way you can share the pins with other functions without worrying, and without having to fiddle with your other components.

This seems like the most obvious and safest solution, and it's what I use.

(My first answer was deleted, so I have tried to add more detail).

\$\endgroup\$
1
  • \$\begingroup\$ How would that work? Then, when the switch/jumper is connected, the pins will still be connected to the rest of the circuit. \$\endgroup\$
    – eeze
    Mar 2, 2019 at 1:12
0
\$\begingroup\$

Unfortunately, you cannot do in circuit programming for your AVR's if the pins are shared by other functions, for example lighting LEDs. While it might work, it's not guaranteed as it may cause the programmer's or µC's outputs to drop too low for it to work.

One other alternative is to order your chips pre-programmed. I know Microchip offers this for some of their chips, but I'm not sure about Atmel.

\$\endgroup\$
3
  • \$\begingroup\$ Oh well, I suspected this. I'll just have to keep doing things my slow and clunky way, I guess. (Oh, and no chance getting Atmel to do pre-programming for me, I'm just a lowly hobbyist. :-) ) \$\endgroup\$
    – Tim
    Oct 30, 2010 at 1:31
  • \$\begingroup\$ Microchip charges ~$40 "setup fee." Again, unsure about Atmel. If you're ordering in the 10-100 range, it's probably worth it. \$\endgroup\$
    – Thomas O
    Oct 30, 2010 at 1:33
  • 3
    \$\begingroup\$ I've programmed plenty of boards with other loads on the SPI pins, particularly LEDs, with no problems at all. Just be careful not to have anything else drive the signals. This means, for instance, if you have an SPI device connected, give it a pull up resistor or similar to keep that too in reset or unselected. \$\endgroup\$ Oct 30, 2010 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.