ISP And Other ICs Connected To The SPI Pins

Hi Everyone,

Does anyone have any advice on how the hookup goes for ISP in the case where the SPI pins of the avr is also connected to to other ICs on board?

For my specific situation, the ICs are bidirectional open drain pins that should not be driving during programming, but I can't guarantee it. I've looked through a lot of documentation on avr ISP where other ICs might be attempting to drive the avr (attiny85, in this setup) during programming, but I've only found some vague references to "add resistors, the values depends on the system in question". Does anyone have any advice on what the values of the resistors might be?

To further complicate things, the pins in questions are part of a software controlled I2C bus, so the lines themselves have to have a pull-up resistor in addition to the "ISP isolation" resistors. This looks like a series resistor (Rs) connected from the attiny to the I2C line (SDA, for instance) to the pull-up (Rp). My rule of thumb is that the pull-up resistor has to be around 15x the serial resistor so as to guarantee a good VIL at the sink IC, but also the pull-up can't be too big so as to no slow down the "one" state of the I2C bus.

So for instance, if Rs is 100, Rp is 1.5k. Is 100 a high enough number to guarantee good programming of the avr if the I2C bus on the other side of Rs gets pulled low for some reason ?

Thanks in advance,
Jose

You're right, not very discrete direction given as to values.
Think you'll have to do some experimenting.
If you can make sure the other device (attiny) is in reset while this one is, its outputs will be off and its IO pins not driving either.

Why have software I2C when you have real I2C hardware pins?

atmel-AVR042-avr-hardware-design-considerations_application-note 7-2013.pdf (758 KB)

As for the value of series resistance the absolute maximum current rating will determine that.

If your datasheet for the ICs says something like 20mA then your resistance could be around 300 Ohms, if the devices can be driven with much lower current, then higher resistance can be used and provide more protection to your ISP lines.

I would attempt to separate the SPI and I2C lines.

Hi CrossRoads,

The reason why I2C is "software" is because there are 3 slaves with the same address and no way of changing them, so they have to have 3 different SDA pins. Of course, I can have some sort of "multiplexor" hardware, but that's beyond the scope of this posting. I'm fine doing the software since I've done it before...

As to the "reset".. The problem really is the not all of the devices in the bus has a reset line, but I am careful to make sure that the shared SDA/SLC lines out of the attiny truly connect to the SDA/SLC lines in the I2C slave, which should not be driving. The situation is really when the slave randomly detects a "start" and by sheer luck, the address of one of the slaves matches, so that the slave starts to drive the SDA/SLC lines...It's probably a small chance, but just want to make sure I cover the case.

Jose

@ApexMOEng: Can you give me more detail on how you computed 300 ohms series resistance given 20mA input current.

In my particular situation the data sheet says:

"Input current to any pin except VDD = +/-10 mA" for 3 of the slaves and

"Low/High level input current on SCL/SDA pins = 1 uA" for the last slave

So this adds up to 30mA + 1uA ? And if so, how do you compute Rs given 31ma? (I rounded 1uA to 1 mA :slight_smile: )

The system vdd is 5.5, BTW.

Thanks,
Jose

  1. V=IR.
  2. Rs >= R

Absolute max on AVR side = 20mA
Absolute max on imaginary IC side = 20mA

20 is equal to 20, so I choose the lowest of the two (The critical current) and choose 20.

5 / .02 = 250

300 >= 250 . Since I like round number resistance, and they are slightly easier to come by.

Depending on what you use as a ISP, there might be resistance on the data lines. This means your Rs creates a voltage divider, so there is some consideration to keeping Rs low.

If you use a Arduino as an ISP you don't need to worry about this.

This procedure assumes the SPI lines are not being hijacked.

@ApexMOEng: Thank you for the analysis... I guess ultimately I would like to guidance as to what Rs value to use for proper protection of the isp and proper programming.

In my setup, Vdd = 5.5 ,

so 5.5 / 31 = 177. I assume I can use 100, so Imax = 5.5/100 = 55ma, which would be sufficient for my 1.5k pull-up vs 100 pull-down on the SDA/SCL line (100/1600) * 5.5 = 0.35, which is below Vil in all the slaves datasheets. But, how much did I compromise the programming in the event of a pulldown on one of the slaves?

In my case I will be using an Arduino Uno for programming.

Thanks,
Jose

No ideas? Bump