The code was doing: pinMode(slaveSelectPin, OUTPUT); pinMode(slaveSelectPin, HIGH); Second pinMode should be digitalWrite