Can an ATtiny85 be programmed when an SPI pin has a pullup resistor connected to it?

TLDR: (edit)

  1. Can an Attiny85 be programmed via SPI when an external pullup resistor (390k Ohm) is attached to one of the SPI Pins?
  2. If not, can it be programmed when a piezo speaker is connected between one of the SPI pins and ground?
  3. If not, what options do I have to fit 2 buttons, an led and a piezo onto an Attiny85, such that the device can be programmed whilst these components are connected?

Original post:
Hi, I have 4 things that need to be connected to my attiny85:

  • 2 buttons (external pullup, normally open)
  • an LED, and
  • a piezo speaker (passive, from uC pin to ground).

3 of the Attiny's 5 GPIO pins are part of the SPI interface, so two of my components would need to be connected to pins that are also used to program the uC.

I would like to program the device after the components are already connected to the microcontroller.

My assumptions:

  1. The buttons can't be connected to the SPI pins because the external pullup pins will keep the pin high.
  2. The LED can be connected to an SPI pin.
  3. The piezo can't be connected to an SPI pin because it will act like a capacitor and mess up the signals.
  4. trying to put something on the reset pin is a bad idea?

Assuming my assumptions are correct, I will be one pin short.
Any ideas for a solution will be appreciated.
Thanks in advance for your assistance.

Background info:
I am doing a pcb design for a project. If I go ahead with manufacturing, I would like to have the fab assemble the pcbs, and program them myself when I receive them. This means that I will need to program the uC after the parts are already connected.
I have no experience so far with pcb design/printing, so feel free to point out any misconceptions.

My current ideas:

  • use a Attiny84 so that there are more pins. (more expensive, bigger)
  • Have everything assembled except for 1 resistor connecting a component, which I solder on by hand after programming the device. (feasible but more effort, production batch size is about 10-50)

Additional enquiry:
Currently, my prototype uses a DIP package ATtiny85. I am planning to use an SOIC ATtiny85v for the final version, so that it can operate for longer on a coin cell battery. What are some differences between the DIP/SMD packages that I need to watch out for? I am already aware that a 0.1uF decoupling capacitor need to be placed as close as possible for the uC to function properly. I am planning to place plated through holes on the edge of the board for programming the device.

General Info:
Attiny85 1MHz 3v | Attinycore using Arduino uno as ISP
CR1220 battery
piezo: (www.murata.com/en-us/products/productdetail?partno=PKLCS1212E4001-R1)

Schematic:

I have edited the title and post in an attempt to make the meaning clearer for other users. Hopefully someone will be able to assist with my problem. Thanks.

I have a few custom boards with Attiny85 and I2C sensors connected and I can still program them with ICSP just fine

The SPI MOSI and SCK share the same pin as the SDA and SCL, and I have pull-ups on those pins. But then again, I'm using a different programmer (not Arduino UNO as ISP).

Also, you can buy SOIC to DIP adapters that you can use to program your chip before soldering them on your board

bbb

1 Like

Try it on a breadboard. (with a stronger pullup)
How will the Attiny85 be powered while being programmed ?

The Attiny85 will be powered by 5v from the arduino whilst being programmed.
Could you clarify what you meant by "a stronger pullup", and why it would be necessary?

The reasons why I am asking on the forum instead of just testing it myself:

  1. Unfortunately presently I cannot access my prototypes/breadboard.
  2. I have no experience with the SMD version of the Attiny85 and how it will perform on a circuit board, compared to the DIP package on a breadboard. So any results I find on my own tests may not apply on a pcb. Therefore, I am hoping that the forum will be able to provide some advice based on their experience.

If I was wondering if a 390K pullup could be a problem, I would try a 100K
pullup. If programming works; I can use the 390K with a good safety margin.

1 Like

You can use a pullup or pulldown on any SPI pin as long as the value is... honestly anything over 1k is safe.

What Atmel used to tell people to do (and presumably what Microchip tells people using classic AVRs) to do if they had stuff that held the SPI lines in some state and caused a problem for programming was to put a 1k resistor in the middle of each SPI line, and have an ISP header connected to the chip's side of that resistor, while everything else was on the other side,.

2 Likes

Following on from this see 4.1.1 here: http://ww1.microchip.com/downloads/en/AppNotes/AN2519-AVR-Microcontroller-Hardware-Design-Considerations-00002519B.pdf

2 Likes

There are adapters that allow the SMD versions to be soldered onto an adapter that then plugs into the breadboard.

Cannot myself see how or why there would be a difference between the DIP and SMT versions, in terms of programming.

1 Like

Virtually the same within the operating conditions that make sense for a device like this. They're electrically identical; the only difference will be in marginal aspects such as pin-to-pin capacitances which will be slightly different. But you'd have to do some pretty outlandish stuff and operate the device under conditions that are way beyond what's sensible in order to suffer any problems from this.

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.