|
|
View previous topic :: View next topic |
Author |
Message |
sander
Joined: 24 Jun 2005 Posts: 5
|
spi hardware considerations |
Posted: Wed Mar 08, 2006 3:45 pm |
|
|
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
|
|
Posted: Wed Mar 08, 2006 4:17 pm |
|
|
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 |
|
|
|
|
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
|