bigtreetech / BIGTREETECH-SKR-PRO-V1.1

Aiming at some problems existing in 3D printed motherboards in the market. Bigtree Technology Co., Ltd. launched a high performance 3D printer master board with STM32F407ZGT6 as the core controller, BIGTREETECH-SKR-PRO-V1.1.
276 stars 222 forks source link

BIGTREETECH-SKR-PRO-V1.1 + max31865 + tft35 v2.0 "no printer attached" #176

Closed daniagos closed 3 years ago

daniagos commented 4 years ago

Hi, i am runnng a skr pro v 1.1 tft 35 v2 tmc2209, uart mode, sensorless homing marlin 2.0.x, latest release While trying to change TEMP_SENSOR_0 from 1 to -5 (which indicates i am using a max amplifier) the tft disconnects.

i can't also upload firmware via usb but i need to upload it every time with sd card, quite annoying (i use vscode)

https://drive.google.com/drive/folders/1DBuVxjGbWB0jsPYh_vwEzkzLrf90pklb?usp=sharing

this is the link with the full marlin version i am using, here the tft is not working

GadgetAngel commented 4 years ago

Please see this following issue: https://github.com/bigtreetech/BIGTREETECH-SKR-PRO-V1.1/issues/163#issuecomment-680798334

I'll look at your setup of the MAX31865 board

GadgetAngel commented 4 years ago

Hi, i am runnng a skr pro v 1.1 tft 35 v2 tmc2209, uart mode, sensorless homing marlin 2.0.x, latest release While trying to change TEMP_SENSOR_0 from 1 to -5 (which indicates i am using a max amplifier) the tft disconnects.

i can't also upload firmware via usb but i need to upload it every time with sd card, quite annoying (i use vscode)

https://drive.google.com/drive/folders/1DBuVxjGbWB0jsPYh_vwEzkzLrf90pklb?usp=sharing

this is the link with the full marlin version i am using, here the tft is not working

How do you have your MAX31865 wired up to the SKR PRO V1.1 board?

On top of that I really need to see the error message coming from Marlin for the MAX31865 board, but since you are using a TFT screen you will not see the message all you will see in "no printer attached". Please use a 12864 LCD on EXP2 so you can see what error message Marlin is sending you. Yes, the 12864 LCD uses both the EXP1 and EXP2 connectors but you just need to clamp on a tap to EXP2 to access the hardware SPI lines (https://www.digikey.com/product-detail/en/te-connectivity-amp-connectors/1658622-1/AKC10B-ND/825411)

But from looking at your firmware files it looks like the Hardware SPI configuration you are using the MAX31865 should work.

To do any more debugging we need to know the exact error message Marlin is sending out.

GadgetAngel commented 4 years ago

@daniagos I noticed that in configuration.h file you have not enabled the Marlin variable SDSUPPORT. I believe you need to enable this parameter.

If you enable SDSUPPORT and get the 12864 LCD we can test to see if the hardware SPI is working on the SKR PRO V1.1 board by seeing if you can use the SD card on the LCD screen. Without SDSUPPORT the SD card is not supported because the SD_DETECT_PIN is not defined:

MAX31865 Hardware SPI HELP_SDSUPPORT must be enabled

MAX31865 Hardware SPI HELP_With SDSUPPORT the  SD card will also work on SPI2 or EXP2 connection

With your tft screen, try just enabling SDSUPPORT in configuration.h and see if that change effects the problem. The SDSUPPORT variable may be needed to get MAX31865 hardware SPI to work

daniagos commented 4 years ago

immagine wiring max31865

this is the wiring setup

is with this connector ((https://www.digikey.com/product-detail/en/te-connectivity-amp-connectors/1658622-1/AKC10B-ND/825411)) possible to attach both lcd and use spi hardware cables?

I enabled sd card pin, and i recieve the error " Printer halted. kill() called! " as soon as it turns on, then disconnects

daniagos commented 4 years ago

you left me on facebook, now i want to use only one of it, to add the second later, but even with only one it can't work

daniagos commented 4 years ago

i tried commenting all the "THERMAL_PROTECTION" but nothing changes, i have the same error and then it disconnects

daniagos commented 4 years ago

I tried to set the "TEMP_SENSOR_0 -3", i still have the same error, but the tft stay connected, i can see bed temperatures. i disabled all the security features, set min temp to -100, but with "TEMP_SENSOR_0 -5" there is no way to have the tft connected

once i switch back to 1 all runs and the thermocouple works fine.

daniagos commented 4 years ago

i have the same error even with "TEMP_SENSOR_0 147" and 1047, there is something really strange

daniagos commented 4 years ago

IMG_20201027_170553

it seem as if the option is disabled even if it is defined correctly

GadgetAngel commented 4 years ago

IMG_20201027_170553

it seem as if the option is disabled even if it is defined correctly

It appears disabled because you have not enabled SDSUPPORT in configuration.h file. Please remove the two forward slashes on the SDSUPPORT line in configuration.h file.

Yes, this connector ((https://www.digikey.com/product-detail/en/te-connectivity-amp-connectors/1658622-1/AKC10B-ND/825411) will allow you to add a third connector to EXP2 which will then allow you to access the hardware SPI lines that the LCD screen uses. The default hardware SPI bus is used by the EXP2 connector or the LCD screen. As long as the MAX31865_CS_PIN is different than the SDSS PIN then both can use the same hardware SPI bus.

BUT, you MUST enable the Marlin variable SDSUPPORT in configuration.h file. The SD_CONNECTION_IS(LCD) depends on the SDSUPPORT being enabled!

From doing more research, I found that when someone tried to use a MAX31855 using hardware SPI, they found that having SDSUPPORT disabled in configuration.h file, Marlin will NOT enable the SPI CLK line. Without the SPI CLK line enabled in Marlin, the MAX31865 board (yours) or a MAX31855 board (https://github.com/MarlinFirmware/Marlin/issues/16508#issuecomment-572546227) will not produce any data because the MASTER (the SKR PRO V1.1 board) will not clock the data out of the MAX31865 board. So, please, please enable SDSUPPORT in configuration.h file, so that Marlin will ENABLE the default hardware SPI CLK line.

Without any data coming from the MAX31865 board, Marlin will produced the "Printer halted. kill() called!" message and halt your printer! The only way to then get the printer started again is by powering off the printer then powering the printer back on again.

daniagos commented 4 years ago

IMG_20201028_105418 IMG_20201028_105432

As you can see i enabled sd card, but that part still seem disabled.

i can't understand why i have also error if i use pt100 set as "TEMP_SENSOR_0 147", and the pt100 connected to the thermocouple pins, this should work even without spi, right?

GadgetAngel commented 4 years ago

@daniagos upload your zipped Marlin folder again to your google drive, so I can look at the changes you currently have in your firmware. You will have to get a new shared link to the new zipped Marlin folder and place the link here in the thread so I can download your Marlin folder.

i can't understand why i have also error if i use pt100 set as "TEMP_SENSOR_0 147", and the pt100 connected to the thermocouple pins, this should work even without spi, right?

I do not understand what you are trying to do here. Did you remove or disable the following in pins_BTT_SKR_PRO_common.h when you set TEMP_SENSOR_0 to 147?:

#ifndef MAX38165_CS_PIN
  #define MAX6675_SS_PIN                   TEMP_0_PIN
  //#define MAX6675_SS2_PIN                  TEMP_1_PIN // Force hardware SPI to be used making MAX38165_CS_PIN equal to  MAX6675_SS_PIN
  #define MAX38165_CS_PIN                  MAX6675_SS_PIN
#endif

Did you change TEMP_0_PIN also? Why are you using a thermocouple? I thought we were hooking up a PT100 and MAX31865 board. Let's take on problem at a time. Which situation do you want to debug?

When I looked at your Marlin folder earlier and I enable SDSUPPORT with the TEMP_SENSOR_0 set to -5 and pins_BTT_SKR_PRO_common.h set as follows

#ifndef MAX38165_CS_PIN
  #define MAX6675_SS_PIN                   TEMP_0_PIN
  //#define MAX6675_SS2_PIN                  TEMP_1_PIN // Force hardware SPI to be used making MAX38165_CS_PIN equal to  MAX6675_SS_PIN
  #define MAX38165_CS_PIN                  MAX6675_SS_PIN
#endif

the section listed as

#if SD_CONNECTION_IS(LCD)

  #define SD_DETECT_PIN                     PF12
  #define SDSS                              PB12

was enabled!

So you have changed too many things and now I have no idea what state your Marlin firmware is in. So again I ask that you upload you current Marlin folder to your google drive so I can help you debug what is going wrong.

Which PT100 cartridge are you using?

Did you hook up the PT100 sensor (or cartridge) to the thermistor port without an amplifier board?

Most PT100 need amplification.

E3D online states the following: "The E3D PT100 amplifier board amplifies the signal from the PT100 to a voltage level that your printer controller can read easily and accurately"

But the E3D PT100 amplifier board means you would use thermistor table 20 or 21.

I know you can use this PT1000 sensor and use thermistor table 1047 (https://e3d-online.com/products/pt1000-temperature-sensor?_pos=1&_sid=26fb8c09c&_ss=r). This PT1000 sensor does not need an amplifier board.

I have never used thermistor table 147 with PT100 temperature sensor on a SKR PRO V1.1 board.

Here is an article on PT100 sensors: https://components101.com/sensors/pt100-rtd-temperature-sensor

In the above article notice the MCU they talk about uses a 5VDC input logic level. The SKR PRO V1.1 board is a 3.3VDC input logic level MCU. Also notice that the input PIN has to be an ADC input PIN not a digital PIN.

So the PT100 that you use with thermistor table 147 better produce 3.3VDC input logic levels with a 4.7K Ohm pull up resistor in the circuit.

Most PT100 hooked (with amplification or an amplifier board) to a 4.7K Ohm pull up resistor requires the user to define a custom thermistor table because the 4.7K Ohm pull up will affect the voltage read by the SKR PRO V1.1 ADC PIN.

I think thermistor table 147 is for MCUs that work at 5VDC input logic levels or AVR boards (not the SKR PRO V1.1 board).

If you used thermistor table 147 and hooked up the PT100 without an amplifier board to the thermistor port, then the PT100 was not outputting enough voltage to measure a temperature correctly and your 3D printer again sent out a " Printer halted. kill() called! " message because it thinks that the hotend temperature sensor is not there.

When you used the MAX31865 amplifier board, and the MAX31865 board was not getting the SPI CLK line enabled the same error message was produced for the same reason. The SKR PRO V1.1 board thinks that the PT100 is not working and that the hotend temperature sensor is not present in the system so it produces a "Printer halted. kill() called!" message.

If you get the "Printer halted. kill() called" message, then there is something wrong with the configuration in Marlin and we need to figure that out, by doing things one-step-at-a-time. Only change one thing.

Let's stick to trying to get the MAX31865 board (amplifier board) working with hardware SPI and the PT100 sensor connected to the MAX31865 board.

So because you indicated that your SD_CONNECTION_IS(LCD) is not highlighted in the VScode editor, please upload your current Marlin folder to your google drive again (this time zip up the whole Marlin folder first. Then place the zipped file on your google drive and enable shared link on the google drive, then place the shared link here in this thread) so I can download your Marlin configuration and figure out why the SD_CONNECTION_IS(LCD) is not being enabled.

daniagos commented 4 years ago

i want to debug the e3d pt100 with max amplifier.

starting from stock marlin to see if there are other things that gives me tft error, all security removed, SDSUPPORT enabled

1) i started with "TEMP_0_PIN 1" with a termocouple installation as in stock marlin. all works fine, no error, temp corrected. 1.1) removed the sensor, it show -15 degrees but still no error as expected

2) i tried to see if there is problem with the pt100 installed as the termocouple, so removed termocouple, installed pt100 in the same 2 pins, set "TEMP_0_PIN 147". ERROR: printer halted, kill() called

this make me think of a library problem more than a hardware problem

3) i tried to connect the max amplifier

wired it checked that SDSUPPORT is enabled

wrote in pins

ifndef MAX38165_CS_PIN

define MAX6675_SS_PIN TEMP_0_PIN

//#define MAX6675_SS2_PIN TEMP_1_PIN // Force hardware SPI to be used making MAX38165_CS_PIN equal to MAX6675_SS_PIN

define MAX38165_CS_PIN MAX6675_SS_PIN

endif

changed

define TEMP_0_PIN PF4 to #define TEMP_0_PIN PE4

And do the other setting on config_adv listed in your picture. ERROR: printer halted, kill() called.

i think that i don't have the right library installed, on platformio is there only available the "adafruit/Adafruit MAX31865 library@^1.3.0", That is listed in my env and installed, but on the [features] in platformio i find this:

max6675_is_max31865 = Adafruit MAX31865 library@~1.1.0

is there something i should correct?

as soon as i can i zip the marlin and upload it on google drive

GadgetAngel commented 4 years ago

@daniagos This is my current understanding of the different PT100 thermistor tables in Marlin 2.0.x:


PT100 Thermistor tables and how to use them:

I should use table "-5" if I am using a PT100 sensor attached to the MAX31865 board and the SPI bus.

I should use table "20" when I use a PT100 sensor attached to a PT100 amplifier board (INA826 amp) AND the power supplied to that PT100/PT1000 Amplifier board (INA826) IS EQUAL TO the ADC reference voltage for the MCU AND there is NO Pull-UP resistor. --NOTE: For SKR PRO V1.1/V1.2, SKR V1.3/V1.4/V1.4 Turbo, GTR V1.0, M5 V1.0 all use 3.3 VDC as the ADC reference voltage for the MCU. Therefore use table 20 when the PT100/PT1000 Amplifier board is powered by 3.3VDC

I should use table "21" when I use a PT100 sensor attached to a PT100 amplifier board (INA826 amp) AND the power supplied to that PT100/PT1000 Amplifier board (INA826) IS DIFFERENT FROM the ADC reference voltage for the MCU AND there is NO Pull-UP resistor. --NOTE: The E3D PT100 Amplifier board wants 5V as its power supply. But the SKR PRO V1.x (like the GTR V1.0) uses 3.3VDC as the ADC reference voltage for the MCU. If you use 5VDC to power to the PT100 amplifier board, the amplifier can output a maximum signal with 5VDC. To protect the SKR PRO V1.x board (or the GTR V1.0 board, or SKR V1.3 or SKR V1.4 or SKR V1.4 TURBO), use a 3.6V Zener Diode (reverse biased hookup) between the output signal of the PT100 amplifier board and the PT100 amplifier board's ground (to protect the MCU from getting fried from a 5VDC input signal).

I should use table "147" when I use a PT100 sensor attached to a PT100 amplifier board (INA826 amp) that uses 5VDC as its input voltage and is wired up to a MCU's analog input PIN which is 5VDC tolerant and has a 4.7k pull-up resistor attached to the analog input PIN.

I should use table "110" when I use a PT100 sensor attached to a PT100 amplifier board (INA826 amp) that use 5VDC as it input voltage and is wired up to a MCU analog input PIN which is 5VDC tolerant and has a 1k Ohm pull-up resistor attached to the analog input PIN.

I should use table "201" when I have a PT100 sensor attached to a PT100 amplifier board that uses LMV324 amp (used by the 3D printer Overlord V1.1) and the amplifier board uses 5VDC as its input voltage and is wired up to a MCU analog input PIN which is 5VDC tolerant and has NO pull-up resistor attached to the analog input PIN.

I should use table "1047" when I have a PT1000 sensor attached to NO AMPLIFIER board and the PT1000 sensor is wired up to a MCU analog input PIN which is 5VDC tolerant and has a 4.7K pull-up resistor attached to the analog input PIN. Here is the PT1000 sensor (https://e3d-online.com/products/pt1000-temperature-sensor)

I should use table "110" when I have a PT1000 sensor attached to NO AMPLIFIER board and the PT1000 sensor is wired up to a MCU analog input PIN which is 5VDC tolerant and has a 1K pull-up resistor attached to the analog input PIN. Here is the PT1000 sensor (https://e3d-online.com/products/pt1000-temperature-sensor)


If you look at the processor data sheet for the SKR PRO V1.x or SKR V1.3/SKR V1.4 or SKR V1.4 Turbo or GTR V1.0/M5 V1.0 boards (https://www.st.com/resource/en/datasheet/stm32f407zg.pdf) or (https://github.com/bigtreetech/BIGTREETECH-SKR-V1.3/blob/master/BTT%20SKR%20V1.4/Datasheet/LPC17-32-IC.pdf) or (https://github.com/bigtreetech/BIGTREETECH-SKR-V1.3/blob/master/BTT%20SKR%20V1.4/Datasheet/LPC17-32-IC.pdf) or (https://www.st.com/resource/en/datasheet/stm32f407ig.pdf) you will see the PINs for the thermistor ports are 5VDC tolerant as long as they are NOT USED for analog input. When they are used for analog input they are ONLY 3.3VDC tolerant. See note (4) on processor data sheet for SKR PRO 1.x or GTR V1.0/M5V1.0. See note [2] on processor data sheets for SKR 1.3/V1.4 or SKR V1.4 Turbo. Therefore, you can use a 3.6V Zener Diode (reverse bias hookup) between the analog output pin for the amplifier board and the amplifier board's ground pin to protect the SKR series boards from getting fried:

SKR PRO Overvoltage Protection Block

GadgetAngel commented 4 years ago

i want to debug the e3d pt100 with max amplifier.

starting from stock marlin to see if there are other things that gives me tft error, all security removed, SDSUPPORT enabled

  1. i started with "TEMP_0_PIN 1" with a termocouple installation as in stock marlin. all works fine, no error, temp corrected. 1.1) removed the sensor, it show -15 degrees but still no error as expected
  2. i tried to see if there is problem with the pt100 installed as the termocouple, so removed termocouple, installed pt100 in the same 2 pins, set "TEMP_0_PIN 147". ERROR: printer halted, kill() called

this make me think of a library problem more than a hardware problem

  1. i tried to connect the max amplifier

wired it checked that SDSUPPORT is enabled

wrote in pins

ifndef MAX38165_CS_PIN

define MAX6675_SS_PIN TEMP_0_PIN

//#define MAX6675_SS2_PIN TEMP_1_PIN // Force hardware SPI to be used making MAX38165_CS_PIN equal to MAX6675_SS_PIN

define MAX38165_CS_PIN MAX6675_SS_PIN

endif

changed

define TEMP_0_PIN PF4 to #define TEMP_0_PIN PE4

And do the other setting on config_adv listed in your picture. ERROR: printer halted, kill() called.

i think that i don't have the right library installed, on platformio is there only available the "adafruit/Adafruit MAX31865 library@^1.3.0", That is listed in my env and installed, but on the [features] in platformio i find this:

max6675_is_max31865 = Adafruit MAX31865 library@~1.1.0

is there something i should correct?

as soon as i can i zip the marlin and upload it on google drive

YES, you only want Adafruit MAX31865 library version 1.1.0. Un-install Adafruit MAX31865 V1.3.0 library!

Here is the way to tell that you are using the right library. When you compile the code after the success message appears, scroll to the very top of the output listing and look for the library version the compiler used to create the .bin file:

Gihub _help_ wrong Adafruit MAX31865 used_another place to check to see if you are using the correct library page 3

To uninstall the wrong library versions go to the Platformio HOME page and select "Libraries", then select the Installed tab, then in search field type "Adafruit MAX31865". Select the uninstall button for all libraries that are not V1.1.0.

Gihub _help_ wrong Adfruit MAX31865 used_Find all MAX31855 library that are not 1 10 version and unistall them Page 2

Once all MAX31865 libraries of version 1.3.0 are un-installed then just recompile the code. Marlin will see that the Adafruit MAX31865 library is not installed and automatically download the correct version 1.1.0.

Also change in configuration.h #define EXTRUDERS 2 instead of 2 use 1. Since you are only using one extruder at this time.

Also change max6675_is_max31865 = Adafruit MAX31865 library@~1.1.0 to max6675_is_max31865 = Adafruit MAX31865 library@1.1.0. Ensure you do not have any other env concerning "Adafruit MAX31865 library". if you do comment it out by adding a # sign before the line

daniagos commented 4 years ago

ok, so the trial i did are completely wrong.

uninstalled MAX31865 libraries version 1.3.0

define EXTRUDERS 1

changed max6675_is_max31865 = Adafruit MAX31865 library@~1.1.0 to max6675_is_max31865 = Adafruit MAX31865 library@1.1.0

not founded other Adafruit MAX31865 library

as soon as i go back home i try again and hope everything works,

Thanks for precious help

GadgetAngel commented 4 years ago

ok, so the trial i did are completely wrong.

uninstalled MAX31865 libraries version 1.3.0

define EXTRUDERS 1

changed max6675_is_max31865 = Adafruit MAX31865 library@~1.1.0 to max6675_is_max31865 = Adafruit MAX31865 library@1.1.0

not founded other Adafruit MAX31865 library

as soon as i go back home i try again and hope everything works,

Thanks for precious help

If it works or does not work let me know.

daniagos commented 4 years ago

it doesn't work neither in this way..

https://drive.google.com/drive/folders/1DBuVxjGbWB0jsPYh_vwEzkzLrf90pklb?usp=sharing

this is the link, there is the zip file of marlin of the actual configuration i tried..

GadgetAngel commented 4 years ago

it doesn't work neither in this way..

https://drive.google.com/drive/folders/1DBuVxjGbWB0jsPYh_vwEzkzLrf90pklb?usp=sharing

this is the link, there is the zip file of marlin of the actual configuration i tried..

I looked at your new configuration files from your google drive:

currently in configuration.h file you have: #define EXTRUDERS 1 Which is what we want, we want to try to only get ONE hot end to work on MAX31865 board using hardware SPI.

BUT currently in pins_BTT_SKR_PRO_common.h file you have:

#ifndef MAX38165_CS_PIN
  #define MAX6675_SS_PIN                   TEMP_0_PIN
  #define MAX6675_SS2_PIN                  TEMP_1_PIN // Force hardware SPI to be used making MAX38165_CS_PIN equal to  MAX6675_SS_PIN
  #define MAX38165_CS_PIN                  MAX6675_SS_PIN
#endif

When you #define MAX6675_SS2_PIN TEMP_1_PIN the temperature.cpp file will try to toggle the MAX6675_SS2_PIN to see if it can gather information off the second MAX31865 board. So please leave everything the same EXCEPT comment out the #define MAX6675_SS2_PIN TEMP_1_PIN line in pins_BTT_SKR_PRO_common.h file.

So I want your pins_BTT_SKR_PRO_common.h file:

#ifndef MAX38165_CS_PIN
  #define MAX6675_SS_PIN                   TEMP_0_PIN
  // Force hardware SPI to be used making MAX38165_CS_PIN equal to  MAX6675_SS_PIN
  #define MAX38165_CS_PIN                  MAX6675_SS_PIN
#endif

I know this might not fix the issue but I would like for you to try this before we have you try to use Software SPI instead for Hardware SPI. Marlin must be working on the MAX31865 stuff. I recently got two other users MAX31865 boards to work in software SPI but you are the first user I have worked with trying to get hardware SPI to work.

Where did you buy your MAX31865 board? Did you get it from Adafruit? Try the above change then let me know if it worked or not and we will talk about trying to use the board in Software SPI.

You see, If the MAX31865 will work in Software SPI then we know the MAX31865 board is working. The next step would be to open a tick under Marlin firmware to let them know we have a MAX3165 working in Software SPI but we can not get it to work in Hardware SPI mode.

GadgetAngel commented 4 years ago

@daniagos Look at this: https://github.com/MarlinFirmware/Marlin/issues/5723#issuecomment-554800209

There might be a problem with the speed and mode. From looking at the Marlin code, from HAL_SPI.cpp the SD card is using SPI mode 0 and from SdFatConfig.h the SD card is using Using SPI_SD_INIT_RATE 5 which sets the init clock at 328KHz for sd-card or 0.328MHz.

For the MAX31865 board, the Adafruit_MAX31865 board in hardware spi mode, the MAX31865 board defaults to SPI MODE 1 (from Adafruit_MAX31865.cpp) and speed of 500000.

So it appears the HAL_SPI.cpp(Marlin\src\HAL\STM32\HAL_SPI.cpp) for the SKR PRO V1.x board is using SPI MODE 0 while the Adafruit_MAX31865 board is defaulting to SPI MODE 1. We could try and change the SPI MODE 1 (SPI_MODE1) to SPI MODE 0 or SPI_MODE0 and see if that makes it work. But if you do this and then later switch to Software SPI, you will need to switch the SPI MODE back to SPI_MODE1.

I think you need to send this to the Marlin firmware guys, (open a ticket under https://github.com/MarlinFirmware/Marlin/issues) because I do not think Hardware SPI works for MAX31865 board on the SKR PRO board. We are now getting beyond my ability to help.

And remember if you want two MAX31865 boards, the software SPI option may not work either. I have had a ticket opened (https://github.com/MarlinFirmware/Marlin/issues/19663#issue-717855237) and have gotten no response to it.

To get two PT100 hooked up to the SKR PRO V1.1 board you may have to use the PT100 amplifier board and run it at 5VDC (using a 3.6 V Zener Diode in reverse bias hook up) use table 21 or set TEMP_SENSOR_0 to 21 and TEMP_SENSOR_1 to 21. Look here at my manual to help you setup the wiring for this situation. Look at Appendix M., You want Analog Procedure and use these Techniques: Technique number 1 and Technique number 2. Here is the manual: https://github.com/GadgetAngel/SKR-PRO-V1.1-Stepper-Driver-Jumper-Configuration-Manual/tree/master/CURRENT-Manual

From this discussion I will need to update all manuals to indicate that MAX31865 and hardware SPI mode does not work. I will test this against my own hardware here at home to double check the results that we gotten before making this statement.

GadgetAngel commented 4 years ago

@daniagos Use (Appendix M, Analog Procedure using 2 PT100 amplifier boards) Technique number 1 and Technique number 2 that way you do not need to do the hardware hack on the SKR PRO V1.1 board.

GadgetAngel commented 4 years ago

@daniagos I am going to test your setup when the TFT35 V2.0 arrives in two days.

daniagos commented 4 years ago

thanks, in those days i make all the trials you suggest, thank you so much

oldman4U commented 4 years ago

@daniagos I am going to test your setup when the TFT35 V2.0 arrives in two days.

Are you buying hardware to be able to help others, Angel!!??

daniagos commented 4 years ago

hI, I commented the #define MAX6675_SS2_PIN TEMP_1_PIN, no changes of the problem.

i am still in hardware configuration, i tried looking for the spi mode in HAL_SPI.cpp(Marlin\src\HAL\STM32\HAL_SPI.cpp), but my SPI_MODE is SPI_MODE0 from the beginning of all .

I founded this in pins configuration:

if SD_CONNECTION_IS(LCD)

define SD_DETECT_PIN PF12

define SDSS PB12

elif SD_CONNECTION_IS(ONBOARD)

// The SKR Pro's ONBOARD SD interface is on SPI1. // Due to a pull resistor on the clock line, it needs to use SPI Data Mode 3 to // function with Hardware SPI. This is not currently configurable in the HAL, // so force Software SPI to work around this issue.

define SOFTWARE_SPI

define SDSS PA4

define SCK_PIN PA5

define MISO_PIN PA6

define MOSI_PIN PB5

define SD_DETECT_PIN PB11

from what i understand i do not have the right configuration to let sd use hardware spi, so nothing will work, right?

GadgetAngel commented 4 years ago

hI, I commented the #define MAX6675_SS2_PIN TEMP_1_PIN, no changes of the problem.

i am still in hardware configuration, i tried looking for the spi mode in HAL_SPI.cpp(Marlin\src\HAL\STM32\HAL_SPI.cpp), but my SPI_MODE is SPI_MODE0 from the beginning of all .

I founded this in pins configuration:

if SD_CONNECTION_IS(LCD)

define SD_DETECT_PIN PF12

define SDSS PB12

elif SD_CONNECTION_IS(ONBOARD)

// The SKR Pro's ONBOARD SD interface is on SPI1. // Due to a pull resistor on the clock line, it needs to use SPI Data Mode 3 to // function with Hardware SPI. This is not currently configurable in the HAL, // so force Software SPI to work around this issue.

define SOFTWARE_SPI

define SDSS PA4

define SCK_PIN PA5

define MISO_PIN PA6

define MOSI_PIN PB5

define SD_DETECT_PIN PB11

from what i understand i do not have the right configuration to let sd use hardware spi, so nothing will work, right?

@daniagos I am still working on it.

Just got in the TFT screen and I just solder together my Adafruit MAX31865 board.

I checked yesterday that the Adafruit MAX31865 board will work with the SKR PRO V1.1 and the TFT35 V2.0. IT does.

Today is when I work on hardware SPI.

The reason I did it this way was to ensure that both my PT100 sensor and the Adafruit MAX31865 board are in working condition.

I also have my SKR PRO V1.1 board with BIQU TMC2209 in UART mode on X, Y, Z and E0.

Let me do some more testing and see what I can figure out.

@oldman4U Yes, I did not own a TFT35 V2.0 and I wanted to try it since it does not have the dual mode capability and only has the touch screen. Neat device. I even got my logo to come up on the screen. I like trying out new stuff that is why they call me "Gadget Angel". I love gadgets!

daniagos commented 4 years ago

I am trying with software spi mode for one adafruit max31865 right now, i can't make the adafruit work neither in this case,i have always the same error of printer killed, i really don't know what's wrong with my setting

GadgetAngel commented 4 years ago

@daniagos I hooked up my MAX31865 board as follows:

M_Hardware_SPI_Technique#1andMethod#1_wiring_diagram_Page_97


I have the same exact board (SKR PRO V1.1) and drivers (TMC2209 in UART mode) as you do and the TFT (TFT35 V2.0) stays connected!

Check your PT100 sensor with an Ohm meter. It should read around 110 Ohms at room temperature.

I defined my SERIAL_PORT and SERIAL_PORT_2 as follows (remember I just got my TFT35 V2.0 so I compiled the TFT35 screen firmware and updated the firmware for the screen before this test to ensure the screen was not getting into the issue, I highly recommend that you compile your TFT35 firmware and update the firmware on you TFT35 V2.0 screen):

SERIAL_PORT and SERIAL_PORT_2 defined

Here is my pins_BTT_SKR_PRO_common.h file:

PINS file

Here is a video of the bootup process, you can see I never touch the TFT screen and the TFT screen will after about 30 seconds start displaying the temperature for the PT100 sensor:

https://drive.google.com/file/d/1OGdkTxWqfj61Y-6039-VQrJ3G60MO_hF/view?usp=sharing

I connected pronterface (http://kliment.kapsi.fi/printrun/) to my board via the USB connection and found I was getting a lot of "Temp measurement errors" but the SKR PRO V1.1 board was still able to read the PT100 sensor temperature values. If you look here https://github.com/MarlinFirmware/Marlin/issues/5723#issuecomment-557290199, Marlin knows of this issue but it did not make the TFT disconnect from the SKR PRO V1.1 board.

Adafruit MAX31865 Error messages

Here is are pictures of my hook up:

Green wire is CS of Adafruit MAX31865 board Purple wire is SDI of Adafruit MAX31865 board Brown wire is SDO of Adafruit MAX31865 board White wire is CLK of Adafruit MAX31865 board Black wire is GND of Adafruit MAX31865 board Red wire is VIN of Adafruit MAX31865 board

MAX31865_HW_SPI_wiring

MAX31865_HW_SPI_Wrining_with_PT100wiring

MAX31865_HW_SPI_EXT-1

MAX31865_HW_SPI_EXt-1_2

MAX31865_HW_SPI_EXP2

Here is the output from the compile:

Output from my compile for Adafruit MAX31865 hardware SPI setup

To handle the errors you can just set the SERIAL_PORT to -1 and SERIAL_PORT_2 to 1. You will still be getting "Temp measurement errors" but you will not see them on the TFT screen. Marlin needs to fix this problem but as you can see from https://github.com/MarlinFirmware/Marlin/issues/5723#issuecomment-557290199 they are aware that the issue. We need to really report this as a bug in Marlin.

I have reported this issue to Marlin https://github.com/MarlinFirmware/Marlin/issues/19994#issue-734104840

GadgetAngel commented 4 years ago

I am trying with software spi mode for one adafruit max31865 right now, i can't make the adafruit work neither in this case,i have always the same error of printer killed, i really don't know what's wrong with my setting

Check the Adafruit MAX31865 board. Do you have the MAX31865 board prepared properly?

Check out this website that shows where you need to solder the jumpers on the MAX31865 board to indicate you will use a PT100 2-Wire configuration: https://voron.dozuki.com/Guide/How+to+Use+a+Pt100+Thermistor+w-+Skr+Boards/73?lang=en

Does your PT100 show approximately 110 Ohms when you use an Ohm meter?

If the PT100 sensor is not showing approximately 110 Ohms at room temperature and the Adafruit MAX31865 board is not prepared properly the Adafruit MAX31865 board will not work in Software SPI or Hardware SPI Mode.

Double check all your wires for continuity, to ensure that they are not broken. Double check how you wired up the Adafruit MAX31865 board to the SKR PRO V1.1 board.

Have you looked at Appendix O (https://github.com/GadgetAngel/SKR-PRO-V1.1-Stepper-Driver-Jumper-Configuration-Manual/tree/master/CURRENT-Manual) of my manual and followed the Manual's instructions? You can download the whole manual in zipped file : https://drive.google.com/file/d/1O82o16ouSXPkhGySXl9ZE93H82mqJ-9m/view

If the Adafruit MAX31865 board does not work in Software SPI then you have a problem with your setup. Sorry I can not come to your house to debug the hook up problem but this is one you will have to find yourself. Good luck. Let me know if you find the error with your hook up.

daniagos commented 4 years ago

IT WORKSSSSSSSS

O LOVE YOU MAN!!!

I WAS USING STUPID PT100 WITH 25M ohm, i put some other pt100 i have at home and now the tft works, i still have some errors from pt100, but the display now shows it, i have error temperature from max, but it still show me the room temperature.

can i use a second pt100 connected as this one, changing cs pin for temperature1?

do you have suggestions on how to connect the board to the pc? i installed drivers, but i can't really connect it to proterface or repetier or cura.

i set the baud rate to skr board, com port in pc setting and in the program, what am i doing wrong? i am using the blue cable that bigtreetech gave me

GadgetAngel commented 4 years ago

IT WORKSSSSSSSS

O LOVE YOU MAN!!!

I WAS USING STUPID PT100 WITH 25M ohm, i put some other pt100 i have at home and now the tft works, i still have some errors from pt100, but the display now shows it, i have error temperature from max, but it still show me the room temperature.

can i use a second pt100 connected as this one, changing cs pin for temperature1?

do you have suggestions on how to connect the board to the pc? i installed drivers, but i can't really connect it to proterface or repetier or cura.

i set the baud rate to skr board, com port in pc setting and in the program, what am i doing wrong? i am using the blue cable that bigtreetech gave me

The SKR PRO V1.1 by design does not do firmware updates via the USB cable. You MUST use the SD card and manually place the SD card into the SKR PRO V1.1 board's SD card reader and reboot the board for the firmware to update. I do not know why the SKR PRO and GTR V1.0 boards are made this way. But you can not update firmware over the USB cable like you can with the SKR V1.3 or SKR V1.4 boards. Sorry that is just the way it is.

Yes, You should be able to now connect up the second PT100 (110 Ohm) to your second Adafruit MAX31865 board and use Y Jumper cables to connect up the SPI lines, 5V and GND lines but use a seperate wire for the CS line on the second MAX31865 board.

Try changing your SERIAL_PORT in configuration.h file to #define SERIAL_PORT -1 and #define SERIAL_PORT2 1 , That way you will not see the "temp measurement errors! MAX6675" messages. And defining the SERIAL_PORT and SERIAL_PORT2 this way allows you to use the pronterface on the USB port connected to your PC. You can talk to the SKR PRO V1.1 board via USB (send G-codes and M-codes to the board) but again you can not upload new firmware via the USB cable. Hope this solves your problems.

daniagos commented 4 years ago

All works, i love you man, thanks for all !!

GadgetAngel commented 4 years ago

@daniagos If you tried hooking up two MAX31865 via Hardware SPI you noticed that the second Adafruit MAX31865 will not show the correct temperature on TEMP_SENSOR_1.

To fix this issue and to also allow 2 Adafruit MAX31865 boards to run is Software SPI, and to fix the issue with "temp errors" that the Marlin was producing erroneously when an Adafruit MAX31865 board was attached to the SKR PRO V1.1, I have submitted a Pull Request to fix these issues.

If you can not wait for Marlin to incorporate these fixes here is the Pull Request and a link to my branch of Marlin that currently allows two Adafruit MAX31865 boards to work without issue on the SKR PRO V1.1 board.

PR (Pull Request) I have submitted is at (https://github.com/MarlinFirmware/Marlin/pull/20074#issue-517368163). This PR uses my branch of Marlin that fixes the issue.

My branch of Marlin that fixes this issue is located at https://github.com/GadgetAngel/Marlin/tree/Marlin-Fix-2AdafruitMAX31865

You can download my Marlin-Fix-2AdafruitMAX31865 branch and try my version if you want to. My Marlin-Fix-2AdafruitMAX31865 branch was built on Marlin bug-fix-2.0.x that existed on 11/8/2020 (today).

GadgetAngel commented 4 years ago

@daniagos If you want to hookup two Adafruit MAX31865 board via Hardware SPI the boards will no longer produce 'error temp measurement errors'. Just download the latest bugfix-2.0.x and the issue has been corrected in the latest branch of bugfix!

GadgetAngel commented 4 years ago

@daniagos Please close this issue because the latest bugfix-2.0.x resolves all the issues

daniagos commented 4 years ago

Ok, thanks you so much for your precious help!

GadgetAngel commented 4 years ago

Ok, thanks you so much for your precious help!

You are welcome, I was happy to help and together we found a bug in Marlin and got it fixed.

daniagos commented 3 years ago

Hi, i set the first pt100 and it is working as yours, but i can't make the second pt100 work, the board disconnect from tft, and i can't connect the board to the printer.

If i set the second termistor to 1 instead than -5 i can connect to the board (there still are errors in max amplifier) and tft work, but i can't see the second termistor temperature in the tft (it show as if i set only one extruder).

What can i look for?

GadgetAngel commented 3 years ago

@daniagos I found your last comment that said you took the second one off and placed it on your board as TEMP_SENSOR_0. That proves to me that your PT100 and second MAX31865 both are working.

Now I want you to put the first one back on as TEMP_SENSOR_1 or TEMP_1_PIN.

Now zip up your Marlin folder (with platformio.ini file included) on to your free google drive. Turn on the link to share the zip folder and place the link in this thread. I need to see the firmware to help you debug the issue.

daniagos commented 3 years ago

https://drive.google.com/file/d/1WEwuyBfSX1LRO_mR0DB9MqsU1oND-LA3/view?usp=sharing

This is the link for the file. i noticed that with a single max defined while preheating the cartridge i have no problem and shows the temperature correctly,, so i assumed it was working, but while i try homing the tft shows me errors and can't home the z

GadgetAngel commented 3 years ago

@daniagos I look at this later today after I wake up. I have been awake all night but I will look at it.

GadgetAngel commented 3 years ago

@daniagos

@daniagos If you want to hookup two Adafruit MAX31865 board via Hardware SPI the boards will no longer produce 'error temp measurement errors'. Just download the latest bugfix-2.0.x and the issue has been corrected in the latest branch of bugfix!

@daniagos PLEASE use the latest bugfix branch of MARLIN. You are using the release branch and the release branch will produce all the error messages. So try downloading the latest bugfix branch. Try it out and if it still does not work reupload that Marlin folder for me to look at.

daniagos commented 3 years ago

ok, now it seem all working good, except i can't set from tft a temperature over 275.

In both board setting and display setting it is set to 550 degrees the max temperature, with pronterface i can heat the cartridge to 550 without problems, but no from tft, why?

GadgetAngel commented 3 years ago

@daniagos You problem now resides with the TFT firmware NOT Marlin firmware.

I am assuming in Marlin's configuration.h file you have the following:

#define HEATER_0_MAXTEMP 550
#define HEATER_1_MAXTEMP 550

The TFT firmware is limiting you on the max temperature setting.

Go to https://github.com/bigtreetech/BIGTREETECH-TouchScreenFirmware and download the source code for the TFT firmware. Here is a good YouTube video on how to update the TFT firmware: https://youtu.be/NmreTXdyqhk. Please watch it.

Look at C:[your computer location]\BIGTREETECH-TouchScreenFirmware\Copy to SD Card root directory to update\config.ini

In config.ini file the following is stated:

# IMPORTANT NOTE:
#   Ensure that the following options are enabled in Marlin firmware
#
# General options:
#   M115_GEOMETRY_REPORT (in Configuration_adv.h)
#   M114_DETAIL (in Configuration_adv.h)
#   REPORT_FAN_CHANGE (in Configuration_adv.h)
#   EMERGENCY_PARSER (in Configuration_adv.h)
#   SERIAL_FLOAT_PRECISION 4 (in Configuration_adv.h)
#   HOST_ACTION_COMMANDS (in Configuration_adv.h)
#
# Options to support printing from onboard SD:
#   SDSUPPORT (in Configuration.h)
#   AUTO_REPORT_TEMPERATURES (in Configuration_adv.h)
#   AUTO_REPORT_SD_STATUS (in Configuration_adv.h)
#   LONG_FILENAME_HOST_SUPPORT (in Configuration_adv.h)
#   SDCARD_CONNECTION ONBOARD (in Configuration_adv.h)
#
# Options to support (Un)Load menu:
#   FILAMENT_LOAD_UNLOAD_GCODES (in Configuration_adv.h)
#

In config.ini file, around line 282, you will see the following:

#### Bed / Extruder / Chamber Maximum Temperatures
# Format: [max_temp: T0:<max temp> T1:<max temp> T2:<max temp> T3:<max temp> T4:<max temp> T5:<max temp> BED:<max temp> CHAMBER:<max temp>]
#
# Unit: [°C]
#
max_temp:T0:275 T1:275 T2:275 T3:275 T4:275 T5:275 BED:150 CHAMBER:60

Try changing T0 and T1 to 550 and see if that solves the problem. Recompile the TFT firmware in VScode and upload to 8 GB SD card and place the 8GB SD card into the SD card reader on the TFT display. Reboot the printer and the TFT firmware update will occur.

If changing T0 and T1 in the TFT firmware does not work, then you need to post this issue over at https://github.com/bigtreetech/BIGTREETECH-TouchScreenFirmware/issues page because your problem is NOT due to the Marlin firmware but due to the TFT firmware for the screen.

oldman4U commented 3 years ago

First class help like always. 👍🏻

GadgetAngel commented 3 years ago

Here is the latest SUMMARY or GUIDE:

GUIDE:

  1. You CAN NOT mix PT100/PT1000 and thermocouples:

If you have only one hotend then you can have the following:

If you have two hotends then you can have the following:

If you have two hot-ends then you CAN NOT have the following:

*** If you only have ONE PT100 (or PT1000 or Thermocouple) on your printer and you have two hotends then in Marlin you must use TEMP_SENSOR_0 as the PT100 (or PT1000 or Thermocouple) even if you have the PT100 (or PT1000 or Thermocouple) hooked up to the second extruder. Just override your PIN definitions to have TEMP_0_PIN point to where the PT100 (or PT1000 or Thermocouple) is located.


  1. Marlin still uses the old naming scheme of the 20x4 display REPRAP_DISCOUNT_SMART_CONTROLLER in the pins-file for the software SPI pins names: The EXP1 and EXP2 ports are used for display screens. EXP1 contains a HARDWARE SPI bus while EXP2 contains a Software SPI bus. The EXP1 hardware SPI bus signal names are obvious in the pins-file but the EXP1 software SPI bus signal names are NOT obvious. Here is the EXP1 software SPI bus signal names used in pins-file with their corresponding SPI software functions:
    LCD_PINS_D4 is software SPI signal SCK for EXP1
    LCD_PINS_ENABLE is the data line or software SPI signal MOSI for EXP1
    LCD_PINS_RS is Register select (command/data) or software SPI signal SS for EXP1

  1. Translation table to be used (or Thermistor table) depends on the power you supply to the amplifier board and the ADC reference voltage of the MCU:

GTR V1 0 Overvoltage Protection Block

On the GTR V1.0 board, here is a list of PINS that you will need to prevent negative current injection. We prevent negative current from flowing into the MCU by using a Schottky diode between the output signal of the amplifier board and ground. I do this as preventive measure. It protects the MCU from getting fried.

GTR V1 0 Prevent Negative Current Injection GTR V1 0 Footnote 3 block

The below wiring diagram for PT100 using Analog ADC input using 5V DC for the PT100 amplifier board but the MCU board (GTR V1.0) uses 3.3 VDC ADC reference voltage, therefore the Thermistor table to use for this is Table 21:

g_PT100_Technique#2_Method#1_PF8_wiring_diagram_Page_27

The below wiring diagram for PT100 using Analog ADC input using 3.3 VDC for the PT100 amplifier board but the MCU board (GTR V1.0 board) uses 3.3 VDC ADC reference voltage, therefore the Thermistor table to use for this is Table 20 (see the process data sheet and you will find that PF10 need protection against negative current injection,https://www.st.com/resource/en/datasheet/stm32f407ig.pdf#page=114):

G_PT100_Technique#4_Method#1_PF10_wiring_diagram_Page_29


The information contained in [1, 4-14] are for the Adafruit MAX31865 board (PT100/PT100 sensors)


4A. For Marlin 2.0.7.1 or earlier versions of Marlin: If you want to use the Adafruit MAX31865 board with a PT100, you MUST correct the calibration resistor value that Marlin uses in temperature.cpp as follows: If you search in temperature.cpp for the string "max31865.temperature(", there are ONLY two places in temperature.cpp that will be found: Original is: max31865.temperature(100, 400) // 100 ohms = PT100 resistance. 400 ohms = calibration resistor CHANGE TO: max31865.temperature(100, 430) // 100 ohms = PT100 resistance. 400 ohms = calibration resistor

4B. For Marlin 2.0.7.2: If you want to use the Adafruit MAX31865 boards with a PT100, you MUST use the Marlin variables in the configuration.h file to adjust the sensor resistance ohm value and calibration resistance ohm value as shown below. If they are not present in configuration.h file then you will need to add the two statements below to configuration.h file. Use the Marlin variables instead of making the change in the Marlin software in temperature.cpp as stated in 4A.

In configuration.h file:

// for TEMP_SENSOR_0:
#define MAX31865_SENSOR_OHMS 100
#define MAX31865_CALIBRATION_OHMS 430

4C. For Marlin bugfix-2.0.x branch or later versions of Marlin: If you want to use the Adafruit MAX31865 boards with a PT100, you MUST use the Marlin variables in the configuration.h file to adjust the sensor resistance ohm value and calibration resistance ohm value as shown below. Use the Marlin variables instead of making the changes in the Marlin software in temperature.cpp as stated in 4A. If you only have one (1) Adafruit MAX31865 board than use the Marlin variable MAX31865_SENSOR_OHMS_0 and Marlin variable MAX31865_CALIBRATION_OHMS_0 only (disable MAX31865_SENSOR_OHMS_1 and disable MAX31865_CALIBRATION_OHMS_1). If you have two (2) Adafruit MAX31865 boards then enable all four Marlin variables: MAX31865_SENSOR_OHMS_0, MAX31865_CALIBRATION_OHMS_0, MAX31865_SENSOR_OHMS_1, and MAX31865_CALIBRATION_OHMS_1.

In configuration.h file:

// for TEMP_SENSOR_0:
#define MAX31865_SENSOR_OHMS_0 100
#define MAX31865_CALIBRATION_OHMS_0 430
// for TEMP_SENSOR_1:
#define MAX31865_SENSOR_OHMS_1 100
#define MAX31865_CALIBRATION_OHMS_1 430

5A. For Marlin 2.0.7.1 or earlier versions of Marlin: If you want to use the Adafruit MAX31865 board with a PT1000, you MUST correct the resistor values that Marlin uses in temperature.cpp as follows: If you search in temperature.cpp for the string "max31865.temperature(", there are ONLY two places in temperature.cpp that will be found: Original is: max31865.temperature(100, 400) // 100 ohms = PT100 resistance. 400 ohms = calibration resistor CHANGE TO: max31865.temperature(1000, 4300) // 100 ohms = PT100 resistance. 400 ohms = calibration resistor

5B. For Marlin 2.0.7.2: If you want to use the Adafruit MAX31865 boards with a PT1000, you MUST use the Marlin variables in the configuration.h file to adjust the sensor resistance ohm value and calibration resistance ohm value as shown below. If they are not present in configuration.h file then you will need to add the two statements below to configuration.h file. Use the Marlin variables instead of making the change in the Marlin software in temperature.cpp as stated in 5A.

In configuration.h file:

// for TEMP_SENSOR_0:
#define MAX31865_SENSOR_OHMS 1000
#define MAX31865_CALIBRATION_OHMS 4300

5C. For Marlin bugfix-2.0.x branch or later versions of Marlin: If you want to use the Adafruit MAX31865 boards with a PT1000, you MUST use the Marlin variables in the configuration.h file to adjust the sensor resistance ohm value and calibration resistance ohm value as shown below. Use the Marlin variables instead of making the changes in the Marlin software in temperature.cpp as stated in 5A. If you only have one (1) Adafruit MAX31865 board than use the Marlin variable MAX31865_SENSOR_OHMS_0 and Marlin variable MAX31865_CALIBRATION_OHMS_0 only (disable MAX31865_SENSOR_OHMS_1 and disable MAX31865_CALIBRATION_OHMS_1). If you have two (2) Adafruit MAX31865 boards then enable all four Marlin variables: MAX31865_SENSOR_OHMS_0, MAX31865_CALIBRATION_OHMS_0, MAX31865_SENSOR_OHMS_1, and MAX31865_CALIBRATION_OHMS_1.

In configuration.h file:

// for TEMP_SENSOR_0:
#define MAX31865_SENSOR_OHMS_0 1000
#define MAX31865_CALIBRATION_OHMS_0 4300
// for TEMP_SENSOR_1:
#define MAX31865_SENSOR_OHMS_1 1000
#define MAX31865_CALIBRATION_OHMS_1 4300

  1. You must prepare the Adafruit MAX31865 board for 2_WIRE_MODE because that is the ONLY mode for the Adafruit MAX31865 board that Marlin supports.

Do the following to prepare the Adafruit MAX31865 board correctly:

You need to solder two bridges on the MAX31865 board. Marlin will only read an RTD which have 2-Wire configuration. (https://voron.dozuki.com/Guide/How+to+Use+a+Pt100+Thermistor+w-+Skr+Boards/73?lang=en). Ensure your PT100 is hooked to the middle two terminals.

Preparing the MAX31865 board


  1. If you want to use the Adafruit MAX31865 board for PT100 sensor or PT1000 sensor then ENSURE that the Adafruit MAX31865 library is NOT the most recent update by doing the following: Check that in platformio.ini file the following line exists in [common] under lib_deps = and feature dependencies [features]: MAX6675_IS_MAX31865 = Adafruit MAX31865 library@~1.1.0

  1. Do I have a 100 ohm or 1000 ohm MAX31865 board? Here is how you tell:

Do I have a 100 ohm or 1000 ohm MAX31865 board


  1. If you want to use PT100 temperature sensor with the Adafruit MAX31865 over SPI you have two options: A. Software SPI (where the MCU performs the handshake in software) B. Hardware SPI (where the MCU performs the handshake with hardware interrupts).

  2. If you want to use the Hardware SPI for Adafruit MAX31865, then you have to know which SPI bus on the MCU board is the default hardware SPI bus (SPI Bus 1 or SPI Bus 2) due to the fact that the Adafruit MAX31865 Library will default to this bus (Adafruit MAX31865 library does not expose the bus number, so it just defaults).

11A. How to determine the default hardware SPI bus for a the SKR boards: To determine the default hardware SPI bus for BTT SKR boards, look at the following Marlin variable:

  1. SDCARDCONNECTION in your boards pins[your board].h file
  2. SDSUPPORT in configuration.h file
  3. SDCARD_CONNECTION in configuration_adv.h file

In the pins-file (Marlin\src\pins) for the board, look for the following Marlin variables:

//
// SD Support
//

#ifndef SDCARD_CONNECTION
  #define SDCARD_CONNECTION                  LCD
#endif

and in configuration.h file:

/**
 * SD CARD
 *
 * SD Card support is disabled by default. If your controller has an SD slot,
 * you must uncomment the following option or it won't work.
 */
#define SDSUPPORT

and in configuratio_adv.h file:

  /**
   * Set this option to one of the following (or the board's defaults apply):
   *
   *           LCD - Use the SD drive in the external LCD controller.
   *       ONBOARD - Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.)
   *  CUSTOM_CABLE - Use a custom cable to access the SD (as defined in a pins file).
   *
   * :[ 'LCD', 'ONBOARD', 'CUSTOM_CABLE' ]
   */
  //#define SDCARD_CONNECTION LCD

Below is a table indicates the default hardware SPI bus for the BTT SKR series of boards:

     board                      pins-file                              SDCARD_CONNECTION setting                      default HW SPI BUS number
---------------           ------------------                       -------------------------------                    --------------------------
SKR mini E3 V2.0..........pins_BTT_SKR_MINI_E3_common.h........................LCD.................................................1 (mico SD card reader) NOTE: SDSUPPORT is enabled or disabled in configuration.h file as long as ONBOARD_SPI_DEVICE in pins_BTT_SKR_MINI_E3_common.h is set to 1. Use SPI1 header PINS.  When you have a device hooked up to the SPI header pins, disconnect the power to the MAX temperature sensor board  (remove GND and VIN from the MAX board) when doing a firmware update via the SD card reader.  If you do not disconnect the power your SD card can become corrupted.  To over come the fact that BTT put a pull-up resistor on the SCLK line of the SD card reader you might have to add a compile directive to tell the software to use SPI_MODE3 instead of SPI_MODE0.  This feature has not yet been added to the bugfix branch of Marlin.  But be aware that for the MAX31855 and MA31865 boards you will need to use SPI_MODE3 when using hardware SPI, for the MAX6675 you will need to use SPI_MODE2 when using hardware SPI.  See item 14 below and EXAMPLE 2 for a wiring diagram and instructions.
SKR mini E3 V2.0..........pins_BTT_SKR_MINI_E3_common.h........................ONBOARD.............................................1 (micro SD card reader)  when SDSUPPORT is enabled or disabled in configuration.h file as long as ONBOARD_SPI_DEVICE in pins_BTT_SKR_MINI_E3_common.h is set to 1; Use SPI1 header PINS.  When you have a device hooked up to the SPI header pins, disconnect the power to the MAX temperature sensor board  (remove GND and VIN from the MAX board) when doing a firmware update via the SD card reader.  If you do not disconnect the power your SD card can become corrupted. To over come the fact that BTT put a pull-up resistor on the SCLK line of the SD card reader you might have to add a compile directive to tell the software to use SPI_MODE3 instead of SPI_MODE0.  This feature has not yet been added to the bugfix branch of Marlin.  But be aware that for the MAX31855 and MA31865 boards you will need to use SPI_MODE3 when using hardware SPI, for the MAX6675 you will need to use SPI_MODE2 when using hardware SPI. See item 14 below and EXAMPLE 2 for a wiring diagram and instructions.
SKR mini E3 V2.0..........pins_BTT_SKR_MINI_E3_common.h........................ONBOARD/LCD........................................."2 or 3" (look at Marlin\src\HAL\STM32F1\spi_pins.h file) when SDSUPPORT is enabled or disabled in configuration.h file; Use the appropriate pins indicated in Marlin\src\HAL\STM32F1\spi_pins.h file.  Set ONBOARD_SPI_DEVICE in pins_BTT_SKR_MINI_E3_common.h is set to 2 or 3 depending on which pins you use to hook up the device. "2" means you are using PB13 as SCLK, PB14 as MISO and PB15 as MOSI; "3" means you are using PB3 as SCLK, PB4 as MISO and PB5 as MOSI. "1" means you are using PA5 as SCLK, PA6 as MISO and PA7 as MOSI.  "1" is the default setting for ONBOARD_SPI_DEVICE in pins_BTT_SKR_MINI_E3_common.h.  See item 14 below and EXAMPLE 2 for a wiring diagram and instructions.
SKR E3 TURBO..............pins_BTT_SKR_E3_TURBO.h..............................ONBOARD.............................................0 (EXP1) NOTE: when SDSUPPORT is disabled in configuration.h file.  P0_15 is SPI SCLK line, P0_17 is SPI MISO line and P0_18 is SPI MOSI line; see the SKR_E3_TURBO_PIN diagram(https://github.com/bigtreetech/BIGTREETECH-SKR-E3-Turbo/blob/master/Hardware/BTT%20SKR%20E3%20Turbo-Pin.pdf) for location on the EXP1 connector.  See item 14 below and EXAMPLE 3 for a wiring diagram and instructions.
SKR E3 TURBO..............pins_BTT_SKR_E3_TURBO.h..............................ONBOARD.............................................1 (micro SD card reader) NOTE: ONLY when SDSUPPORT is enabled in configuration.h file. Use JSER Micro SD TF Memory Card Kit Male to Female Extension Adapter (https://www.amazon.com/gp/product/B071DKCK47/).   Since the micro SD card Reader on the SKR E3 TURBO uses a pull-up resistor on the SCLK line you need to use the `-DTEMP_MODE=3` compile flag to tell the MAX31865 library to use SPI_MODE3 instead of SPI_MODE0.  This compile flag has NOT been implemented in the Adafruit MAX31865 library Version 1.1.0 so you will need to use my MAX31865 library called Adafruit-MAX31865-V1.1.0-Mod-M. To use Adafruit-MAX31865-V1.1.0-Mod-M library in platformio.ini file replace MAX6675_._IS_MAX31865   = Adafruit MAX31865 library@~1.1.0 with MAX6675_._IS_MAX31865   = https://github.com/GadgetAngel/Adafruit-MAX31865-V1.1.0-Mod-M.git then add the compile flag -DTEMP_MODE=3 by going to platformio.ini file and find [common_LPC]. In [common_LPC] the build flags line should look like the following: build_flags       = ${common.build_flags} -DU8G_HAL_LINKS -IMarlin/src/HAL/LPC1768/include -IMarlin/src/HAL/LPC1768/u8g -DTEMP_MODE=3.  When updating firmware, remove the Extension Adapter, place your SD card in the reader and reboot so the new firmware will be uploaded to the SKR E3 TURBO board. If you get a MIN TEMP error ignore it and power off the printer. Now, reinsert the Extension Adapter back into the SD card reader.  Turn power on to the printer and you should still have a good temperature reading as long as your firmware changes did not effect the MAX board.    See item 14 below and EXAMPLE 3 for a wiring diagram and instructions.
SKR E3 TURBO..............pins_BTT_SKR_E3_TURBO.h..............................LCD.................................................0 (EXP1) NOTE: when SDSUPPORT is disabled in configuration.h file. P0_15 is SPI SCLK line, P0_17 is SPI MISO line and P0_18 is SPI MOSI line; see the SKR_E3_TURBO_PIN diagram(https://github.com/bigtreetech/BIGTREETECH-SKR-E3-Turbo/blob/master/Hardware/BTT%20SKR%20E3%20Turbo-Pin.pdf) for location on the EXP1 connector.    See item 14 below and EXAMPLE 3 for a wiring diagram and instructions.
SKR E3 TURBO..............pins_BTT_SKR_E3_TURBO.h..............................LCD.................................................0 (EXP1) NOTE: when SDSUPPORT is enabled in configuration.h file. P0_15 is SPI SCLK line, P0_17 is SPI MISO line and P0_18 is SPI MOSI line; see the SKR_E3_TURBO_PIN diagram(https://github.com/bigtreetech/BIGTREETECH-SKR-E3-Turbo/blob/master/Hardware/BTT%20SKR%20E3%20Turbo-Pin.pdf) for location on the EXP1 connector.    See item 14 below and EXAMPLE 3 for a wiring diagram and instructions.
SKR V1.3..................pins_BTT_SKR_V1_3.h..................................LCD.................................................0 (EXP2) NOTE: SDSUPPORT is enabled or disabled in configuration.h file. 
SKR V1.3..................pins_BTT_SKR_V1_3.h..................................ONBOARD.............................................0 (EXP2) ONLY when SDSUPPORT is disabled in configuration.h file
SKR V1.3..................pins_BTT_SKR_V1_3.h..................................ONBOARD.............................................1 (micro SD card reader) ONLY when SDSUPPORT is enabled in configuration.h file; Use JSER Micro SD TF Memory Card Kit Male to Female Extension Adapter (https://www.amazon.com/gp/product/B071DKCK47/).  When updating firmware, remove the Extension Adapter, place your SD card in the reader and reboot so the new firmware will be uploaded to the SKR V1.3 board. If you get a MIN TEMP error ignore it and power off the printer. Now, reinsert the Extension Adapter back into the SD card reader.  Turn power on to the printer and you should still have a good temperature reading as long as your firmware changes did not effect the MAX board. To over come the fact that BTT put a pull-up resistor on the SCLK line of the SD card reader you might have to add a compile directive to tell the software to use SPI_MODE3 instead of SPI_MODE0.  This feature has not yet been added to the bugfix branch of Marlin.  But be aware that for the MAX31855 and MA31865 boards you will need to use SPI_MODE3 when using hardware SPI, for the MAX6675 you will need to use SPI_MODE2 when using hardware SPI.
SKR V1.4..................pins_BTT_SKR_V1_4.h..................................LCD.................................................0 (EXP2) NOTE: SDSUPPORT is enabled or disabled in configuration.h file
SKR V1.4..................pins_BTT_SKR_V1_4.h..................................ONBOARD.............................................0 (EXP2) NOTE: ONLY when SDSUPPORT is disabled in configuration.h file
SKR V1.4..................pins_BTT_SKR_V1_4.h..................................ONBOARD.............................................1 (SPI header) NOTE: ONLY when SDSUPPORT is enabled in configuration.h file
SKR V1.4 Turbo............pins_BTT_SKR_V1_4.h..................................LCD.................................................0 (EXP2) NOTE: SDSUPPORT is enabled or disabled in configuration.h file
SKR V1.4 Turbo............pins_BTT_SKR_V1_4.h.................................ONBOARD..............................................0 (EXP2) NOTE: ONLY when SDSUPPORT is disabled in configuration.h file
SKR V1.4 Turbo............pins_BTT_SKR_V1_4.h.................................ONBOARD..............................................1 (SPI header) NOTE: ONLY when SDSUPPORT is enabled in configuration.h file.  To over come the fact that BTT put a pull-up resistor on the SCLK line of the SD card reader you might have to add a compile directive to tell the software to use SPI_MODE3 instead of SPI_MODE0.  This feature has not yet been added to the bugfix branch of Marlin.  But be aware that for the MAX31855 and MA31865 boards you will need to use SPI_MODE3 when using hardware SPI, for the MAX6675 you will need to use SPI_MODE2 when using hardware SPI.
SKR PRO V1.x..............pins_BTT_SKR_PRO_common.h............................LCD.................................................2 (EXP2) NOTE: when SDSUPPORT is disabled in configuration.h file
SKR PRO V1.x..............pins_BTT_SKR_PRO_common.h............................LCD.................................................2 (EXP2) NOTE: when SDSUPPORT is enabled in configuration.h file. 
SKR PRO V1.x..............pins_BTT_SKR_PRO_common.h............................ONBOARD.............................................2 (EXP2) NOTE: when SDSUPPORT is disabled in configuration.h file
SKR PRO V1.x..............pins_BTT_SKR_PRO_common.h............................ONBOARD.............................................1 (micro SD card reader) NOTE: ONLY when SDSUPPORT is enabled in configuration.h file. Use JSER Micro SD TF Memory Card Kit Male to Female Extension Adapter (https://www.amazon.com/gp/product/B071DKCK47/).  When updating firmware, remove the Extension Adapter, place your SD card in the reader and reboot so the new firmware will be uploaded to the SKR PRO V1.x board. If you get a MIN TEMP error ignore it and power off the printer. Now, reinsert the Extension Adapter back into the SD card reader.  Turn power on to the printer and you should still have a good temperature reading as long as your firmware changes did not effect the MAX board.
GTR V1.0..................pins_BTT_GTR_V1_0.h..................................ONBOARD.............................................2 (EXP2) NOTE: when SDSUPPORT is disabled in configuration.h file 
GTR V1.0..................pins_BTT_GTR_V1_0.h..................................ONBOARD.............................................1 (micro SD card reader) NOTE: ONLY when SDSUPPORT is enabled in configuration.h file. Use JSER Micro SD TF Memory Card Kit Male to Female Extension Adapter (https://www.amazon.com/gp/product/B071DKCK47/).  When updating firmware, remove the Extension Adapter, place your SD card in the reader and reboot so the new firmware will be uploaded to the GTR V1.0 board. If you get a MIN TEMP error ignore it and power off the printer. Now, reinsert the Extension Adapter back into the SD card reader.  Turn power on to the printer and you should still have a good temperature reading as long as your firmware changes did not effect the MAX board.
GTR V1.0..................pins_BTT_GTR_V1_0.h..................................LCD.................................................2 (EXP2) NOTE: when SDSUPPORT is disabled in configuration.h file
GTR V1.0..................pins_BTT_GTR_V1_0.h..................................LCD.................................................2 (EXP2) NOTE: when SDSUPPORT is enabled in configuration.h file. 

Some board's also have an additional file to check. In Marlin/buildroot/share/PlatformIO/variants/[board name]/variant.h file look for the following Marlin variables:

#define PIN_SPI_SCK
#define PIN_SPI_MISO
#define PIN_SPI_MOSI

If the board has both a variant.h file and a pins-file than Marlin first reads the variant.h file and then reads the pins-file. Therefore, the pins-file can override the default hardware SPI bus that the variant.h file defines. For example the SKR PRO V1.1 board, has two files to look through (variant.h and pins_BTT_SKR_PRO_common.h). The GTR V1.0 board has both files to look through. Let us look at an example. The GTR V1.0 board has the variant.h file which contains the following:

// Below SPI and I2C definitions already done in the core
// Could be redefined here if differs from the default one
// SPI Definitions
#define PIN_SPI_MOSI            PB15    //GADGETANGEL this is SPI2 (search the variant.h file for this PIN name and in the comment you will see the SPI bus number for this PIN)
#define PIN_SPI_MISO            PB14    //GADGETANGEL this is SPI2
#define PIN_SPI_SCK             PB13    //GADGETANGEL this is SPI2
#define PIN_SPI_SS              PB12

For the GTR V1.0 board the pins_BTT_GTR_V1_0.h contains the following:

#ifndef SDCARD_CONNECTION
  #define SDCARD_CONNECTION ONBOARD      //GADGETANGEL SD Card is set for ONBOARD which is SPI1(SD card reader) if SDSUPPORT is enabled in configuration.h file. If SDSUPPORT is DISABLED in configuration.h file than SPI2 (EXP2) is used.
#endif

//
// By default the LCD SD (SPI2) is enabled
// Onboard SD is on a completely separate SPI bus, and requires
// overriding pins to access.
//
#if SD_CONNECTION_IS(LCD)
  #define SD_DETECT_PIN                     PB10
  #define SDSS                              PB12               //GADGETANGEL this is SPI2, the same as the variant.h file
#elif SD_CONNECTION_IS(ONBOARD)
  // Instruct the STM32 HAL to override the default SPI pins from the variant.h file
  #define CUSTOM_SPI_PINS
  #define SDSS                              PA4
  #define SS_PIN                            SDSS
  #define SCK_PIN                           PA5                //GADGETANGEL this is SPI1 (search the variant.h file for this PIN name and in the comment you will see the SPI bus number for this PIN) 
  #define MISO_PIN                          PA6                //GADGETANGEL this is SPI1
  #define MOSI_PIN                          PA7                //GADGETANGEL this is SPI1
  #define SD_DETECT_PIN                     PC4
#elif SD_CONNECTION_IS(CUSTOM_CABLE)
  #define "CUSTOM_CABLE is not a supported SDCARD_CONNECTION for this board"
#endif

Notice that for the GTR V1.0 board and SDSUPPORT enabled in configuration.h file, when Marlin executes, it will first set the default hardware SPI bus number to SPI2 due to the fact that the variables in variant.h get read in first. Then the file pins_BTT_GTR_V1_0.h gets read and it changes the default hardware SPI bus to SPI1. This is due to the Marlin variable "CUSTOM_SPI_PINS" and SDSUPPORT being enabled in configuration.h file, which is used to override the variant.h file SPI Marlin variables.


Additional Equipment that maybe necessary to obtain HARDWARE SPI for Adafruit MAX31865

11B. As stated in the above table for default hardware SPI bus you might need additional equipment to tap into the default hardware SPI lines. This section provides you links to find the extra equipment.

If you need to tap into the EXP2 flat ribbon cable use: https://www.digikey.com/product-detail/en/te-connectivity-amp-connectors/1658622-1/AKC10B-ND/825411 Orient the clamp on connector so that it is in the same orientation as the one already installed on the end of the flat ribbon cable that gets plugged into the EXP2 socket of the MCU board. This way you will be able to keep straight which PINs are which. I oriented mine to be upside down just like the connector that is already on the end that plugs into the EXP2 socket of the MCU board.

If you need to tap into the SD card reader ONBOARD the MCU board then use: JSER Micro SD TF Memory Card Kit Male to Female Extension Adapter (https://www.amazon.com/gp/product/B071DKCK47/) You will have to solder on three wires to the locations shown below and it only costs $4.00 on Amazon.com:

Micro_SD_CARD_Adapter Board to tap into SPI lines for the SD card reader with Labels

I have also used BIGTREETECH's Module BTT TF Cloud V1.0 SD Cloud Wireless Transmission Module (https://www.biqu.equipment/products/bigtreetech-module-btt-tf-cloud-v1-0-sd-cloud-wireless-transmission-module) and tapped into the SPI lines of the onboard ESP-12S chip. But, while the chip boots up and is plugged into the MCU board the MCU board will indicate a "ERROR: MAX TEMP on E1" and halt the printer. If you hit the MCU board's reset button the next time the MCU boots the TF cloud device might boot first or may not boot first. If the MCU boot first than you will get the MAX TEMP error again.

I decided that this was not worth the hassle so I went with the JSER's "Micro SD TF Memory Card Kit Male to Female Extension Adapter" instead. BTW, the JSER item only costs $4.00 US dollars on amzon.com. So get a couple, in case you can not get the wires attached on the first try.


HARDWARE SPI for Adafruit MAX31865

  1. If you want to use Hardware SPI for Adafruit MAX31865 (for PT100 or PT1000) then you must know which SPI bus will be the default hardware SPI bus for the board. For the SKR PRO V1.1 the default hardware SPI bus is EXP2. For GTR V1.0 board the default hardware SPI bus is the onboard micro SD card reader. You have to find a way to access the default hardware SPI bus' MOSI, MISO and SCK lines. To access these lines for the SKR PRO board, use a clamp-on flat ribbon cable connector (https://www.digikey.com/product-detail/en/te-connectivity-amp-connectors/1658622-1/AKC10B-ND/825411).

Default Hardware SPI Hack info Block

++++++++++++++++++++++++++++++++EXAMPLE 1+++++++++++++++++++++++++++++++++++

To setup Marlin on GTR V1.0 board for Adafruit MAX31865 and Hardware SPI, do the following in pins_BTT_GTR_V1_0.h :

#define TEMP_0_PIN  PI9
#ifndef MAX31865_CS_PIN
    #define MAX6675_SS_PIN TEMP_0_PIN
        // force Hardware SPI by making  MAX31865_CS_PIN equal to MAX6675_SS_PIN
    #define MAX31865_CS_PIN MAX6675_SS_PIN  
#endif

In configuration.h:

set TEMP_SENSOR_0 to -5

AND {

For Marlin 2.0.7.1 or earlier version of Marlin: you have to change the code in temperature.cpp module as stated in 4A above.

OR

For Marlin 2.0.7.2 versions: ENABLE the following in configuration.h file or ADD the following lines to configuration.h file:

#define MAX31865_SENSOR_OHMS 100
#define MAX31865_CALIBRATION_OHMS 430

OR

For Marlin bugfix-2.0.x version or later versions of Marlin: ENABLE the following in configuration.h file:

#define MAX31865_SENSOR_OHMS_0 100
#define MAX31865_CALIBRATION_OHMS_0 430
//#define MAX31865_SENSOR_OHMS_1 100
//#define MAX31865_CALIBRATION_OHMS_1 430

}

Here is the wiring diagram for the Adafruit MAX31865 with PT100 via Hardware SPI on GTR V1.0 board. To access the Hardware SPI lines for the GTR V1.0 board use a Micro SD Card Extension Adapter and hack the pins off the Adapter (https://www.amazon.com/gp/product/B071DKCK47/) and the Adapter only cost $4.00 US dollars. Now all you need is one free I/O pin to specify the Chip Select for the MAX31865. Again, the GTR V10 board uses the SD Card readers SPI lines as the default hardware SPI when SDSUPPORT is enabled in configuration.h file AND while SDCARD_CONNECTION ONBOARD is defined in pins_BTT_GTR_V1_0.h file. Otherwise, tap into the EXP2 SPI lines.

G_Hardware_SPI_MAX31865_PT100_Technique#2andMethod#1_wiring_diagram_Page_98

++++++++++++++++++++++++++++++++EXAMPLE 2+++++++++++++++++++++++++++++++++++

For SKR PRO V1.1/V1.2 MCU board you would have to tap into the hardware SPI lines via the EXP2 connector.

To setup Marlin for Adafruit MAX31865 and Hardware SPI, on SKR PRO V1.1/V1.2 board do the following in pins_BTT_SKR_PRO_common.h:

#define TEMP_0_PIN  PE2
#ifndef MAX31865_CS_PIN
    #define MAX6675_SS_PIN TEMP_0_PIN
        // force Hardware SPI by making  MAX31865_CS_PIN equal to MAX6675_SS_PIN
    #define MAX31865_CS_PIN MAX6675_SS_PIN  
#endif

In configuration.h:

set TEMP_SENSOR_0 to -5

AND {

For Marlin 2.0.7.1 or earlier version of Marlin: you have to change the code in temperature.cpp module as stated in 4A above.

OR

For Marlin 2.0.7.2: ENABLE the following in configuration.h file or ADD the following lines to configuration.h file:

#define MAX31865_SENSOR_OHMS 100
#define MAX31865_CALIBRATION_OHMS 430

OR

For Marlin bugfix-2.0.x version or later versions of Marlin: ENABLE the following in configuration.h file:

#define MAX31865_SENSOR_OHMS_0 100
#define MAX31865_CALIBRATION_OHMS_0 430
//#define MAX31865_SENSOR_OHMS_1 100
//#define MAX31865_CALIBRATION_OHMS_1 430

}

Here is the wiring diagram for the Adafruit MAX31865 with PT100 via Hardware SPI on the SKR PRO V1.1/V1.2 board:

One PT100s with One MAX31865 boards in Hardware  SPI on SKR PRO V1 2_V1 1 board _ Instructions and Wiring Diagram


If you have 2 (two) Adafruit MAX31865 (for PT100/PT1000) boards you want to wire up to your 3D Printer, this is now been fixed in Marlin bugfix-2.0.x branch. So the release branch of Marlin 2.0.7.2 DOES NOT allow two Adafruit MAX31865 boards to work properly BUT the bugfix-2.0.x branch has fixed the issue. I am sure Marlin 2.0.7.3 will also fix the issue.

  1. If you want Adafruit MAX31865 (for PT100) AND you want to use TWO PT100 sensors, one attached to E0 and the other PT100 attached to E1 (two MAX31865 amplifiers), then the MAX31865 SPI Clock Line and MAX31865 SPI MOSI line and MAX31865 SPI MISO line MUST be shared by both MAX31865 amplifier boards . For the SKR PRO V1.1/V1.2 the default hardware SPI bus is EXP2 or SPI bus number 2. You need to use a flat ribbon cable clamp tap to access the hardware SPI line on EXP2. You can find one at https://www.digikey.com/product-detail/en/te-connectivity-amp-connectors/1658622-1/AKC10B-ND/825411

Below is a sample of how to get TWO PT100s in Hardware SPI to work on SKR PRO V1.1/v1.2 board by using TWO Adafruit MAX31865 boards , make the following changes in pins_BTT_SKR_PRO_common.h:

#define TEMP_0_PIN                   PE2
#define TEMP_1_PIN                   PE4
#ifndef MAX31865_CS_PIN
    #define MAX6675_SS_PIN      TEMP_0_PIN
        // force Hardware SPI by making  MAX31865_CS_PIN equal to MAX6675_SS_PIN
    #define MAX31865_CS_PIN     MAX6675_SS_PIN     
        #define MAX6675_SS2_PIN     TEMP_1_PIN
        // force Hardware SPI by making  MAX31865_CS2_PIN equal to MAX6675_SS2_PIN
    #define MAX31865_CS2_PIN    MAX6675_SS2_PIN
#endif

In configuration.h:

set TEMP_SENSOR_0 to -5 
set TEMP_SENSOR_1 to -5

AND {

For Marlin 2.0.7.1 or earlier version of Marlin: you have to change the code in temperature.cpp module as stated in 4A above.

OR

For Marlin 2.0.7.2: ENABLE the following in configuration.h file or ADD the following lines to configuration.h file:

#define MAX31865_SENSOR_OHMS 100
#define MAX31865_CALIBRATION_OHMS 430

OR

For Marlin bugfix-2.0.x version or later versions of Marlin: ENABLE the following in configuration.h file:

#define MAX31865_SENSOR_OHMS_0 100
#define MAX31865_CALIBRATION_OHMS_0 430
#define MAX31865_SENSOR_OHMS_1 100
#define MAX31865_CALIBRATION_OHMS_1 430

}

Here is the wiring diagram for the above example [number 13] (for 2 PT100s with 2 MAX31865 in Hardware SPI mode):

Two PT100s with Two MAX31865 boards in Hardware  SPI on SKR PRO V1 2_V1 1 board _ Instructions and Wiring Diagram_V2


Software SPI for Adafruit MAX31865 board

  1. If you want to use the Software SPI for Adafruit MAX31865 then do the following:

++++++++++++++++++++++++++++++EXAMPLE1+++++++++++++++++++++++++++++

Below is a example of how to get Software SPI to work on SKR PRO V1.1/V1.2 for Adafruit MAX31865 (PT100 sensor), make the following changes in pins_BTT_SKR_PRO_common.h:

#define TEMP_0_PIN    PE2
#ifndef MAX6675_SS_PIN
    #define MAX6675_DO_PIN                          PD5
    #define MAX6675_SCK_PIN                                 PE0
    #define MAX31865_MOSI_PIN                                           PD2
    //the below line must be equal to the CS line of MAX31865 board
    #define MAX31865_CS_PIN                             TEMP_0_PIN
    //set MAX6675_SS_PIN so it CAN NOT be equal to MAX31865_CS_PIN (this will force Software SPI to be used). If
    //MAX31865_CS_PIN is NOT defined Marlin will automatically equate it to MAX6675_SS_PIN. Therefore, you must set
    //MAX6675_SS_PIN to some unused PIN (the example here uses PG13 as a PIN not being used)
    #define MAX6675_SS_PIN                                                         PG13   //hopefully this will not be needed in the future, I am working with Marlin with a PR to get rid of this unnecessary define.
    //enable the below two lines if you have two Adafruit MAX31865 boards in software spi mode
    //#define MAX31865_CS2_PIN                                                  TEMP_1_PIN
    //#define MAX6675_SS2_PIN                                                   PG13
#endif

In configuration.h: set TEMP_SENSOR_0 to -5. If you have a second MAX31865 board then add set TEMP_SENSOR_1 to -5

AND {

For Marlin 2.0.7.1 or earlier version of Marlin: you have to change the code in temperature.cpp module as stated in 4A above.

OR

For Marlin 2.0.7.2: ENABLE the following in configuration.h file or ADD the following lines to configuration.h file:

#define MAX31865_SENSOR_OHMS 100
#define MAX31865_CALIBRATION_OHMS 430

OR

For Marlin bugfix-2.0.x version or later versions of Marlin: ENABLE the following in configuration.h file:

#define MAX31865_SENSOR_OHMS_0 100
#define MAX31865_CALIBRATION_OHMS_0 430
// enable the below two lines if you have a MAX31865 on TEMP_SENSOR_1
//#define MAX31865_SENSOR_OHMS_1 100
//#define MAX31865_CALIBRATION_OHMS_1 430

}

Here is a wiring diagram for a PT100 sensor with an Adafruit MAX31865 using Software SPI: 14.++++++++++++++++++++++++++++++EXAMPLE 1+++++++++++++++++++++++++++++

One PT100s with One MAX31865 boards in Software  SPI on SKR PRO V1 2_V1 1 board _ Instructions and Wiring Diagram


14.++++++++++++++++++++++++++++++EXAMPLE 2+++++++++++++++++++++++++++++

Here are two wiring diagrams for a PT100 sensor with an Adafruit MAX31865 using Software SPI or Hardware SPI for SKR MINI E3 V2.0 board. The PINS in the YELLLOW boxes are what I call "available and free" I/O PINS that you, as a Marlin User, can controller (you can use these pins for MOSI, MISO, SCK, or CS when performing Software SPI; or you can use these pins for CS when performing Hardware SPI) :

One PT100 with One MAX31865 boards in Hardware or Software  SPI on SKR MINI E3 V2 0 board _ Instructions and Wiring Diagram

Here is the sharable link to the above two diagrams for the SKR MINI E3 V2.0 (from my google drive with Highest resolution): https://drive.google.com/file/d/1bxzppVMYMMVOKphN8VXloUyU29sKJNim/view?usp=sharing


14.++++++++++++++++++++++++++++++EXAMPLE 3+++++++++++++++++++++++++++++

Here are two wiring diagrams for a PT100 sensor with an Adafruit MAX31865 using Software SPI or Hardware SPI for SKR E3 TURBO board. The PINS in the YELLLOW boxes are what I call "available and free" I/O PINS that you, as a Marlin User, can controller (you can use these pins for MOSI, MISO, SCK, or CS when performing Software SPI; or you can use these pins for CS when performing Hardware SPI) :

One PT100 with One MAX31865 boards in Hardware or Software  SPI on SKR E3 TURBO board _ Instructions and Wiring Diagram

Here is the sharable link to the above two diagrams for the SKR E3 TURBO (from my google drive with Highest resolution): https://drive.google.com/file/d/14lYGDR4BFCD9Fpatdr7AAuQ9NlWYb1SU/view?usp=sharing


The information in [1, 11, 15-20] are for the MAX31855 board (thermocouples)


  1. If you want to use a K-Type Thermocouple temperature sensor with the MAX31855 board over SPI you have two options: A. Software SPI (where the MCU performs the handshake in software) B. Hardware SPI (where the MCU performs the handshake with hardware interrupts).

  1. If you want to use the Hardware SPI for MAX31855, then you have to know which SPI bus on the MCU board is the default hardware SPI bus (SPI Bus 1 or SPI Bus 2) due to the fact that there's ONLY ONE hardware SPI bus for each MCU board. See section 11 to find out how to determine the default hardware SPI bus for BTT SKR boards.

Hardware SPI for MAX31855 board (Thermocouple)

  1. If you want to use Hardware SPI for MAX31855 (for thermocouple) then you must know which SPI bus will be the default hardware SPI bus for the board. For the SKR PRO V1.1 the default hardware SPI bus is EXP2. For GTR V1.0 board the default hardware SPI bus is the onboard micro SD card reader. You have to find a way to access the default hardware SPI bus' MISO and SCK lines. To access these lines for the SKR PRO V1.1/V1.2 board use a clamp-on flat ribbon cable connector (https://www.digikey.com/product-detail/en/te-connectivity-amp-connectors/1658622-1/AKC10B-ND/825411).

To access the hardware SPI lines for the GTR V1.0 board use Bigtreetech's TF cloud device and hack the pins off the ESP12-S chip (https://www.amazon.com/BIGTREETECH-Direct-Wireless-Transmission-Motherboard/dp/B088WB5L8R). Now all you need is one free I/O pin to specify the Chip Select for the MAX31855.

+++++++++++++++++++++++++++++++++++++EXAMPLE++++++++++++++++++++++++++++++++++++

Below is a example of how to get Hardware SPI to work on SKR PRO V1.1/V1.2 for MAX31855 (thermocouple sensor), make the following changes in pins_BTT_SKR_PRO_common.h:

#define TEMP_0_PIN  PD0
#ifndef MAX6675_SS_PIN
    #define MAX6675_SS_PIN TEMP_0_PIN   
#endif

In configuration.h:

    set TEMP_SENSOR_0 to -3

  1. If you want to use Hardware SPI for MAX31855 (for thermocouple) AND you want to use TWO thermocouples, one attached to E0 and the other thermocouple attached to E1 (two MAX31855 amplifier boards), then the MAX31855 Clock Line and MAX31855 Data Output Line MUST be shared by both MAX31855 amplifier boards AND MUST be tied to the default hardware SPI bus for the MCU board.

In this example let us use the SKR PRO V1.1/V1.2 board as the MCU board. We want two MAX31855 boards to use hardware SPI for the two thermocouples. Here is how you would setup Marlin:

#define TEMP_0_PIN        PE2
#define TEMP_1_PIN        PE4
#ifndef MAX6675_SS_PIN
    #define MAX6675_SS_PIN      TEMP_0_PIN   
    #define MAX6675_SS2_PIN      TEMP_1_PIN
#endif

In configuration.h:

    set TEMP_SENSOR_0 to -3
        set TEMP_SENSOR_1 to -3

Here is a wiring diagram [number 18] for two MAX31855 boards in hardware SPI for the SKR PRO V1.1/V1.2 board:

Two K-Type Thermocouples with Two MAX31855 boards in Hardware  SPI on SKR PRO V1 2_V1 1 board _ Instructions and Wiring Diagram


To Prevent a noisy Thermocouple temperature sensor:

G_Thermocouple_Prevent_a_Noisy_Thermocouple_MAX31855 board

URL1: https://learn.adafruit.com/thermocouple/f-a-q#faq-2958381 URL2: https://3dprinting.stackexchange.com/questions/204/how-to-get-consistent-and-accurate-readings-from-thermocouples/355#355


Software SPI for MAX31855 board (Thermocouples)

  1. If you want to use Software SPI for MAX31855 (for ONE thermocouple) then do the following:

Below is a sample of how to get Software SPI to work on SKR PRO V1.1/V1.2 for MAX31855 (thermocouple sensor), make the following changes in pins_BTT_SKR_PRO_common.h:

#define TEMP_0_PIN  PD0
#ifndef MAX6675_SS_PIN
    #define MAX6675_SS_PIN TEMP_0_PIN
    #define MAX6675_DO_PIN PD5
    #define MAX6675_SCK_PIN PE0
#endif

In configuration.h: set TEMP_SENSOR_0 to -3


  1. If you want to use Software SPI for MAX31855 (for thermocouple) AND you want to use TWO thermocouples, one attached to E0 and the other thermocouple attached to E1(two MAX31855 amplifiers), then the MAX31855 Clock Line and MAX31855 Data Output Line MUST be shared by both MAX31855 amplifier boards.

For example, here is how you would setup using two thermocouples with the GTR V1.0 board:

#define TEMP_0_PIN   PH9    //CS for ONBOARD MAX31855 chip, See NOTE below
#define TEMP_1_PIN   PH13  //CS for external MAX31855 amplifier board
#ifndef MAX6675_SS_PIN
     #define MAX6675_SS_PIN            TEMP_0_PIN     //for first Thermocouple
     #define MAX6675_SS2_PIN           TEMP_1_PIN    //for second Thermocouple 
     #define MAX6675_SCK_PIN           PI1
     #define MAX6675_DO_PIN            PI2
#endif

In configuration.h: set TEMP_SENSOR_0 to -3 and set TEMP_SENSOR_1 to -3

NOTE: the first thermocouple is wired to the ONBOARD K_Type Thermocouple (KTEM) connector. That KTEM connector by default uses PH9 as its Chip select pin. The first thermocouple is not shown in the wiring diagram.

Here is a wire diagram for this situation:

2nd_TC_MAX31855_Software_SPI_Technique#1andMethod#1_Page_146


END OF GUIDE

daniagos commented 3 years ago

You were right, i didn't use the bugfix of marlin, honestly idk why, i feel so stupid..

Now the situation is pt100 works (both) sensorless homing works for both x and y, bltouch has strange issues: it randomly trigger itself in the air as if it touches something, then try the second touch and obviously it fails and printer got halted.

sometimes it need 2/3 seconds to trigger itself, sometimes 20 seconds if the bed is low enough.

The bltouch itself works good except for this, it pull down and up the pin with the command from pronterface, and i can see it switching from triggered to open circuit with m119 command.

For the bltouch uncommented: In configuration.h

define BLTOUCH

in configuration.adv.h

define BLTOUCH_DELAY 500.

in common.pins file i switched the z_min endstop to PA2, which is the pin near the servo one (mainly for a cleaner wiring than real necessity). in standard configuration.h

define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN

is enabled by default

What can i check?

daniagos commented 3 years ago

https://drive.google.com/file/d/1EPR14O2a6--NThF2DB0I4DMhMOFRZEi3/view?usp=sharing https://drive.google.com/file/d/1nhShG67IcBj4n0OiuGTBb4F5jTqs9pDf/view?usp=sharing

This is how it acts

daniagos commented 3 years ago

Ok, for the bltouch there were noises in the printer, i solved with a capacitor between white and black wires, now finally all works fine, thanks @GadgetAngel, you really saved my building!