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.

Changing controllers for SPI mode from slave to master

Status
Not open for further replies.

microT

Newbie level 6
Joined
Oct 6, 2005
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,425
SPI help needed .....

Hi ....

I am using 2 Philips controllers for SPI ... it is working fine with one as master and the other as slave .... Now, is it possible to change from master to slave and from slave to master after 1 byte transmission ..?

Also how do i configure the SS pin for this ....

Thanx in advance ...

Regards
MicroT
 

Re: SPI help needed .....

I think it is possible, but I would send more than one byte so the other side can decide (set a flag) whether it was a data byte or an instruction to switch from master to slave ..
Other option would be to allow additional one/two pin/s at both sides to inform each other that the other side wants to become master or slave ..
Regards,
IanP
 

Re: SPI help needed .....

The SS pin is only used when the device is a slave. But you need to configure the device as a slave. The SS pin must be configured as Slave Select on the slave, but it will be ignored by the master, so it can be just an input.
So I think you should tie together the SS pin from each micro to a general-purpose IO line on the other. The master must assert the SS pin of the slave in order to be "heared".

Start with one micro as master and the other as slave. After transmission of a special character (or more), the roles are changed, so each micro must configure its SPI interface: the master to become a slave, the slave to become the master.
The new master must now assert the SS pin of the new slave.
To switch back, the present master must send the special character(s).

As you can see, this approach does not allow the slave to request a role swap.
So instead of characters, you can use IO lines tied fro one micro to the other, to let the slave request a role change. It costs precious IO lines, but it seems more flexible and does not place restrictions on the data sent.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top