Shared ISP lines.

I'm currently designing a small board based around the ATtiny85. It doesn't do anything particularly exciting, just driving some logic level mosfets in order to sequence some power rails.

Due to the low pin count, I need to connect the mosfet gate pins to the MISO, MOSI and SCK pins.

I have a 100 ohm series resistor between the ATtiny85 pins and the mosfet gate, as well as a 100K pull down from gate to ground.

Is this going to cause any problems when I program the ATtiny85 via ISP ?

I'm just not sure if the mosfet is going to interfere with the programming signals.

Thanks,

Ian.

What does your breadboard experiment indicate?

[quote author=Coding Badly date=1460536396 link=msg=2709408] What does your breadboard experiment indicate?

[/quote]

RS have just delivered the parts, so I'll hopefully find out this evening.

I'd still be interested to know the theory though.

Have a look: http://elm-chan.org/works/avrx/report_e.html

ISP pins will able to share both I/O and ISP functions when some terms are satisfied. When using any I/O pin that also assigned to ISP function, the following must be observed.

Insert a resister between reset pin and reset circuit to avoid interference from the reset circuit. Make sure that ISP action doesn't affect any other functions. Don't drive from external circuit during ISP operation, or a resister should be inserted. Don't connect heavy load such as affects ISP function.

So 100Ohm might be a bit of a heavy load. If you're application also uses buttons or some input I would share the line with that instead of the mosfet.

septillion: Have a look: http://elm-chan.org/works/avrx/report_e.html

So 100Ohm might be a bit of a heavy load. If you're application also uses buttons or some input I would share the line with that instead of the mosfet.

I can try a larger (maybe 1K) resistor if the 100 ohm proves to be too small.

Unfortunately, I only have 6 I/O pins to play with, and the reset pin is already taken, so that only leaves five. I've got three mosfets to connects, so one of them is going to end up on one of the ISP pins. I'll play with it tonight and see what works.

If it comes to it, I can possibly squeeze an SMD 328p on the board, but that's a bit of overkill for the sake of one pin.

Ian.

1k for a mosfet might be a bit much. If it's a on/off mosfet that's fine but for PWM I think it's to much. Then I would implement a buffer of some sort.

It's simple on/off.

Then a higher resistor should be fine. The gate opens a bit slower aka, some extra Ron when it's opening aka, some power dissipation when opening but that should be very limited when it's not PWM.

septillion: http://elm-chan.org/works/avrx/report_e.html

Two things missing...

• Avoid capacitive loads like a piezoelectric buzzer.

• Watch for hidden voltage dividers. Some (most?) commercial programmers include series resistors. When added to the circuit those resistors can create a voltage divider that prevents the voltage at the pin from reaching a high / low enough level. In this circumstance, an Arduino configured to be a programmer solves the problem; just connect the programmer directly to the target and do not include series resistors.

[quote author=Coding Badly link=msg=2709941 date=1460557662]

• Watch for hidden voltage dividers. Some (most?) commercial programmers include series resistors. When added to the circuit those resistors can create a voltage divider that prevents the voltage at the pin from reaching a high / low enough level. In this circumstance, an Arduino configured to be a programmer solves the problem; just connect the programmer directly to the target and do not include series resistors.

[/quote]

If he is connecting the wire from the programmer correctly, ie, between the 100 ohm resistor and the Tiny85, this shouldn't matter, should it?

It only matters if there's a pulldown on the gate, or something - but even that is fine, unless it's a bizarrely strong pullup.

ian332isport: ...as well as a 100K pull down from gate to ground.

DrAzzy: It only matters if there's a pulldown on the gate, or something - but even that is fine, unless it's a bizarrely strong pullup.

1k between the programmer and the target. (1k seems to be a common series resistor.) This will be at VCC or GND.

100k between the target and GND.

Input high is 0.6 * VCC at 5 V or 3.0 V.

Vout = Z2 / (Z1 + Z2) * Vin Z2 = 100k Z1 = 1k Vin = 0 or 5

Obviously, when Vin is 0 Vout is also 0 so we don't need to worry about that case.

Vout = 100000 / (1000 + 100000) * 5 Vout = 4.95 Well within the threshold for HIGH.

However, 2k has also been mentioned on this forum as a series resistor... Vout = 100000 / (2000 + 100000) * 5 Vout = 4.90 Still good.

And, 10k is a common pull-up resistor.... Vout = 10000 / (2000 + 10000) * 5 Vout = 4.17 Still good.

Including the 100 resistor... Vout = 10000 / (2100 + 10000) * 5 Vout = 4.13 Still good.

DrAzzy: If he is connecting the wire from the programmer correctly, ie, between the 100 ohm resistor and the Tiny85, this shouldn't matter, should it?

Nope.

I guess I might be missing something here since you haven't provided a schematic, but if you are using SPI pins as GPIO, isn't it going to be a problem that your devices driven by the SPI pins are going to be turning on and off during the SPI mode ISP programming ? Why is that not a concern ?

@raschemmel, thank you for asking. I meant to follow-up with something similar. I blame @DrAzzy for the distraction that led to my failure. ;)

And, given the possibilities with "MOSFET", what is on the other side is a concern.

Well, he'd figure that out pretty fast... though probably good that we warned him.

I meant to ask "Is that a trick question ?"

Just hooking things up as I type. I’ve got the ATtiny85 running the blink sketch, so basic ISP is up and running. Just about to connect a MOSFET to see what happens.

Not concerned about what the MOSFET is controlling, as this can be completely isolated. If the MOSFET turns on/off during programming, it’s not going to be an issue. I’m just interested if the MOSFET gate and associated resistors is going to upset the ISP programming.

Ian.

I'm just interested if the MOSFET gate and associated resistors is going to upset the ISP programming.

Considering a mosfet gate is a high input impedance there is no cause for concern. It's about as likely to interfere with the programming as it is for your car to roll uphill...

I've tried with the MOSFET gate connected to MOSI, MISO & SCK, and successfully uploaded a sketch without errors.

For the record, I'm using an AVRISP MKII for the upload. I assume the result would be similar with other devices.

Ian.

raschemmel:
Considering a mosfet gate is a high input impedance there is no cause for concern.
It’s about as likely to interfere with the programming as it is for your car to roll uphill…

That’s the sort of answer I was looking for when I first posted.

Considering a mosfet gate is a high input impedance there is no cause for concern.
It’s about as likely to interfere with the programming as it is for your car to roll uphill…

That’s the sort of answer I was looking for when I first posted.

It’s really the kind of answer you only get from a wiseguy… ;D

For the record, I’m using an AVRISP MKII for the upload. I assume the result would be similar with other devices

It would if you were using the same pins, the same program and the same sketch ? (actually , the sketch is irrelevant) . Does the light turn on the same when you use your left hand instead of your right ?