I've been trying to get 2 Leonardo's to talk to each other over SPI
I know I should post photos of how they're connected, and what code I'm using, but, this should be something that someone can answer without having to debug my rotten code.
I have connected the ICSP headers to each other (I've tried it with just 3 jumpers - SCK, MISO, MOSI, with 4 jumpers RESET, with 5 jumpers Vcc and Gnd and all 6 jumpered)
In the "master", it appears to send a value
Serial.println(SPSR);
SPDR=5;
Serial.println(SPSR);
before the transfer, SPSR=0, afterwards SPSR=128 (1<<SPIF)
In the "slave", the SPSR never changes from 0. And if I ignore SPSR and just read SPDR it's always 0
I've tried making SS an INPUT or an OUTPUT, setting it HIGH, and LOW.
I read somewhere that the pinouts for the SPI/ICSP header are incorrect, but it looks to me that
SS=PB0, SCK=PB1, MOSI=PB2, MISO=PB3
in both the pinout drawing (http://arduino.cc/en/Hacking/PinMapping32u4)
and pins_arduino.h
static const uint8_t SS = 17;
static const uint8_t MOSI = 16;
static const uint8_t MISO = 14;
static const uint8_t SCK = 15;
_BV(3), // D14 - MISO - PB3
_BV(1), // D15 - SCK - PB1
_BV(2), // D16 - MOSI - PB2
_BV(0), // D17 - SS - PB0
So I think that was a wild goose chase.
My question is this:
I have seen where others have used Uno's and Mega's but no-one has a documented case of a Leonardo acting as an SPI slave.
Can it be done? Has anyone got a Leonardo to act as a slave over SPI and receive data? Specifically a Leonardo.