The SPI library assumes you want the arduino to act as a master. You can't use it to get an arduino to act as a slave. Sometimes you have to dive past the libraries into the chip's datasheet and see how things work. (and then, ideally, make a library from all your troubles)
An SPI slave device has to react to the master initiating the communication.
So the Pi, as the SPI master, will have to send dummy bytes over the MOSI line and read what the Arduino replies on the MISO line. ie, master initiate communication.
On the arduino side you can turn on the SPI interrupt with:
SPCR |= _BV(SPIE);
It's built into the atmega328 chip. So include this next bit on the arduino side to see incoming messages and set the response for the next message. The data that the arduino SPI slave responds with is whatever is in the data register when the master sends the message.
int gCurrentSpiByte; //or set up your a buffer or whatever
ISR (SPI_STC_vect)
{
gCurrentSpiByte = SPDR; // grab byte from SPI Data Register
SPDR = buf[messageCount++]; //Set the data to be sent out on the NEXT message.
}
And remember, you GOTTAGOFAST. If the arduino doesn't exit that interrupt service routine before the next SPI message comes it, it all goes to hell.
Also also, check to make sure the clock's polarity and phase are the same between the Pi and the Arduino (otherwise known as modes 0-3).
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| SPIE | SPE | DORD | MSTR | CPOL | CPHA | SPR1 | SPR0 |
SPIE - Enables the SPI interrupt when 1
SPE - Enables the SPI when 1
DORD - Sends data least Significant Bit First when 1, most Significant Bit first when 0
MSTR - Sets the Arduino in master mode when 1, slave mode when 0
CPOL - Sets the data clock to be idle when high if set to 1, idle when low if set to 0
CPHA - Samples data on the falling edge of the data clock when 1, rising edge when 0
SPR1 and SPR0 - Sets the SPI speed, 00 is fastest (4MHz) 11 is slowest (250KHz)
So to turn on SPI, the SPI interrupt, and to set the polarity to... whatever that is...
SPCR |= _BV(SPIE) | _BV(SPE) | _BV(CPOL) ;
Anyway, I spent a couple days banging around with the Arduino SPI and that's what I learned.