SPI Communication during Programming

avrispmicrocontrollerresistorsspi

I am using the ATtiny861a and have made it so that the SPI connects to a Radio and an external memory source VIA two different chip select pins but sharing the same MISO/MOSI/CLK line.

Correct me if I am wrong, but are there two different ways that I could wire ISP programming into the circuit? The first way being that I need to put a resistor in each MISO/MOSI/CS/SCK line before the 'Slave' and the other way is that I put a Pull-up/Pull-down resistor into the CS lines. I found this on another site. ( http://www.societyofrobots.com/robotforum/index.php?action=dlattach;topic=10394.0;attach=4420;image )

Which way of programming the circuit would be better(more energy efficient during non-programming/easier installation)? The circuit will be a wireless node so it will not be "functioning" when we are programming it.

(from the link above) If I am using 1.8V to power my circuit, would I change the pull-up resistors to be connected to 1.8V? Is there any downside(more power consumption) to use Pull-up versus Pull-down? Are Pull-up/Pull-down resistors interchangeable or can they only be attached to certain pins? If power consumption is important, what resistor values should I use?

Best Answer

If the slave devices are true slave-selected SPI modules, if their Clock Select is pulled high they should put all their outputs to tri-state and stop listening to their inputs.

So the schematic you linked does work. Just imagine the +5V says "VCC", because it should. The pull-up should always go to the VCC of your total device.

In that system only pull-ups will work, because the CS's of the slave devices need to go high in programming mode, when you program an Atmel it goes into reset and its outputs go tri-state (floating). So the resistors will automatically pull the CS high.

What resistor value will still work is dependent on two things: Your programming speed and the capacitance of the CS traces in your device. As I do not know either I cannot advise you fully, but on average I'd estimate 10kOhm should be fine for a small-ish device and a programming speed at or below 250kHz. That'll probably allow the CS of the slave to be charged up to the high before the first useful clock pulse with standard AVR programmers.

Anything much higher than 10k at 1.8V will not offer you savings that you'll notice. At 1.8V the 10k will only drain 180uA when the SS is asserted, and I'm willing to bet that the switching and communications actions in the AVR will use much more than that, let alone the slave device.

You can experiment with 22k and 50k if you want, but stay realistic about all the parameters: When CS is low, you're communicating. Communicating is a reasonable drain in itself.