SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on the software and hardware for Atmel's STK standard.
By jernfrost
#156732
What do I need to keep in mind while programming an AVR chip placed in a circuit? So far I have disconnected everything before I program, and likewise I have disconnected the programmer when running the AVR in a circuit.

But it is possible to keep the programmer connected while my AVR chip has power connected and runs blinking LEDs? Alternatively can my pushbuttons and LEDs be connected to the AVR chip while I program or can that mess up the programming? It seems to me that the whole point of ISP is that one should be able to program a chip placed in a circuit. However I have not found any discussion of details. E.g. if there are things I have to watch out for when doing this.
By jremington
#156779
Almost all AVR (ATMega - type) programmers commonly in use are designed to program the chip while in circuit. The AVR chip must be powered by a stable power supply while programming, or it can be bricked (for example, if rechargeable batteries fail). Most people do not use the programming pins (MOSI, MISO, SCK) for other purposes but if you do, there are published guidelines as to what sorts of loads can be connected to them during programming.
By jernfrost
#156782
Thanks for the advice, I searched for this info as you suggested. I found this in the ATMEL AVR ISP user guide http://www.cs.ou.edu/~fagg/classes/ame3 ... isp_ug.pdf:
If the MOSI, MISO or SCK lines are used as general I/Os in the application, it is recom- mended to use series resistors between the load and the AVR as shown in Figure 3-5. The AVRISP lines should be connected directly to the AVR pins, without any series resistors.
I found this documented on page 6 of the Atmel AVR042: AVR Hardware Design Considerations document.
http://www.atmel.com/images/doc2521.pdf

For anybody else trying to do this, they also recommended a minimum of 10KOhm pull up resistor on RESET.