CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

SPI Protocol Questions

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
boulder



Joined: 15 Mar 2008
Posts: 53

View user's profile Send private message

SPI Protocol Questions
PostPosted: Fri Dec 12, 2008 11:57 pm     Reply with quote

Hi,
I am using a PIC chip as a slave to communication with a master chip through SPI interface. And I have questions about SPI protocol. Can SPI slave send out a packet with multiple bytes to master after receiving one byte command? Or does SPI slave have to send out only one byte data to master after receive one byte command? If master write one byte data to slave, does slave have to send one byte back? How long can SPI clock last after master send one byte?
I know usually SPI interface communication is one byte send and one byte receive. Since timing is extremely important to my project, I don't want to waste time on too much transmit and receive.

Thanks!!!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Dec 13, 2008 12:51 am     Reply with quote

SPI is basically just two shift registers connected to each other (one in the
master and the other in the slave).

http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus

Read Ttelmah's comments:
http://www.ccsinfo.com/forum/viewtopic.php?t=35442
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sat Dec 13, 2008 4:51 am     Reply with quote

As an additional remark: Slave select (SS), that acts as frame sync, also helps in identifying the byte position in multiple byte transmission. Usually, the master asserts SS before transmission start (active low is the original Motorola standard, but may be also active high), send and receives multiple bytes and deasserts it. The slave software must be fast enough to pick the received data after each interrupt and supply the send data.

If you connect hardware SPI slaves, e.g. ADC chips or SPI memory, they have a fixed multiple byte frame organisation, that must be exactly met by the master.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group