4
\$\begingroup\$

I made a board with an AVR Attiny MCU and an ISP connection. I missed that I made the SCK pin an output for an LED. Luckily, this arrangement seems to work; I can program the chip just fine. But, during programming the SCK signal from the programmer is driving the LED on. Is this ok in principle or did I just get lucky that it works?

Please see the attached schematic which shows basically how my board is connected during programming. Assuming the following- the SCK pin (PB2) must be used as the LED output pin, the value of R1 cannot be increased, and the programmer will never be connected while the SCK pin is driving the LED- what could I have done to the circuit to improve the situation?

ISP SCK Line Shared With LED

\$\endgroup\$
  • \$\begingroup\$ To me it sound like you are lucky, see this answer. \$\endgroup\$ – hlovdal Apr 1 '16 at 22:44
3
\$\begingroup\$

what could I have done to the circuit to improve the situation?

Most Arduinos have a LED on Arduino header pin 13 - the SCK pin.

Some random ideas in no particular order:

  • have a jumper or even a switch that isolates the LED.
  • use an ultrabright LED with a higher valued resistor?
  • provide a socket for the ATtiny and do programming off-board.
  • use a FET to buffer the LED (high impedance input).
\$\endgroup\$
3
\$\begingroup\$

Well, there are some rather theoretical problems you should be aware of.

  1. Adding a DC load onto your SCK line will reduce the maximum voltage that the chip will see during programming. This is because you can never be sure on internal resistance of the programmer's outputs. It may have a 100-470 ish Ohm series resistor to prevent any sort of damage. That means driving a load with pretty much the same resistance will kill half of your waveform.
  2. Diodes tend to have certain capacitance across themselves. This mainly causes problems during the switching transition (from reverse to forward bias, if I remember correctly). So, you may find your SCK signal doing all sorts of ringing and what not.

But anyway, I would be more concerned about the former. You may get a new programmer with higher series resistance and it will stop working.

So, if you really have to pins to spare, get a transistor and drive the LED with it. I'll provide more info if needed.

Cheers.

\$\endgroup\$

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.