Hello Rocco,
If you were using SPI interrupt on the SPRF flag this puts a different complexion on the operation. When the interrupt occurs the transmission should already be complete, with the SPRF flag set. If the ISR is aware of the final byte in a sequence, the strobe pulse could be generated by the ISR code, without the need for a wait loop elsewhere.
Having a short timeout loop, in addition to waiting for the SPRF flag to become set, can be relatively simply accomplished with assembly programming. However, with C programming this tends to be somewhat more complex, so I would usually keep the SPI function as simple as possible. With normal (non-debug) operation of the SPI, I guess the only reason the flag might fail to become set would be if the SPI configuration "glitched". Normally a COP reset would eventually occur, to re-initialise the SPI module.
If timeout should occur without the flag becoming set, what course of action would you follow? I have previously been uncertain of the most appropriate action.
Regards,
Mac