Pages: [1]   Go Down
Author Topic: SPI question - Scope of slave pin(s)  (Read 352 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 48
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I have a general understanding about how SPI works. I understand when your slave select pin goes low, communication begins. If you make pin 10 output high you can use another pin as the slave. Say, if you have another device on pin 4, you can switch between the two. Pulling each one low when you need it to communicate.

However, what happens if you are using another digital pin, say 6, used for a purpose other than SPI communication.  If you change that to output low, will that interfere with the communication with the other devices using SPI(if they happen to be low at the same point)? If so, is there some way to isolate pins, not permitting them to interfere with the SPI communication of the other devices?

Thanks,

-diesel

Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 98
Posts: 4806
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not completely sure what you're asking, diesel.

SPI has Master and Slaves. Master has pins to select Slaves with and Slaves have CS and only operate when CS is LOW. But how those are wired depends on you SPI devices and what you want to do. SPI devices like shift registers can be daisy-chained. Many can be run on a single Master SS (Slave Select) pin, they all select and run at the same time. A Slave does not need to be directly controlled by the Master at all, doesn't always need a pin.
With the right setup, Master and Slave status could switch around between MCU's on the bus.

But you don't use pin 6 for SS and pin 6 to run some other line unless you have a trick in there, it either works out or it doesn't.
Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 535
Posts: 27048
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't understand your confusion.
Say you had two devices doing SPI comm's, both connected to 11-12-13, one to 10 for SS and one to 4 for SS.

Pin 6 has nothing to do with either in your description.
You could read from it and write to it with out bothering the SPI devices.
Each SPI.transfer( ) will be accompanied by a burst of clock pulses on the SCK pin, no transfers occur otherwise.
Logged

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.

Offline Offline
Newbie
*
Karma: 0
Posts: 48
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

Thanks for the replies. I think that I understand. I thought pin 6 could interfere with SPI communication, but for that to happen it would need to be hooked up to miso,mosi, and clk otherwise it has no effect on the spi port.

Thanks,

-diesel
Logged

Pages: [1]   Go Up
Jump to: