In order to be able to program the chip, the programmer must be able to drive the pins that are input to the chip to their right digital levels, and the chip must be able to drive the pins that are output from the chip to their proper digital levels.
So, for example, the SCK
is a signal generated by the programmer and read by the chip. For you to be able to program the chip, the programmer must be able to drive this line both high and low. If you have other components attached to this pin, then then the program must still be able to drive this pin high and low even with those components attached (and hopefully without frying those components in the process!).
In your case, it seems likely that you programmer is not able to drive the pin high and low with the potentiometer attached to it. If you look at that pin using a oscilloscope while you try to program the chip, you will likely see the voltage moving around some driven by the programmer, but the potentiometer is winning and the swings are not close enough to ground and Vcc for the chip to see them as the clock signal.
AI conventional solution might be to use a larger potentiometer if you are connecting the chip to the center tap. It will still work as expected when providing an input voltage to the pin, but because there is higher resistance between the pin and Vcc and ground, the programmer will be able to make wider voltage swings against it.
An unconventional solution is to give the programmer more powerful outputs using a buffer or a pair of transistors. This can help it generate larger voltage swings against the component that is attached to the pin, just be sure that component can take it. I once used this trick to be able to hang a bi-color LED off an IO pin and still be able to use the same pin for programming.
Another trick is to slow down the programming clock (i.e the -B
parameter on AVRDUDE). This can help if there is a part attached to the programming pin that just slows down the voltage swings, like a capacity.
In the other direction of pins that the chip outputs to the programmer (like MISO
), you are limited by the chip's drive capacity - but it is possible to still pick up even small outputs depending on what component is attached to the pin. You could, for example, use a pair of OP AMPs connected between the chip and the programmer to turn a small voltage movement in the center of the range into a digital one that the programmer can use.
Here is an application not from ATMEL that talks about this stuff, but only covers the conventional strategies...
http://ww1.microchip.com/downloads/en/appnotes/atmel-0943-in-system-programming_applicationnote_avr910.pdf