Go Down

Topic: SPI Pins (Read 2 times) previous topic - next topic

J T

I see on the Arduino SPI reference page that pins 10, 11, 12, 13 are for the SPI. I see examples and tutorials that use other pins.

Are the examples that use other pins for SPI wrong?

Here is one example.

http://www.ladyada.net/learn/sensors/thermocouple.html

I have an Arduino Uno.

Thanks
John

johnwasser

You can do software SPI on whatever data pins you like.  I expect that is what the thermocouple adapter library is doing.  The hardware SPI is on pins 10-13.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

scswift

If I'm not mistaken, the hardware SPI is actually pins 11-13.  Pin 10 seems to be most often reccomended as the chip select pin, but as you have to set it high and low manually before you send data with the SPI lib, you could use any pin you want really, and if you want to have more than one chip using the hardware SPI bus then you'll have to if you want to select each chip in turn.

johnwasser


If I'm not mistaken, the hardware SPI is actually pins 11-13.  Pin 10 seems to be most often reccomended as the chip select pin, but as you have to set it high and low manually before you send data with the SPI lib, you could use any pin you want really, and if you want to have more than one chip using the hardware SPI bus then you'll have to if you want to select each chip in turn.


You are right for the most common case of the Arduino being the SPI Master.  In that case the SS pin (D10) is left to user control so it, or any other free data pin, can be used for Slave Select.  If the Arduino is acting as an SPI Slave then the SS pin (D10) is used by the hardware to disconnect the Arduino from the SPI buss when it is not being addressed.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

CrossRoads

Well, not really disconnect, more to indicate "this message is not for you!"
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Go Up