SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!
By evansgp
#199189
Hi

I have a project that I'm using to learn where I have multiple devices connected to an atmega328p over SPI. I started with the Arduino platform and got everything working individually there and am now cutting back to breadboarding the components that I need and getting everything working at the same time.

My problem is that I'm using an ISP header to program the 328p in circuit and I think I need to set the slave select of the other SPI devices to active low and I don't know how to do that. What I'm seeing is that programming the 328p via ISP fails unless I remove all other SPI wiring.

I think I should be "tieing" the SS of the slave devices to 3.3v via a 10k ohm resistor, but then how do I get the pin to go low via a pin on the 328p? I'm currently doing that via a physical button on the 328p's reset pin but I think I want to do this via one of the digital pins. I think I could use a transistor to drain the SS on the slave to ground. Is this right? What would the circuit be?

Thanks!
Gareth
By n1ist
#199199
The pullup resistor (the 10k between the pin and 3.3v) is a lot weaker than the drivers inside the chip. If the 328's pin is in input mode (like it is during reset or ISP), the pullup will make the signal high so the other SPI devices all leave the bus alone. When the 328 is outputting a low, it will overpower the resistor and make the signal low. So each SPI device on the bus would have a separate pin from the 328 driving its chip select pin, each with its own pullup resistor
/mike
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]