EmbeddedRelated.com
Forums

SPI questions.

Started by JY Kim November 7, 2007
I am working with ST micom and have some questions on SPI.
I have asked on ST forum that I can see SCLK when micom is master and
sending data, but I can't when micom is master and receiving data.
Then someone answered that I should send null data to active SCLK even
when I want to receive data. Is this right method?
And another question. 
When master micom is sending out clock, how micom can know if signal
on MISO is valid data or not?
I have tried above method but SPI interrupt does not occur when I have
set receive buffer not empty interrupt. though data in MISO is data
not valid.
Please answer these questions.
Thanks.
On Wed, 07 Nov 2007 14:16:15 +0900, JY Kim wrote:

> I am working with ST micom and have some questions on SPI. > I have asked on ST forum that I can see SCLK when micom is master and > sending data, but I can't when micom is master and receiving data. > Then someone answered that I should send null data to active SCLK even > when I want to receive data. Is this right method?
Yes.
> And another question. > When master micom is sending out clock, how micom can know if signal > on MISO is valid data or not?
How could it possibly know? The bit is either high or low on each clock, and the microcontroller can't tell when it's in between. It's the responsibility of the hardware and software to make _sure_ that the data on MISO is valid when it's being clocked.
> I have tried above method but SPI interrupt does not occur when I have > set receive buffer not empty interrupt. though data in MISO is data > not valid. > Please answer these questions. > Thanks.
If you're the master, then you should probably interrupt on the transmit buffer empty. -- Tim Wescott Control systems and communications consulting http://www.wescottdesign.com Need to learn how to apply control theory in your embedded system? "Applied Control Theory for Embedded Systems" by Tim Wescott Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html