MAX 31723 Temperature Sensor Using SPI Protocols

When trying to utilize the MAX 31723 temperature sensor I realized that the default spi library for Arduino only can write a single byte of data at a time. This presents a problem since for this particular sensor requires both the address byte and the data byte to be written together in one clock pulse. Does anyone know how to write two bytes of data on one clock pulse using the SPI. h library without having to bit bang the data.

The spec sheets for the sensor are attached.

MAX31722-MAX31723.pdf (762 KB)

Looks like they use CE for the SPI Slave Select but the logic is reversed. To send two bytes:

   digitalWrite(CE, HIGH);
   SPI.transferAddressByte);
   SPI.transfer(DataByte);
   digitalWrite(CE, LOW);

I saw that this would work, but when I attach it to an oscilloscope, it appears that in between the address byte and the data byte the Arduino stops the clock for a short time. Looking at the sensors data sheet this stopping causes it not to register the data byte as a data byte. Is there any way to fix this?

If you look at Figure 10. (SPI Multiple-Byte Burst Transfer) it shows the SCLK stopping between bytes. This is normal for SPI. Are you sure you have SPI selected (SERMODE connected to Vdd, not GND)?

Here is the code I am currently running. It only outputs 0 to the serial monitor. I have checked my set up three times and verified the correct pin connections. I don’t know what is wrong with the code but has been very frustrated by the fact that I cannot get this to work. Any suggestions?

[/

#include <SPI.h>

/* Circuit
SCK: 13
MISO: 12 
MOSI: 11
SS: 9
*/

const int CE = 9; 
//const int ClK = 13;
//const int MISO = 12;
//const int MOSI = 11;

void setup() {
byte dataout;

Serial.begin(9600);
pinMode(CE, OUTPUT);
SPI.begin();
SPI.setBitOrder(MSBFIRST);  //Most Significant bit first  
//Sets clock speed at 250 KHz
SPI.setClockDivider(SPI_CLOCK_DIV64); 
  
//Sets CPHA: 1 CPOL: 1
SPI.setDataMode(SPI_MODE3); 
digitalWrite(CE, LOW);
delay(200); //Allow time for setup
 
//Write to the configuration register
datatransfer(0x00, 0x80,&dataout);
}

  

void loop() 
{
 byte dataout;
 
//Get the first byte of Data
 datatransfer(0x00, 0x01, &dataout);
 Serial.println(dataout, BIN);
//Get the second byte of data 
datatransfer(0x00, 0x02, &dataout);
 Serial.println(dataout, BIN);

delay(100); 
 
}

void datatransfer(byte databyte, byte addbyte, byte *dataout){
  
  digitalWrite(CE, HIGH);
  SPI.transfer(addbyte);
  *dataout = SPI.transfer(databyte);
  digitalWrite(CE, LOW);
  
  
}
]