Basic Information:
Printer Model: Ender 3 Pro
MCU / Printerboard: BTT SKR Mini e3v3
Host / SBC: Odroid XU4
klippy.log
klippy_log_thermocouple_fault.txt (29.8 KB)
Keep getting thermocouple faults from my (purple chinese clone) max31865 + PT100. Thought the max might just be faulty, but found it works fine hooked directly to a raspberry pi using:
sudo python3 - <<‘EOF’
import spidev
import time
R_REF = 430.0
RTD_A = 3.9083e-3
RTD_B = -5.775e-7
spi = spidev.SpiDev()
spi.open(0, 0)
spi.max_speed_hz = 500000
spi.mode = 1
def read_rtd_raw():
spi.xfer2([0x80, 0xC2])
time.sleep(0.1)
resp = spi.xfer2([0x01, 0x00, 0x00])
raw = (resp[1] << 8) | resp[2]
raw >>= 1
return raw
def rtd_to_temp(rtd_code):
R_rtd = (rtd_code / 32768.0) * R_REF
temp = (-RTD_A + (RTD_A**2 - 4RTD_B(1 - R_rtd/100))**0.5) / (2*RTD_B)
return temp
try:
while True:
raw = read_rtd_raw()
temp_c = rtd_to_temp(raw)
print(“Raw: {}, Temp: {:.2f}°C”.format(raw, temp_c))
time.sleep(1)
except KeyboardInterrupt:
spi.close()
print(“Exiting…”)
EOF
Notice the time.sleep pause between writing and reading. Apparently people have found this necessary with these clones.
Same with enabling vbias before enabling autoconvert. So I modified klippers max31865 driver (in spi_temperature.py) to do the same:
def __init__(self, config):
rtd_nominal_r = config.getfloat('rtd_nominal_r', 100., above=0.)
rtd_reference_r = config.getfloat('rtd_reference_r', 430., above=0.)
adc_to_resist = rtd_reference_r / float(MAX31865_ADC_MAX)
self.adc_to_resist_div_nominal = adc_to_resist / rtd_nominal_r
#new version test below
import time
# Step 1: Enable VBIAS + clear faults
cmd = 0x80 + MAX31865_CONFIG_REG
value = MAX31865_CONFIG_BIAS | MAX31865_CONFIG_FAULTCLEAR
self.config_reg = [cmd, value]
SensorBase.__init__(self, config, "MAX31865", self.config_reg)
# Small delay to let VBIAS stabilize
time.sleep(0.1) # 100 ms, same as RasPi
# Step 2: Enable auto-convert (keep VBIAS on)
value |= MAX31865_CONFIG_MODEAUTO
self.config_reg = [cmd, value]
self.spi.spi_send(self.config_reg)
#original below
#self.config_reg = self.build_spi_init(config)
#SensorBase.__init__(self, config, "MAX31865", self.config_reg)
# <-- Add this line to give the chip time after config write
#import time
#time.sleep(0.10) # 50 ms delay
But I’m still getting the same thermocouple faults (all of them):
Starting heater checks for heater_bed
Max31865 RTD input is disconnected
Max31865 RTD input is shorted
Max31865 VREF- is greater than 0.85 * VBIAS, FORCE- open
Max31865 VREF- is less than 0.85 * VBIAS, FORCE- open
Max31865 VRTD- is less than 0.85 * VBIAS, FORCE- open
Max31865 Overvoltage or undervoltage fault
Starting heater checks for extruder
Max31865 RTD input is disconnected
Max31865 RTD input is shorted
Max31865 VREF- is greater than 0.85 * VBIAS, FORCE- open
Max31865 VREF- is less than 0.85 * VBIAS, FORCE- open
Max31865 VRTD- is less than 0.85 * VBIAS, FORCE- open
Max31865 Overvoltage or undervoltage fault
Stats 27476.7: gcodein=0 mcu: mcu_awake=0.000 mcu_task_avg=0.000000 mcu_task_stddev=0.000000 bytes_write=2985 bytes_read=7119 bytes_retransmit=9 bytes_invalid=0 send_seq=262 receive_seq=262 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=63999127 heater_bed: target=0 temp=21.5 pwm=0.000 print_time=1149.677 buffer_time=0.250 print_stall=0 extruder: target=0 temp=0.0 pwm=0.000 sysload=0.00 cputime=0.840 memavail=1831732
Max31865 RTD input is disconnected
Max31865 RTD input is shorted
Max31865 VREF- is greater than 0.85 * VBIAS, FORCE- open
Max31865 VREF- is less than 0.85 * VBIAS, FORCE- open
Max31865 VRTD- is less than 0.85 * VBIAS, FORCE- open
Max31865 Overvoltage or undervoltage fault
Transition to shutdown state: MCU shutdown
Not sure where to go from here. It’s wired up correctly, jumper set for two wire… again, it worked fine on the raspi. I’m wondering if there is some quirk about the SKR Mini e3 v3 that is coming into play here like logic voltage (add pullups maybe?), or if it’s more differences with how klipper handles the max relative to how it was handled on my raspi.
Any and all help would be appreciated. Surely someone else has dealt with this and solved it before.