I'm new to electronics and this is my first circuit. I have some questions about implementing ICSP in this design. This is a bit of a long post with quite a few questions so I'll apologize in advance for its length. Unfortunately I don't have a mentor who I can ping questions off of so any help is greatly appreciated!
- I'm using an Atmel ATtiny10 microcontroller to drive an RGB LED.
- The circuit is powered by two 3V CR2032 batteries in series which provide 6V.
- The batteries are connected to a fixed-output voltage regulator which converts the battery power down to 5V for the ATtiny.
- Three of the ATtiny's four I/O pins are connected to the LED's three anodes via current-limiting resistors (the fourth MCU pin is unused with an internal pull-up resistor enabled).
So far this is pretty basic stuff, and it works on a breadboard.
I'd like to add ICSP functionality so I can program the ATtiny in-circuit when this is moved to a PCB (for initial loading and later if I want to modify my firmware). Here are my questions:
Q: What is the best/preferred way to supply power to the ATtiny during programming (my programmer is an Arduino and not the expensive dedicated programmer from Atmel)?
There seem to be two options:
- Supply power through the existing battery+voltage regulator components, or
- Supply 5V via the programmer directly to the VCC pin on the ATtiny via a header/ICSP pin.
Q: If I go with option 1, do I need to be concerned about isolating the circuit from my programmer/Arduino? The Arduino is powered by a USB connection from my computer and I don't want to fry it. If I do need to be concerned about power isolation here, how is it done?
Q: If I go with option 2, I believe I'll have to put a Shottky diode between the regulator's Vout and the ATtiny's Vin to prevent current from going the wrong way into the regulator (i.e. from the programmer to the regulator's output pin).
A diode here seems to present a number of problems:
- It adds an extra cost to the circuit.
- It adds another part consuming battery power.
- The voltage drop across the diode will cause the ATtiny to see less than 5V at its Vin, which is probably undesirable (due to clock destabilization).
Q: Are the concerns I just listed about the diode all valid concerns? I haven't designed anything with a diode yet so I don't have any experience with operational practicalities.
Q: Is there a different/better way to get power to the ATtiny for programming that I haven't thought of?
Q: Two of the pins used for programming the ATtiny will also connect via the resistors to the LED. What steps should I take to isolate the programmer from the LED?
I ask about this because I've tried to program it with the LED connected and the programmer usually hangs (you can see in the schematic where I connected the programmer, to nets PB0
and PB1
). I had hoped the resistors between the pins and the LED would be enough to isolate the LED but it doesn't seem to do the trick. Disconnecting the LED allows the programming to succeed, however I won't be able to disconnect it once everything is soldered to a PCB.
Q: In a very general sense, what steps are usually taken by ICSP designers to isolate pins that have to be dual-purposed for programming as well as circuit control?
Thank you!