Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

In SPI how a slave communicates to the master

Status
Not open for further replies.

aandavan

Advanced Member level 4
Joined
Aug 31, 2006
Messages
104
Helped
8
Reputation
16
Reaction score
7
Trophy points
1,298
Location
india
Activity points
1,918
Hi,
I have a doubt with SPI communication. The master can communicate to the slave by selecting the CS pin of the slave so that the master can communicate to the slave. If the slave needs to communicate to the master how can it be done.
 

Assuming Master is MCU and Slave is a device like ADC then slave cannot communicate on its own. The slave usually in some devices sends out data to master which master is sending data to slave SPI device.
 

Hi,
Assume 2 MCU's 1 as a master & 1 as a slave. If the slave needs to communicate to the master, how it will communicate??
If the master needs to communicate to the slave it will pull the CS of the slave to receive the data. I am confused in the case of slave how it will communicate??
 

Assuming PIC MCU.

It will be Multi-Master Communication. Each PIC will have SS pin. 1st Master send signal to SS pin of 2 Master and vice versa before starting communication.
 

Hi,

in a master - slave SPI connection the master needs to poll the slave.
The slave is passive.

The slave may trigger (with an extra line) an interrupt at the master.

Klaus
 

It will be Multi-Master Communication.
SPI is a single master/multiple slave network by design. Dynamic exchange of master and slave role is a theoretical option, but without any specific hardware support. It involves reconfiguration of both peers, I won't suggest it.

A common option is to use the MISO line to signal a service request.
 

@pic.programmer - multi-master SPI was NOT what the OP was asking about. Mentioning this just confuses the issue.
@aandaman - SPI is an exchange protocol and the master is in complete control of when the exchanges occur. Typically you load up a value into the slave device and it then waits until the master initiates the exchange.
As has been mentioned above, you can use a polling method where the slave has some 'no data available' value that it loads into the SPI buffer and the master then repeatedly initiates an exchange and throws away this value when it sees it. When the slave has a valid vale, it stores that instead and the master then picks this up on the next 'poll' exchange.
Alternatively you can connect another wire from the slave to the master and the slave then signals on that when it has valid data.
Susan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top