Jason Ryder

SPI confusion

Discussion created by Jason Ryder on Mar 6, 2008
Latest reply on Mar 10, 2008 by Jason Ryder
I'm hoping someone can point me in the right direction -
this is my first encounter with SPI, I have a 1Mhz stream of data requests from a remote 'master' device for which I've coded a SPI handler for my SLAVE hc9s12  which sorts & buffers the data perfectly. My problem occurs when certain data packets from the master require a response. A series of null bytes are sent effectively for me to populate with my returned data, here I make a write to the Tx data reg before the next master Tx, if I scope the MISO expecting to see my data on the next byte shift I only see an echo of the master data, (null byte in this case). I've also noticed If there is no software interaction the SPI module only echoes the data at MOSI I would at least expect there to be a 1 byte lag ?
In fact if I view the data reg real time It seems I can't actually write my data into it, i guess this could be overwritten though by the incoming data at MOSI.
Can anyone confirm if this is correct either way ?