# Erroneous RTD Amplifier temperatures during Amplifier initialization when SAVE\_CONFIG

**URL:** https://klipper.discourse.group/t/erroneous-rtd-amplifier-temperatures-during-amplifier-initialization-when-save-config/15022
**Category:** General Discussion
**Created:** [March 17, 2024, 9:58pm UTC](https://klipper.discourse.group/t/erroneous-rtd-amplifier-temperatures-during-amplifier-initialization-when-save-config/15022 "2024-03-17T21:58:13Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Akanar](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Akanar](https://klipper.discourse.group/u/Akanar)
#### Post date: [March 17, 2024, 9:58pm UTC](https://klipper.discourse.group/t/erroneous-rtd-amplifier-temperatures-during-amplifier-initialization-when-save-config/15022/1 "2024-03-17T21:58:13Z")

</div>

When you use an RTD Amplifier such as the MAX31865 on the BTT EBB36 you will get erroneous temperature readout during that chips initialization when you SAVE\_CONFIG.  
Fluidd wanted moonraker to implement a fix.

> <https://github.com/fluidd-core/fluidd/issues/1169>
>
> \### Is your feature request related to a problem? Please describe
> 
> When you us…e an RTD Amplifier such as the MAX31865 on the BTT EBB36 you will get erroneous temperature readout during that chips initialization. This behavior can be reproduced simply by initiating a \`FIRMWARE\_RESTART\`. Would be nice if you could avoid the Thermals Graph becoming useless as these readings re-scale the graph to uselessness.
> 
> Edit: This is not triggered via \`FIRMWARE\_RESTART\`. It is triggered via \`SAVE\_CONFIG\`. Also https://github.com/Klipper3d/klipper/pull/6320 did not resolve the issue.
> 
> \### Describe the solution you'd like
> 
> Ability to clear the graph information without having to reboot the printer.
> 
> \### Describe alternatives you've considered
> 
> Ability to set scaling limits for the graph.
> 
> \### Additional information
> 
> !\[Screenshot from 2023-09-08 00-24-54\](https://github.com/fluidd-core/fluidd/assets/7530545/2c894f65-6e13-42a7-bb4d-5b1e5ab9f15d)
> !\[Screenshot from 2023-09-08 00-27-56\](https://github.com/fluidd-core/fluidd/assets/7530545/cf82afdb-ad0b-4a97-8d2d-ed57a959ff09)

moonraker wants klipper to impement a fix

> <https://github.com/Arksine/moonraker/issues/725>
>
> \### Is your feature request related to a problem? Please describe
> 
> I've been see…ing users requesting the ability to reset the temperature store (specifically, https://github.com/fluidd-core/fluidd/issues/1169), so I would ask for such a feature in the Moonraker API so we can use it in the interfaces.
> 
> \### Describe the solution you'd like
> 
> Maybe a \`DELETE /server/temperature\_store\` and equivalent \`server.temperature\_store.delete\` or something of the likes of this.
> 
> \### Describe alternatives you've considered
> 
> Have the frontend store a timestamp as a base limit from which to present results (we currently use this approach for the command line history)
> 
> \### Additional information
> 
> \_No response\_

Looks like simply ignoring the first second or less of data from the RTD during initialization would fix this issue.

Site says “Sorry, an error has occurred.” when I try to upload klippy.log so here is a gist.

> <https://gist.github.com/ChaosBlades/1a06ce638ccdcf1c655b7477afebefad>

---

<div class="post-metadata">

### Author: ![gaolst](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/gaolst/32/10026_2.png) [@gaolst](https://klipper.discourse.group/u/gaolst)
#### Post date: [March 19, 2024, 3:25am UTC](https://klipper.discourse.group/t/erroneous-rtd-amplifier-temperatures-during-amplifier-initialization-when-save-config/15022/2 "2024-03-19T03:25:52Z")

</div>

Did you try to increase `tc_averaging_count` parameter ?  
possible values for MAX31856 are: 1, 2, 4, 8, 16

---

<div class="post-metadata">

### Author: ![Akanar](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Akanar](https://klipper.discourse.group/u/Akanar)
#### Post date: [March 19, 2024, 5:25am UTC](https://klipper.discourse.group/t/erroneous-rtd-amplifier-temperatures-during-amplifier-initialization-when-save-config/15022/3 "2024-03-19T05:25:56Z")

</div>

It only happens when doing SAVE\_CONFIG. Not boot, FIRMWARE\_RESTART, etc. Also happens on every different printer I have and everybody I know that uses RTD amplifiers. Not a config issue. Wrong temperature only happens for less than a second then quickly returns to normal.

---

<div class="post-metadata">

### Author: ![pedrolamas](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/pedrolamas/32/22261_2.png) [@pedrolamas](https://klipper.discourse.group/u/pedrolamas)
#### Post date: [April 22, 2024, 4:40pm UTC](https://klipper.discourse.group/t/erroneous-rtd-amplifier-temperatures-during-amplifier-initialization-when-save-config/15022/4 "2024-04-22T16:40:00Z")

</div>

Though I am not entirely sure how this is happening, I do wonder if the problem is confined to the combination of the BTT EBB36 with a MAX31865 amplifier.

Having said that, any temperature below absolute zero (-273.15C) is obviously wrong, so anything below that should just be counted as an error and discarded.

---

<div class="post-metadata">

### Author: ![Akanar](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Akanar](https://klipper.discourse.group/u/Akanar)
#### Post date: [April 23, 2024, 8:52pm UTC](https://klipper.discourse.group/t/erroneous-rtd-amplifier-temperatures-during-amplifier-initialization-when-save-config/15022/5 "2024-04-23T20:52:50Z")

</div>

It is seemingly random. Sometimes it will spike to hotter than the surface of the sun and other times it will be in the negatives.

Personally all my MAX31856 chips are on EBB36 boards and they all do this but when I first got this board like 2 years ago or something I had this issue and asked about it in the Voron Discord and was told the MAX31856 chip just does weird things when it initializes.

---

<div class="post-metadata">

### Author: ![pedrolamas](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/pedrolamas/32/22261_2.png) [@pedrolamas](https://klipper.discourse.group/u/pedrolamas)
#### Post date: [April 23, 2024, 9:42pm UTC](https://klipper.discourse.group/t/erroneous-rtd-amplifier-temperatures-during-amplifier-initialization-when-save-config/15022/6 "2024-04-23T21:42:22Z")

</div>

> [@Akanar](#):
>
> …and was told the MAX31856 chip just does weird things when it initializes

Looking through Marlin FW source code does seem to confirm this!

> <https://github.com/MarlinFirmware/Marlin/pull/23215>
>
> \<!--
> 
> Submitting a Pull Request
> 
> \- Please fill out all sections of this form…. You can delete the helpful comments.
> \- Pull Requests without clear information will take longer and may even be rejected.
> \- We get a high volume of submissions so please be patient during review.
> 
> \--\>
> 
> There is an inherent problem in the default implementation of MAX31865 library, caused by the fact that 1-shot polling mode requires a minimum of 75ms delay for each read. This results in serious delays in Marlin, as the sensor is polled several times per second. In this pull request I have refactored the polling function to remove hard delays and return the last acquired value until the time needed for polling preparation has elapsed.
> 
> also:
> 
> \- added the option to further delay (by skipping) sequential reads in 1-shot mode, in order to reduce the bias voltage's effect on the RTD (for those seeking more accuracy, although I'm not sure it makes any practical difference in temperatures higher than room temperature - global setting).
> \- implemented optional auto mode, which keeps bias voltage on continuously, allowing for frequent polling without the necessary waits. This can heat the RTD up a bit, but in temperatures \> 200°C the effect is negligible. On the other hand, reading is much faster and more frequent (global setting).
> \- added the option to declare a manually measured value for wire resistance, which is allows for more accurate temperature calculation in 2-wire configurations (per sensor setting).
> \- implemented a check for occasional value spikes, which seem to occur rarely, but are not regarded as read errors by the sensor. Sequential temperature reads that differ by more than 20°C within a second, are considered faults and will be treated as such (global setting).
> \- fixed a couple of issues with HW SPI implementation (which was not working at all on my LPC1768).
> \- minor speed improvements in sensor I/O.
> 
> \<!--
> 
> Clearly describe the submitted changes with lots of details. Include images where helpful. Initial reviewers may not be familiar with the subject, so be as thorough as possible. You can use MarkDown syntax to improve readability with bullet lists, code blocks, and so on. PREVIEW and fix up formatting before submitting.
> 
> \--\>
> 
> \### Requirements
> 
> Adafruit MAX31865 sensor, internal library implementation.
> 
> \### Benefits
> 
> Great enhancement in speed, more options, some accuracy improvements, bug fixing.
> 
> \### Configurations
> 
> Nothing specific
> 
> \### Related Issues
> 
> \#21638

> <https://github.com/MarlinFirmware/Marlin/pull/23496>
>
> In response to #23439, I added some extra initialization steps to MAX31865.cpp, …which ensure no fault exists on init and reset the threshold registers to their default values. This seems to solve a hardware issue, where two MAX31865 sensors are hooked up \_on the same SPI\_ and they initialize with fault.
> 
> I also added another initialization fault bypassing mechanism, as suggested by @GadgetAngel. This can be configured by the corresponding setting (MAX31865\_IGNORE\_INITIAL\_FAULTY\_READS) in Configuration\_adv.h.
> 
> This PR does not close #23439, since there seems to be an issue with software SPI conflicting with SD support (evidently, issue first appeared after #22682). Hardware SPI works fine with the above fix.
> 
> \### Requirements
> 
> 2 MAX31865 sensors on the same SPI.
> 
> \### Benefits
> 
> Bugfix. Also some code deduplication, additional debug logging, and fine tuning of sensor polling times.
> 
> \### Configurations
> 
> \-
> 
> \### Related Issues
> 
> \#23439

Marlin code for the MAX31856 seems to use some sort of hacks to fix misbehavior of the chip… Having said that, I personally have no idea what would be required to fix it on Klipper side as I use (or even have) no such chips myself.

---

<div class="post-metadata">

### Author: ![ReXT3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/rext3d/32/200_2.png) [@ReXT3D](https://klipper.discourse.group/u/ReXT3D)
#### Post date: [May 9, 2024, 11:07pm UTC](https://klipper.discourse.group/t/erroneous-rtd-amplifier-temperatures-during-amplifier-initialization-when-save-config/15022/7 "2024-05-09T23:07:31Z")

</div>

To add another (random?) data point to this discussion, I’ve used MAX31865 / PT1000 hot end temperature sensing ever since I commissioned my Voron 2.4 S/N 2.4894. I was also somewhat involved in encouraging improved fault tolerance for the MAX series temperature sensors. The installation has been totally “bulletproof” overall.

I have, however, seen these spikes during MCU resets in the past, but I have to admit that it has been quite a while since I have seen them. This is largely anecdotal though, because I have not been printing as much recently as I have been in the past and therefore I’ve had fewer opportunities to see them. But I always wondered what was causing the extreme reading values at initialization.

In addition to initialization, some of the MAX series chips have additional diagnostic capabilities that are not currently used by Klipper, for example see here: [Improve error handling of thermocouple code #5780](https://github.com/Klipper3d/klipper/pull/5780). I still feel that using some of these capabilities would be beneficial, but it would introduce additional code complexities.

---

<div class="post-metadata">

### Author: ![system](https://global.discourse-cdn.com/free1/uploads/klipper/original/1X/64419bf2aac6639e6ef5cef200dcd456b0a01ac3.png) [@system](https://klipper.discourse.group/u/system)
#### Post date: [July 8, 2024, 11:07pm UTC](https://klipper.discourse.group/t/erroneous-rtd-amplifier-temperatures-during-amplifier-initialization-when-save-config/15022/8 "2024-07-08T23:07:41Z")

</div>

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