Thanks guys for the help. I don’t mean to sound rude. But you cannot believe everything you read on the internet. This even goes for Wikipedia. I am a embedded hardware engineer. Have been doing this for over 25 years. I know SPI like the back of my hand.
I can tell you Wikipedia is not 100% correct concerning SPI.
During each SPI clock cycle, a full duplex data transmission occurs. The
master sends a bit on the MOSI line and the slave reads it, while the
slave sends a bit on the MISO line and the master reads it. This
sequence is maintained even when only one-directional data transfer is
This is not 100% true. There are many, many devices that do not do this. I have shown one in the beginning of this post.
That device like many others do not even have a MISO line.
Every slave on the bus that has not been activated using its chip select
line must disregard the input clock and MOSI signals, and must not
This also is not 100% true. There are many devices out there.that have an address to select them. Much like I2C does.
again, the device I gave in the post does not even have a CS line.
I probably was not real clear on the problem. Lets say you want to monitor or spy on two parts talking to one another over SPI. If the Master clocks out 64bits. (4 separate writes with 16 bits each) to the slave, which in this case the process takes 1.5ms. Since we must clock out 64 bits to get 64 bits, The moment we detect the SS line going low from the master, we shoot out 64 bits. But wait!!! clocking out those 64 bits took some time, and while we were sending those out, we missed the part if not all the of the 64 bits coming from the master, so we never catch it all.
On the Atmel part you can setup the SPI as a true slave. It does not need to clock out the data to get data. It triggers on the SS pin, and the clock serially shifts in the data into the SPI data receive register. When 8 bits are there you get an IRQ to read it out of the register.
This post is mute now, because in this case this is exactly what i am doing. I am spying on 2 chips talking to one another. Turns out they are using 17 bits. So that throws most of this out the window. Even when using the Atmel chips I am using I cannot use the “SPI” peripheral, because its 8 bit shift register. So I had to resort to bit reading the data manually. I don’t think the Photon is fast enough to do this, but I might give it try.