PIN 10 SPI CS Question :)

Im currently drawing the schematic for a audio board im going to build.

I have one little question :slight_smile:

I have five spi devices on the spi bus, each one has its own CS pin (four used by 2x mp3 decoders and the other used by dataflash)

I have not chosen PIN 10 for any of my device CS pins

As far as im aware as long as i set PIN10 to an output (stop spi goin into slave mode) im ok!

My question is after i set pin10 to an output can i use it for some thing else (not a cs pin) like flash an LED or some thing?

Iv used all the io in my design and pin10 is the only one left :frowning:

any help much appreciated :slight_smile:

ah found another output i can use :slight_smile:

still be cool to know the answer to my original question though if any one knows :slight_smile:

Just read the docs, says you gotta tie it to ground?

No, no, don't tie it to ground. Where does it say that? SPI.begin () sets it to an output and sets it high. If you have tied it to ground you will overload the pin.

On page 171 of the Atmega328 docs it says:

When the SPI is configured as a Master (MSTR in SPCR is set), the user can determine the direction of the SS pin.
If SS is configured as an output, the pin is a general output pin which does not affect the SPI system. Typically, the pin will be driving the SS pin of the SPI Slave.

So you have to have it as an output, but it can be used for any purpose. One possible purpose is as a SS pin for one of your devices. However any other output purpose would be OK.

ooops yes indeed read that wrong, pull UP resistor not pull down hehe

thank you :slight_smile: