Big thanks to pylon! I was able to solve this by using alternate pins and letting the software SPI functions read from pins seperate from the hardware SPI bus. I have got all 4 channels working and incorporated into an an example SdFat data logger. its working great!
/***************************************************
* This is an example data logger for 4 thermocouple channels
Based on Arduino Mega2560, Seeed Studio SD Shield, (4) MAX31855 Breakout Boards, and one DS1307 Real Time Clock from Adafruit
Based on SdFat Data Logger Example, and Adafruit tutorials
****************************************************/
#include <Adafruit_MAX31855.h>
#include <Wire.h>
#include <RTClib.h>
#include <SdFat.h>
#include <SdFatUtil.h>
// A simple data logger for the Arduino analog pins
#define ECHO_TO_SERIAL 1 // echo data to serial port
#define WAIT_TO_START 0 // Wait for serial input in setup()
#define DATA_HEADER "Date, Time, TC#1(C), TC#1(F), TC#2(C), TC#2(F), TC#3(C), TC#3(F), TC#4(C), TC#4(F)"
// Serial print stream
ArduinoOutStream cout(Serial);
RTC_DS1307 RTC; // define the Real Time Clock object
SdFat sd; // filesystem object
ofstream logfile; // the logging file
// format date/time
ostream& operator << (ostream& os, DateTime& dt) {
os << dt.year() << '/' << int(dt.month()) << '/' << int(dt.day()) << ", ";
os << int(dt.hour()) << ':' << setfill('0') << setw(2) << int(dt.minute());
os << ':' << setw(2) << int(dt.second()) << setfill(' ');
return os;
}
// call back for file timestamps
void dateTime(uint16_t* date, uint16_t* time) {
DateTime now = RTC.now();
// return date using FAT_DATE macro to format fields
*date = FAT_DATE(now.year(), now.month(), now.day());
// return time using FAT_TIME macro to format fields
*time = FAT_TIME(now.hour(), now.minute(), now.second());
}
const int SlavePin1 = 49; //Thermocouple #1
const int SlavePin2 = 47; //Thermocouple #2
const int SlavePin3 = 45; //Thermocouple #3
const int SlavePin4 = 43; //Thermocouple #4
const int SlavePin5 = 10; //SD Card
const int MockSlaveOut = 41;
const int MockClock = 39;
Adafruit_MAX31855 thermocouple1(MockClock, SlavePin1, MockSlaveOut);
Adafruit_MAX31855 thermocouple2(MockClock, SlavePin2, MockSlaveOut);
Adafruit_MAX31855 thermocouple3(MockClock, SlavePin3, MockSlaveOut);
Adafruit_MAX31855 thermocouple4(MockClock, SlavePin4, MockSlaveOut);
//*****************************************************************************************
// Error handling loop, from the tutorials at ladyada.net listed above
// If there is a problem accessing the SD card, this loop gets called to display a cryptic
// error message.
void error(char *str)
{
Serial.print("error: ");
Serial.print(str);
while(1);
}
//****************************************************************************************
void setup() {
digitalWrite(53, HIGH); //Power to Thermocouple Boards
Serial.begin(9600);
cout << endl;
#if WAIT_TO_START
// use pstr to store string in flash and save RAM
cout << pstr("Type any character to start") << endl;
while (!Serial.available());
#endif WAIT_TO_START
// connect to RTC
Wire.begin();
if (!RTC.begin()) error("RTC failed");
// set date time callback function
//SdFile::dateTimeCallback(dateTime);
// send date/time to Serial
DateTime now = RTC.now();
cout << now << endl;
// see if the card is present and can be initialized:
if (!sd.begin(SlavePin5, SPI_HALF_SPEED)) {
// print detailed error message and halt
sd.initErrorHalt();
}
// create a new file
char filename[] = "LOG00.CSV";
for (uint8_t i = 0; i < 100; i++) {
filename[3] = i/10 + '0';
filename[4] = i%10 + '0';
if (sd.exists(filename)) continue;
logfile.open(filename);
break;
}
if (!logfile) error("file create failed");
cout << "Logging to: " << filename << endl;
logfile << pstr(DATA_HEADER) << endl;
#if ECHO_TO_SERIAL
cout << pstr(DATA_HEADER) << endl;
#endif ECHO_TO_SERIAL
}
void loop() {
// use buffer stream to format line
char buf[100];
obufstream bout(buf, sizeof(buf));
// fetch the time
DateTime now = RTC.now();
// log time
bout << now <<", ";;
//fetch Thermocouple Data
float c1 = thermocouple1.readCelsius();
float f1 = thermocouple1.readFarenheit();
float c2 = thermocouple2.readCelsius();
float f2 = thermocouple2.readFarenheit();
float c3 = thermocouple3.readCelsius();
float f3 = thermocouple3.readFarenheit();
float c4 = thermocouple4.readCelsius();
float f4 = thermocouple4.readFarenheit();
bout << c1 << ", " << f1 << ", " << c2 << ", " << f2 << ", " << c3 << ", " << f3 << ", " << c4 << ", " << f4;
// write data to file
logfile << buf << endl;
logfile.flush();
// check for errors
if (!logfile) error("write data failed");
#if ECHO_TO_SERIAL
cout << buf << endl;
#endif ECHO_TO_SERIAL
delay(1500);
}