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 hardware considerations

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



Joined: 24 Jun 2005
Posts: 5

View user's profile Send private message

spi hardware considerations
PostPosted: Wed Mar 08, 2006 3:45 pm     Reply with quote

Hi

I am doing a spi communication between 2 pics, the circuit is working with some errors and I think that is due to the hardware. anybody knows about some considerations in the hardware connection.

thanks in advance


sander
Ttelmah
Guest







PostPosted: Wed Mar 08, 2006 4:17 pm     Reply with quote

The biggest problem, is just how long you have to wait at the master, to guarantee a response from the slave, especially if the slave has any other interrupts in use.
You send a first byte. Time taken, depends on the clock selected.
The slave generates an interrupt when the byte _completes_.
Now assume the slave is already just entering an interrupt handler for another event. Even if this handler only takes 20 instruction times, the time before the slave can respond to the SPI interrupt, will be the 20 instruction times of this handler, about thirty instruction times to return from this, another thirty instruction times to save the resgisters in the global handler for the SPI interrupt, then another perhaps ten instruction times, before the slave reaches the point that it can write a value to it's output register!. Assuming it has to make some decisions based on the transmitted byte, the timing will be even longer. You can easily need to allow 100+ instruction times, before you can be sure that the slave is ready to respond. If you use interrupts on a 'per byte' basis, this applies to every byte... :-(

Best Wishes
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