I am attempting to use SPI communication between a Master Arduino Mega 2560, and standalone Slave Arduino Unos (4, to be exact).

The intention is for the Unos to do some trivial work and produce one byte of data that the Master will take from it, whenever needed. They produce this byte very quickly, and the SPDR is updated with a holding variable (a byte) when the slave is interrupted. The Slaves do not take data from the Master.

The standalone platforms are working 100% (doing the work without problem), and using a single Slave to perform the work, create the byte of data, and have a Master take that data from it, is also working 100%.

The issue When all four slaves are connected (all being powered from the Master), all sharing the MISO, MOSI, and SCK lines, each with its own unique SS line, I am getting xFF for my data byte (garbage data) from the primary slave. I am using the default Mode 0, and the SCK lines are tied to ground via a 0.1uF capacitor (to smooth the clock signal)... All other SPI lines are wired directly.

The other three slaves are floating their MISO lines (third state), and the Master has all four SS lines as outputs, and all are pulled HIGH in the Master setup. The primary slave I am attempting to communicate with is SS connected to the main SS on the Master (pin 53 on a Mega). I pull the pin LOW, grab the byte from the Slave, and then pull the line HIGH... still garbage.. but only when all four slaves are 'hooked up', like I said, it works fine with one Master, one Slave.

Anyone have thoughts as to what I could be neglecting, missing, etc??

Here is the slave schematic. What you can't see is that VCC and AVCC are tied to the 5V line from the 10-pin header (the connection to the master).


The external power supply I am currently using is added in parallel to the 5V/Grnd you see in the schematic. The power supply has a max current draw at 5V of 10A, so I'm pretty confident that power is not my issue now, unless I have missed something.

I just realized that the imgur image is hard to see, here is a cut-away that should be clearer.


  • 5
    "and the SCK lines are tied to ground via a 0.1uF capacitor (to smooth the clock signal)" ... what? why? This is a terrible idea!
    – brhans
    Commented Mar 26, 2015 at 15:12
  • There's a good chance you're running into power regulation issues, too. The regulator on any Arduino has barely enough thermal capacity to power its own microcontroller chip, and burdening it with four other Arduinos is likely to be overloading the master's regulator.
    – Dave Tweed
    Commented Mar 26, 2015 at 15:23
  • I was wondering about that as well, but it was something I read when setting up initially. I HAVE re-tested without the capacitor connected.. no change. Commented Mar 26, 2015 at 15:24
  • I have also externally powered the primary slave, when testing, to check the possible power issue Commented Mar 26, 2015 at 15:24
  • At this point, I think we're going to need a detailed schematic of your setup, along with the code you're using for the SPI communications.
    – Dave Tweed
    Commented Mar 26, 2015 at 15:30

1 Answer 1


the SCK lines are tied to ground via a 0.1uF capacitor (to smooth the clock signal)

Get rid of that for a start.

The other three slaves are floating their MISO lines (third state)

That's your problem. They should all be outputs. From the datasheet:

When the SPI is configured as a Slave, the Slave Select (SS) pin is always input. When SS is held low, the SPI is activated, and MISO becomes an output if configured so by the user. All other pins are inputs. When SS is driven high, all pins are inputs, and the SPI is passive, which means that it will not receive incoming data. Note that the SPI logic will be reset once the SS pin is driven high.

As you can see from that, you should configure all the MISO pins as outputs. However the SPI hardware will turn them into inputs if SS is high. Thus only one slave (the one you set MISO as an output) is capable of responding at present.

You should probably set them as outputs after turning on SPI slave mode. eg.

  // turn on SPI in slave mode
  SPCR |= bit (SPE);

  // have to send on master in, *slave out*
  pinMode (MISO, OUTPUT);
  • And generally, when you wonder about an Arduino-related topic, you check it out at Nick's website. eg gammon.com.au/spi It has become my habit to type gammon.com.au + whatever subject I want to learn more about as a a first choice...
    – dda
    Commented Nov 26, 2015 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.