Common CS pins on Arduino uno for SPI devices

I am trying build a temperature monitor using multiple MAX6675 thermocouple to digital converters. In my code shown below, I sequentially read out each thermocouple. I realise that according to SPI protocols each slave device has to get a dedicated CS (chip select) pin. However, would be fine to have a common chip select pin but a unique serial out (SO) for each device? Would it matter or lead to any errors with an arduino UNO

#include <LiquidCrystal.h>

#include <LiquidCrystal_I2C.h>
#include "max6675.h"

int csPin = 2;
int clkPin = 3;

int soPin1 = 4;
int soPin2 = 5;
int soPin3 = 6;
int soPin4 = 7;
int soPin5 = 8;
int soPin6 = 9;


MAX6675 thermo1(clkPin, csPin, soPin1);
MAX6675 thermo2(clkPin, csPin, soPin2);
MAX6675 thermo3(clkPin, csPin, soPin3);
MAX6675 thermo4(clkPin, csPin, soPin4);
MAX6675 thermo5(clkPin, csPin, soPin5);
MAX6675 thermo6(clkPin, csPin, soPin6);


// set LCD address, number of columns and rows
// if you don't know your display address, run an I2C scanner sketch
LiquidCrystal_I2C lcd(0x27, 16, 2);  

void setup(){
  // initialize LCD
  lcd.init();
  // turn on LCD backlight                      
  lcd.backlight();
 
  //Serial.println("MAX6675 test");
  // wait for MAX chip to stabilize
  delay(500);
}
void loop(){
// set cursor to first column, first row
  lcd.clear();
  // go to line #1
  lcd.setCursor(0,0);
  lcd.print('A');
  lcd.print(thermo1.readCelsius(),1);
  lcd.setCursor(0,1);
  lcd.print('B');
  lcd.print(thermo2.readCelsius(),1);
  lcd.setCursor(6,0);
  lcd.print('C');
  lcd.print(thermo3.readCelsius(),1);
  lcd.setCursor(6 ,6);
  lcd.print('D');
  lcd.print(thermo4.readCelsius(),1);
  lcd.setCursor(12 ,0);
  lcd.print('E');
  lcd.print(thermo5.readCelsius(),1);
  lcd.setCursor(12 ,12);
  lcd.print('F');
  lcd.print(thermo6.readCelsius(),1);
  delay(1000);
  // clears the display to print new message
}

no.

1 Like

I would say maybe that could work, but it would be a lot more complicated and would have no advantages, wouldn't save any pins, so why would you want to do it?

What happened when you tried it ?

1 Like

It seems to work. But, I wanted to know if this would have any other consequences. Though all the slaves start sending the data to the ardunio all at the same time, since the serial out pins are different and only one of the SO pin is being read out for output; it seems to work.

However, would lead to any issues? All the outputs are on unique pins and we read one at time.

More noise probably.  Instead of some number of stable CS lines and one fluctuating MISO line there'd be one stable CS and a bunch of fluctuating MISO lines.  And fluctuations draw power.

I could likely be wrong here so you would have to check the datasheet for your device, but I think some SPI devices will clock out on MISO what they receive on MOSI.

I seem to recall (can't remember which device - sorry) that you could daisychain some SPI devices so MISO of device #1 goes to MOSI of device #2 and so on, and use just 1 /CS signal.

You then clocked out 16 bits for 2 devices, 24 bits for 3 devices etc.

Again, you need to check the datasheet for your specific device to see what it says.

Try this: Daisy-Chaining SPI Devices | Analog Devices

it is 'software/bitbanged SPI' what you use if you use different pins.

The CS line controls when the MAX6675 starts and stops a temperature conversion. Don't know if that will matter in your particular application.