Question: My Circuit is:

USBTinyISP <-usi/icsp-> ATTiny85 <-usi/i2c-> [MCP4725](https://www.adafruit.com/products/935).

That is, the [USI](http://www.atmel.com/Images/doc4300.pdf) pins used to program the t85 are also used for i2c in the final circuit.

When I try to flash-program the t85 in-circuit, it fails. If I disconnect the 4725's SDA line during programming, it works. I **assume** that the 4725 is confusedly pulling SDA low to ACK I2C packets and thus interfering with the shared MOSI line during programming. But if so, then my ICSP isn't truly In-Circuit :(. That is, if the circuit was permanent then I couldn't program the MCU except by removing it. Yet I see many circuits with ICSP headers on them that presumably work.

How do circumvent logical interference from the circuit when I program via ICSP? The only solution I can think of is to use a microcontroller with dedicated ICSP pins. But is there some other common-practice solution to this problem?

Answer: 
Add a suitable resistor between any external circuit *that drives an ICSP pin* and the AT chip. The resistor must be high enough that the ISP circuit can override the the external circuit, yet low enough that the external circuit can still drive the AT fast enough. You could start with 1k.

An ICSP capability is a combined property of the target chip, the programmer, *and the target circuit*.
There are very many options, that you may not think of right away.

One is:

![schematic](https://i.stack.imgur.com/fSE4Z.png)

[simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2ffSE4Z.png) – Schematic created using [CircuitLab](https://www.circuitlab.com/)

This way the Tiny will still likely be able to drive the DAC at 400kHz at least, maybe even faster, depending on the length of your wires. The DAC still has enough "strength" through the 470 Ohm resistors to pull the lines low enough to be seen as a zero on ACK or when holding the SCL line, but usually an ICSP programmer is strong enough to "win" from the 470 Ohm. At least on SPI. The even smaller TPI-requiring chips like the Tiny10 and Tiny20 wouldn't be able to win from 470 Ohm, but SPI is hard driven both by the Tiny85 target and the programmer.

If you want even more control/ensurance, you can add a PNP transistor driven by any free pin, that you actively pull low. When your Tiny is reset for programming, the default resistor R1 will pull the transistor closed:

![schematic](https://i.stack.imgur.com/GrZzU.png)

[simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fGrZzU.png)

In this case the 470 Ohm resistors prevent the DAC from "powering up" from voltages on the data lines. This is, in my opinion a less neat solution, but if the first one doesn't work, this one might.

From there on there's all kinds of things like I2C buffer chips that can be enabled/disabled and more such, but it all increases in complexity.

You can even also connect the PNP transistor in this example through another NPN to the RESET pin of the tiny, automatically powering down the DAC when the Tiny's reset is activated.

But again, putting signals on a chip that has no power is never a really neat solution, in my opinion, and if the resistors wouldn't work I would first look at buffer chips.