I’m designing a custom PCB around an ATMega32U4. The 32u4 will talk to another onboard component via the SPI bus. Since the SPI pins (MISO, MOSI, SCK) are also used for ISP programming could other onboard component attached to the SPI bus interfere with programming the 32u4? If so, what is are typical ways to deal with other onboard devices on the SPI bus during programming?


As per AVR042: "AVR Hardware Design Considerations", subsection 4.1.1, "Shared Use of SPI Programming Lines":

If additional devices are connected to the ISP lines, the programmer must be protected from any device that may try to drive the lines, other than the AVR. This is important with the SPI bus, as it is similar to the ISP interface. Applying series resistors on the SPI lines, as depicted in [figure 4-2], is the easiest way to achieve this. Typically, the resistor value R can be of 330Ω.

See AVR042 for further details and considerations.

  • \$\begingroup\$ Thanks, that’s a great resource. Does it make sense add the 330 ohm resistors to the board itself or connect them externally during programming? I took a peek at the SparkFun Pocket AVR programmer schematic [1] at it had 100 ohm resistors on MOSI and SCK (but not MISO). Are these likely protection resistors or something else? [1] sparkfun.com/datasheets/Programmers/… \$\endgroup\$ – Jeremy Raymond May 29 '18 at 2:45
  • \$\begingroup\$ If you examine figure 4-2 then you'll notice that the resistors are connected to the SPI bus, not the ISP connection. Connecting them between the programmer and the device may cause the waveforms to violate specifications. The resistors on the programmer are for protection; the values are likely too small to change the waveform too much. \$\endgroup\$ – Ignacio Vazquez-Abrams May 29 '18 at 3:02
  • \$\begingroup\$ Is the following correct? In the picture the AVR block is the 32u4, the SCK, MOSI, MISO, RST lines pointing up are connections to the programmer, and the resistors to the right are outputs to the bus to which the rest of the SPI devices are connected. \$\endgroup\$ – Jeremy Raymond May 29 '18 at 3:10

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.