As always, it depends ;-). Here is what I think:
- first, your slave should listen to be able to receive your master
command data. Your master wouldn't care much for the data send from
the slave until the end of your frame, when an ack from the slave
would be a good thing to have.
- second, the behaviour of both the master and the slave depends on
your command.
This is a simple scenario. Many SPI protocols take full advantage
from the fact the data can be sent and received at the same time.
Your slave can, and ususlly shoud, have same data ready for the next
exchange. If not, perhaps an asynch bus would be a better choice?
I hope it is helpful. I'd have to know much more about your project
to sugest anything more specific.
Krys
--- In lpc2000@yahoogroups.com, "Gus" <gus_is_working@y...> wrote:
> I know that! My question is what is the best way to do that
protocol.
>
> Gus
> --- In lpc2000@yahoogroups.com, "y4krys" <krys.brukalo@a...> wrote:
> > It is "always both". It's up to your protocol to decide which
> data
> > stream is "don't care" and when. Only the master can initiate an
> > exchange on an SPI bus.
> >
> > Krys
> >
> > --- In lpc2000@yahoogroups.com, "Gus" <gus_is_working@y...> wrote:
> > > Hello,
> > >
> > > In your opinion, what is the best way to transfer data between
2
Show quoted textHide quoted text
> > LPC
> > > micros using SPI?
> > >
> > > The way I have it now, one is master and other is slave. The
> slave
> > one
> > > have 1 pin called DATA_READY. When the slave needs to send data
> to
> > > master, it sets DATA_READY high.
> > >
> > > Now the problem is that when the master reads data, it also
> writes
> > > data at the same time (the way SPI works) How would the slave
> know
> > > that the SPI transaction is read, write or both.
> > >
> > > Thanks,
> > >
> > > Gus