Loading...
Searching...
No Matches
MAX31855 Thermocouple-to-Digital Converter driver

Driver for the SPI Thermocouple-to-Digital Converter MAX31855. More...

Detailed Description

Driver for the SPI Thermocouple-to-Digital Converter MAX31855.

         The MAX31855 performs cold-junction compensation and digitizes
         the signal from a K-, J-, N-, T-, S-, R-, or E-type
         thermocouple. The data is output in a signed 14-bit,
         SPI-compatible, read-only format. This converter resolves
         temperatures to 0.25°C, allows readings as high as +1800°C and
         as low as -270°C, and exhibits thermocouple accuracy of ±2°C
         for temperatures ranging from -200°C to +700°C for K-type
         thermocouples.
Note
See the datasheet for more information: https://www.analog.com/media/en/technical-documentation/data-sheets/MAX31855.pdf
This driver doesn't require a MOSI line, as the MAX31855 is a read-only.

Files

file  max31855.h
 
file  max31855_constants.h
 Internal addresses, registers and constants.
 
file  max31855_params.h
 Default configuration for the MAX31855 driver.
 

Data Structures

struct  max31855_params_t
 Device initialization parameters. More...
 
struct  max31855_t
 Device descriptor for the driver. More...
 
struct  max31855_data_t
 Data structure for the MAX31855. More...
 

Enumerations

enum  max31855_fault_t { MAX31855_FAULT_VCC_SHORT = 0 , MAX31855_FAULT_GND_SHORT = 1 , MAX31855_FAULT_OPEN_CIRCUIT = 2 , MAX31855_FAULT_NO_FAULT = 3 }
 Fault status of the MAX31855. More...
 

Functions

int max31855_init (max31855_t *dev, const max31855_params_t *params)
 Initialize the given device.
 
void max31855_raw_to_data (uint32_t raw_data, max31855_data_t *data)
 Parse the raw data from the MAX31855 to the data structure.
 
int max31855_read (max31855_t *dev, max31855_data_t *data)
 Read data from the MAX31855.
 
void max31855_read_raw (max31855_t *dev, uint32_t *data)
 Read raw data from the MAX31855.
 

Enumeration Type Documentation

◆ max31855_fault_t

Fault status of the MAX31855.

Enumerator
MAX31855_FAULT_VCC_SHORT 

VCC short-circuit.

MAX31855_FAULT_GND_SHORT 

GND short-circuit.

MAX31855_FAULT_OPEN_CIRCUIT 

Open circuit.

MAX31855_FAULT_NO_FAULT 

No fault.

Definition at line 66 of file max31855.h.

Function Documentation

◆ max31855_init()

int max31855_init ( max31855_t dev,
const max31855_params_t params 
)

Initialize the given device.

Parameters
[in,out]devDevice descriptor of the driver
[in]paramsInitialization parameters
Return values
0on success
-ENXIOinvalid SPI device
-EINVALinvalid SPI CS pin/line

◆ max31855_raw_to_data()

void max31855_raw_to_data ( uint32_t  raw_data,
max31855_data_t data 
)

Parse the raw data from the MAX31855 to the data structure.

Parameters
[in]raw_dataRaw data from the MAX31855
[out]dataPointer to the data structure.
Precondition
data must not be NULL

◆ max31855_read()

int max31855_read ( max31855_t dev,
max31855_data_t data 
)

Read data from the MAX31855.

This is a shortcut to read raw data and parse it to the data structure.

Parameters
[in]devDevice descriptor of the driver
[out]dataPointer to the data structure.
Precondition
dev and data must not be NULL
Return values
0on success
-EIOif there is an error detected by the MAX31855. For a detailed error description, check the fault field of the data structure. On this case, temperature fields are not valid.

◆ max31855_read_raw()

void max31855_read_raw ( max31855_t dev,
uint32_t *  data 
)

Read raw data from the MAX31855.

Parameters
[in]devDevice descriptor of the driver
[out]dataPointer where to store the raw data.
Precondition
dev and data must not be NULL