Hello,
A slave SPI application will usually involve the use of interrupt on SPI receive, so that it is possible for other work to be done by the MCU whilst waiting for SPI events. If the data to be returned is determined by the byte value just received, there will be some delay until the first return byte can be written to the SPI data register, ready for interrogation by the SPI master. The master must therefore allow a suitable worst case delay before attempting to interrogate the returned data. This delay should additionally allow for the execution of any other interrupt sources.
If the worst case delay is potentially large, but may vary over a wide range, it may be more efficient to provide "handshaking" back to the master, using a GP output pin, to indicate when the return data is ready. This is in addition to the SS signal originating from the master.
When multiple bytes are to be returned by the slave, keep in mind that this is an instance where the double buffering associated with SPI send may prove very useful to minimize the delay required once the data stream has started.
Regards,
Mac