I want to use 'MAX31865' through 'STMDuino'

I want to use 'MAX31865' through 'STMDuino'.

  1. Adafruit_MAX31865 library : Adafruit PT100 RTD Temperature Sensor Amplifier - MAX31865 : ID 3328 : Adafruit Industries, Unique & fun DIY electronics and kits

  2. STM Core : MAPLE GitHub - rogerclarkmelbourne/Arduino_STM32: Arduino STM32. Hardware files to support STM32 boards, on Arduino IDE 1.8.x including LeafLabs Maple and other generic STM32F103 boards
    (board : STM32F103C8 / maple mini)

  3. Discussion on other sites: [maple mini] Adafruit_MAX31865 library : The correct value is not displayed. - Arduino for STM32

  4. source

#include <Wire.h>
#include "Adafruit_MAX31865.h"

// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31865 thermo = Adafruit_MAX31865(PA4, PA7, PA6, PA5);

#define RREF 430.0
#define RNOMINAL 100.0

void setup(){

  Serial.begin(115200); pinMode(PA4,OUTPUT); 
  Serial.println("Adafruit MAX31865 PT100 Sensor Test!");
  thermo.begin(MAX31865_2WIRE); // set to 2WIRE or 4WIRE as necessary  
  
}

void loop()
{
  uint16_t rtd = thermo.readRTD();

  Serial.print("RTD value: ");
  Serial.println(rtd);
  float ratio = rtd;
  ratio /= 32768;
  Serial.print("Ratio = ");
  Serial.println(ratio, 8);
  Serial.print("Resistance = ");
  Serial.println(RREF * ratio, 8);
  Serial.print("Temperature = ");
  Serial.println(thermo.temperature(RNOMINAL, RREF));

  // Check and print any faults
  uint8_t fault = thermo.readFault();
  if (fault)
  {
    Serial.print("Fault 0x");
    Serial.println(fault, HEX);
    if (fault & MAX31865_FAULT_HIGHTHRESH)
    {
      Serial.println("RTD High Threshold");
    }
    if (fault & MAX31865_FAULT_LOWTHRESH)
    {
      Serial.println("RTD Low Threshold");
    }
    if (fault & MAX31865_FAULT_REFINLOW)
    {
      Serial.println("REFIN- > 0.85 x Bias");
    }
    if (fault & MAX31865_FAULT_REFINHIGH)
    {
      Serial.println("REFIN- < 0.85 x Bias - FORCE- open");
    }
    if (fault & MAX31865_FAULT_RTDINLOW)
    {
      Serial.println("RTDIN- < 0.85 x Bias - FORCE- open");
    }
    if (fault & MAX31865_FAULT_OVUV)
    {
      Serial.println("Under/Over voltage");
    }
    thermo.clearFault();
  }
  Serial.println();
  delay(1000);
  
}

I looked it up on the internet and it seems like the library is not compatible with 'STMDuino'.

Is there a solution?

When I want to use a library on an unsupported core badly enough, I generally try and figure out what the problem is, whether or not it can be fixed, and if it can fixed, then fixing it. After all, I was the one that wanted to use the library in the first place, so I'm the one with the motivation.

1 Like

Do you "need" that particular core? ST has taken over publishing Arduino cores for their chips, and a much more recent core can be found at GitHub - stm32duino/Arduino_Core_STM32: STM32 core support for Arduino
(I don't know if that will fix your problems, but it moves you forward in history.)

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.