I have an Arduino that I'm trying to do some SPI slave communications with. My SPI code gives me loopbacks that I simply cannot explain. I think there's something about the SPI bus that I do not understand.
//Configure SPI bus SPCR = (1<<CPHA); // turn on SPI in slave mode SPCR |= (1<<SPE); // now turn on interrupts SPCR |= _BV(SPIE);
So all the routine does is send what it receives onward to the serial port, and then responds to every MOSI byte with a MISO 0xAA byte.
However, only the first byte of every SPI MISO packet shows up as 0xAA. The others are simply loopback copies of the input MOS. Why?
Is this somehow related to the fact that my CS pin is not going to zero after every single byte? That seems a little ridiculous.