1
\$\begingroup\$

I'm developing a project that involves an attiny85 that is already soldered and with several components and sensors connected to it (on the PCB)

Can I program the attiny85, with the other components connected to it? Or should I preprogram it before soldering to the PCB?

\$\endgroup\$
2
  • \$\begingroup\$ That entirely depends on what is connected, and how. Naturally this is unanswerable without a full schematic of the circuit. \$\endgroup\$ Commented Jul 27, 2020 at 4:05
  • 4
    \$\begingroup\$ Here's an app note telling you how to make sure your design is compatible with in-circuit programming ww1.microchip.com/downloads/en/appnotes/… \$\endgroup\$
    – bigjosh
    Commented Jul 27, 2020 at 4:26

2 Answers 2

3
\$\begingroup\$

It depends on your circuit.

You need to make sure nothing puts voltages on programming pins (PB0, PB1, PB2, RST) while the programming is in effect.

If you design your circuit such that those pins are connected to LEDs or normally open pushbuttons, you will be able to reprogram it just fine.  If you connect other devices to those pins, you'll need to disconnect them somehow. 

For example, in one of my devices I had a piezo speaker between PB0 and PB1. In order to program in the circuit, I had to put a jumper in series with the speaker, and remove it while programming.

\$\endgroup\$
7
\$\begingroup\$

Sure, if you plan ahead a bit. Pretty much every modern MCU family supports "in-circuit" (or "in-system") programming, usually involving just a few pins. You just need to bring those pins out to a connector, and make sure that any other I/O functions that might be connected to them won't interfere with (or be adversely affected by) the programming protocol.

Sometimes a manual jumper or two is required on really low pin count devices if you can't otherwise arrange the I/O as needed.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.