SPI MAX31865 error when uploading new sketch until reconnected

I have been using a Adafruit MAX31865 board connected to an Arduino Nano RP2040 Connect via SPI.

The sketch/board/sensor generally works correctly, reporting accurate temperatures.

When making a change and uploading a new sketch to the arduino the MAX31865 stops working and enters a fault state.

Hardware:
Arduino Nano RP2040 Connect (I cannot see any Revision indicated on the board)
Adafruit MAX31865 RTD to SPI board.
PT100 RTD 3 wire

I can reproduce this with multiple sensors and arduinos.

Code:
I am interacting with the SPI sensor with the Adafruit library:

Library installed: 1.6.0
Board installed: Arduino Mbed OS Nano Board 4.0.2
Arduino App: 1.8.19 (Mac OS 11.7.4)

I can reproduce this error using the default example sketch:

I have made no changes to the example sketch, I wired the pins to use the default Arduino ones for the board so no changes are needed.

Before uploading a new sketch to the arduino, serial monitor:

RTD value: 8349
Ratio = 0.25479126
Resistance = 109.56024170
Temperature = 24.55

This is the desired output and works correctly.

After a new sketch is uploaded successfully:

RTD value: 0
Ratio = 0.00000000
Resistance = 0.00000000
Temperature = -242.02
Fault 0x40
RTD Low Threshold

Once I physically disconnect everything and plug the SPI device back in or reboot the Arduino it works correctly again. I connected everything with JST connectors which is why I can unplug everything.

I would like advice on two things:

  • How to resolve this issue, I would like to be able to make changes to code without having to physically reset everything.
  • How to detect when the SPI device is not plugged in / responding. With this library it just returns a zero value which is ambiguous.

I tried pulling the CS pin low or high in the setup() stage of the sketch to see if I could reset things but I hit the limits of my knowledge.

The board is connected to the Arduino's ground and 3V3 output. I have measured and it draws less than the max current.

Edit: I actually have no idea whats going on here. If I unplug the arduino from power the error remains. If I unplug the board from the arduino while unplugged from power the error remains. Only if I connect the board while the arduino is already powered on does everything work OK.

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