AnsweredAssumed Answered

KE02Z - SPI Daisy Chain

Question asked by lmg on Mar 31, 2016
Latest reply on Mar 31, 2016 by xiangjun.rong

I'm attempting to connect several KE02Z's (FRDM-KE02Z40M board) in a daisy chain. One will be the master, the others will be the slaves.


I am using KDS 3.1.0 and Processor Expert.


For each slave, MISO is connected to the next downstream slave MOSI.


Clock from master goes to all slaves. All slaves have SS tied low.


I am using the multi-byte transmit method SendBlock().


What I expected:

     I thought that a series of bytes transmitted by the master would "ripple through" the slaves. Each slave would simply shift out the byte just received - just delayed by one byte time.


What I observed:

     It appears that the contents of the SPI shift register is transferred to the receive buffer after each complete byte is received and that the contents of the transmit buffer is transferred into the SPI shift register. So the byte that just arrived gets overwritten. As the clock from the master continues, it's not the original data from the master that gets shifted out, but data from the slave's transmit buffer (which seems to be zero by default).


Possible workaround:

     I could do everything one byte at a time. Master transmits one byte. Then each slave could copy the byte just received into its own transmit buffer. Then master can transmit the next byte, etc.


Is there a cleaner way to do this - perhaps with built-in methods?