Controlling SS on SPI with an Atmega328p

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

Moderator: phalanx

Post Reply
Posts: 1
Joined: Fri May 11, 2018 11:58 pm

Controlling SS on SPI with an Atmega328p

Post by evansgp » Sat May 12, 2018 12:09 am


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?


Support Volunteer
Posts: 1034
Joined: Wed Mar 22, 2006 11:02 am

Re: Controlling SS on SPI with an Atmega328p

Post by n1ist » Sun May 13, 2018 2:21 pm

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

Post Reply