Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SKR Pro + TMC5160 + PT100 using MAX31865+ BTT TFT35 v2 = no attached printer #163

Open
code505 opened this issue Aug 24, 2020 · 92 comments
Open

Comments

@code505
Copy link

code505 commented Aug 24, 2020

I'm having issue working this configuration
#define SERIAL_PORT -1 #define SERIAL_PORT_2 1

I'm using this guide to connect MAX31865 in software SPI configuration:
https://drive.google.com/file/d/1zOky07F_R_DO_-XxZx6C3xULqhuxYMOi/view?usp=sharing

once I change TEMP_SENSOR_0 to -5, I got the no attached printer, otherwise TFT is working

any thoughts

@oldman4U
Copy link

Please send pictures showing the connection between tft and mainboard. Check the baudrate setting of mainboard and tft.

@code505
Copy link
Author

code505 commented Aug 25, 2020

that is the picture, the reset wire is the last on the left,

IMG_8996

the baudrate is 115200 on both the board and the TFT

what I want to emphasise on, is that when I put,
TEMP_SENSOR_0 1 >>>> TFT is working with no issue
if
TEMP_SENSOR_0 -5 >>>> TFT show no printer attached

@oldman4U
Copy link

oldman4U commented Aug 25, 2020 via email

@oldman4U
Copy link

Saw you opened the ticket, great. Reading your answer again i am not sure if this is SKR or TFT any more, but there are more users watching, so it is always a good idea to start a ticket there. Hope someone can help.

May i ask you why you are using this temp sensor and not a common one?

@code505
Copy link
Author

code505 commented Aug 25, 2020

thank you so much for your cooperation, I installed V6 hotend and I thought it is a good idea to upgrade to pt100 for more consistant heat management and for carbon fiber printing, I really doupt that it's a TFT issue, because the screen work very well with TEMP_SENSOR_0 set to 1

@oldman4U
Copy link

oldman4U commented Aug 26, 2020 via email

@oldman4U
Copy link

oldman4U commented Aug 26, 2020 via email

@AnHardt
Copy link

AnHardt commented Aug 26, 2020

Back to the problem.

When there is any configuration for the serials where communication is possible - keep that.
When the communication fails when TEMP_SENSOR_0 -5 but not with TEMP_SENSOR_0 1 something with the MAX31865-system is wrong. The protection systems detect a MIN_TEMP_ERROR, a MAX_TEMP_ERROR or maybe a communication error and sends Marlin into KILL_STATE - stopping all communication.

Checklist:
Is the resistance of the PT100 at about 100 - 200 Ohm at room temperature? Does it rise when warmed?
How many wires has the PT100/1000 sensor?
Is the MAX31865-module prepared for that number of wires?
If the sensor has 3 wires use only two different colour ones and prepare the module according to that. Marlin does not support 3_WIRE_MODE!
Is the sensor connected to the module?
To witch of the boars SPI-busses is the module connected to?
Is Marlin configured to use the same buss/pins? Likely you have to look into the pins-file.
Are the buss-wires not to long, not broken, connected to the right pins? Don't cross MISO and MOSI like you'd do with serials RX and TX.
Check the last tree points also for SS. Don't reuse the T0 to T3 inputs for SS. The low pass filters on them may delay the signal too much.

Finally correct the 400 to a 430 in temperature.cpp at about line 1378 (there is only one occurrence)

            #if ENABLED(MAX6675_IS_MAX31865)
              max31865.temperature(100, 400)  // 100 ohms = PT100 resistance. 400 ohms = calibration resistor
            #else

If all that does not help try to check the hardware with different software like https://github.com/adafruit/Adafruit_MAX31865/blob/master/examples/max31865/max31865.ino

Don't tell us what guide you tried to follow. Tell/show us what you did. Those able to help you, already know how to do it and will not read/check a several page long, over redundant, guide being written for idiots.

@AnHardt
Copy link

AnHardt commented Aug 27, 2020

As far i can see the hardware SPI variants in the above guide can't work.
The software uses the 'default SPI bus' (SPI = SPI1) where the onboard SD-Card is connected to. The Adafruit library in the currently by Marlin used version is not able to use an other one. The current version of the library can be connected to any SPI buss but uses Adafruit BussIO what is currently not supported by Marlin.
The wires shall be connected to the TMC-SPI bus (SPI3).
That compiles but can't work.

Up to now i couldn't find a deal beaker for the Software SPI variantes. (Even if i did not try it physically.)

Edit: Sorry. Even the newest Adafruit_MAX31865 library (1.2.2) is not able to use an other than the default SPI hardware. They missed to expand the constructor.

@GadgetAngel
Copy link

As far i can see the hardware SPI variants in the above guide can't work.
The software uses the 'default SPI bus' (SPI = SPI1) where the onboard SD-Card is connected to. The Adafruit library in the currently by Marlin used version is not able to use an other one. The current version of the library can be connected to any SPI buss but uses Adafruit BussIO what is currently not supported by Marlin.
The wires shall be connected to the TMC-SPI bus (SPI3).
That compiles but can't work.

Up to now i couldn't find a deal beaker for the Software SPI variantes. (Even if i did not try it physically.)

Edit: Sorry. Even the newest Adafruit_MAX31865 library (1.2.2) is not able to use an other than the default SPI hardware. They missed to expand the constructor.

Please educate me, so I can correct the guide. (To restate what you have written and to ensure I understand): You state that Marlin 2.0.6 can not work on SPI3. Marlin 2.0.6 will only use SPI1 for hardware SPI for ANY MCU. Is this correct?

As far as I am aware, the Hardware SPI is a master slave communication protocol. The SKR PRO V1.1 has three SPI buses on the MCU. SPI1 is the SD card reader; SPI2 is EXP2 and SPI3 is the Stepper Motor Driver Sockets.

Are you also saying that Marlin 2.0.6, does not allow the user to use Hardware SPI because at this time Marlin does not support Adafruit BUSIO? So the ONLY WAY to even use Adafruit’s MAX31865 is by using Software SPI?

@AnHardt
Copy link

AnHardt commented Aug 28, 2020

The BTT SKR PROs have 3 SPI-buses. Marlin, in general, is able to use all of them.
It's Adafruit_MAX31865 library what does not allow to select an other than the default SPI-buss (here SPI = SPI1).
Hardware SPI for the MAX31865 is currently only possible if connected to the onboard-SD-SPI-buss - what results in a mess because there are no connectors.

Even in the newest version of the MAX31865 lib we have no way to specify the "buss".

  Adafruit_MAX31865(int8_t spi_cs, int8_t spi_mosi, int8_t spi_miso, int8_t spi_clk);
  Adafruit_MAX31865(int8_t spi_cs);

While the underling BussIO now can handle it:

  Adafruit_SPIDevice(int8_t cspin, uint32_t freq = 1000000,
                     BitOrder dataOrder = SPI_BITORDER_MSBFIRST,
                     uint8_t dataMode = SPI_MODE0, SPIClass *theSPI = &SPI);

  Adafruit_SPIDevice(int8_t cspin, int8_t sck, int8_t miso, int8_t mosi,
                     uint32_t freq = 1000000,
                     BitOrder dataOrder = SPI_BITORDER_MSBFIRST,
                     uint8_t dataMode = SPI_MODE0);
  • last parameter of the first constructor.

In general alone from the SS-pin it's impossible to detect the right buss.


Edit:
Sorry at the BTT SKR PRO SPI is SPI2 - the SD-card slot on the display-board. #163 (comment). For almost all other boars SPI is SPI1.

@GadgetAngel
Copy link

The BTT SKR PROs have 3 SPI-buses. Marlin, in general, is able to use all of them.
It's Adafruit_MAX31865 library what does not allow to select an other than the default SPI-buss (here SPI = SPI1).
Hardware SPI for the MAX31865 is currently only possible if connected to the onboard-SD-SPI-buss - what results in a mess because there are no connectors.

Even in the newest version of the MAX31865 lib we have no way to specify the "buss".

  Adafruit_MAX31865(int8_t spi_cs, int8_t spi_mosi, int8_t spi_miso, int8_t spi_clk);
  Adafruit_MAX31865(int8_t spi_cs);

While the underling BussIO now can handle it:

  Adafruit_SPIDevice(int8_t cspin, uint32_t freq = 1000000,
                     BitOrder dataOrder = SPI_BITORDER_MSBFIRST,
                     uint8_t dataMode = SPI_MODE0, SPIClass *theSPI = &SPI);

  Adafruit_SPIDevice(int8_t cspin, int8_t sck, int8_t miso, int8_t mosi,
                     uint32_t freq = 1000000,
                     BitOrder dataOrder = SPI_BITORDER_MSBFIRST,
                     uint8_t dataMode = SPI_MODE0);
  • last parameter of the first constructor.

In general alone from the SS-pin it's impossible to detect the right buss.

Is it not possible to write a software wrapper that exposes the pointer to the SPI BUS from the underlying BUSIO Function call? Is that not what a Constructor does in C++? Marlin is written in which programming language?

Which MAX31865 amplifier board on the market today can a user of Marlin use to access the correct SPI bus? Is there even one available?

@GadgetAngel
Copy link

I'm having issue working this configuration
#define SERIAL_PORT -1 #define SERIAL_PORT_2 1

I'm using this guide to connect MAX31865 in software SPI configuration:
https://drive.google.com/file/d/1zOky07F_R_DO_-XxZx6C3xULqhuxYMOi/view?usp=sharing

once I change TEMP_SENSOR_0 to -5, I got the no attached printer, otherwise TFT is working

any thoughts

Please place your Marlin folder (Zip the folder up) onto google drive and supply us with the shared link to that File.

It makes no sense that Software SPI is not working for you.

I will update the Guide to reflect the information about the current state of the Adafruit MAX31865 library

@code505
Copy link
Author

code505 commented Aug 28, 2020

Here is the compressed folder, I really appreciate your cooperation guys.

https://drive.google.com/file/d/1K1XbNh0lFrJSDPzNua3jOYGHsJ_Dz9JK/view?usp=sharing

@GadgetAngel
Copy link

@code505 I downloaded the latest Marlin version 2.0.6.1 and made the changes that I have on my printer. Do you have a filament runout sensor attached on your printer? Are you using the filament runout port on the TFT screen?

If you have a filament runout sensor attached please comment out the Marlin sections related to that equipment. Leave them commented out until we get the MAX31865 in Software SPI mode to work.

Are you running V2.0.26 firmware on your BTT TFT35 V2.0 screen?

Here are the differences (that I think are relevant) I found between my setup and yours:

Differences in Platformio.ini file (your file is on the LEFT, my setup is on the RIGHT)--- I think this is where your problem is:

Marlin Differences to my setup_Platformio ini file

*** In my opinion: In Platformio.ini file: Change your default_evns to be BIGTREE_SKR_PRO and change include_dir to be Marlin

Difference in Configuration.h file (you have two screens enabled in Marlin):

You have Your Stock CR10 Displayed enabled yet the above picture shows no connections to EXP1 or EXP2 connectors:

Marlin Differences to my setup_CR10_STOCKDISPLAY_setting

You have the REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER enabled in Marlin along with your CR10 stock display:

Marlin Differences to my setup_also using REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER for display

*** In my opinion: In Configuration.h file, you need to just disable both the REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and the CR10_STOCKDISPLAY AND ensure the Marlin line #define SDSUPPORT is uncommented.

Here is a video to watch to connect the BTT TFT35 V2.0 to the SKR PRO V1.1 board: https://youtu.be/9i3Ee6UtC-Q

In the above video He does not mention enabling any LCD screen in the Marlin firmware download. All he enables in Marlin Firmware are the following: Stepper Drivers used and enable are A4988 drivers; SERIAL_PORT is -1; SERIAL_PORT_2 is 1;. MOTHERBOARD is BOARD_BTT_SKR_PRO_V1_1 ; In Platformio.ini file: default_envs = BIGTREE_SKR_PRO. He sets his baudrate on the TFT35 V2.0 screen to 250000

@GadgetAngel
Copy link

@AnHardt Could I use this device and hack into the SPI Lines for the SKR PRO V1.1 and GTR V1.0 boards? Maybe that would work?

https://www.amazon.com/gp/product/B088WB5L8R/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1

TF Cloud device on Amazon com

@AnHardt
Copy link

AnHardt commented Aug 29, 2020

Yes - one could.
But it also has no pins to connect the SPI-bus to. So it's has no advantage over soldering wires/pins directly to the mainboard at the SD-Card-slot or the processor. (Maybe the pins at the ESP are a bit larger? Ahhh - and if ruined this is a bit cheaper.)

Something like this would be even cheaper.
image

@GadgetAngel
Copy link

@AnHardt, Thanks for setting me straight on the Adafruit library issue! I am now fixing the guide so that I will not be giving out bad information. Just to be clear on another point, the reason my guides provide redundant information is to make it perfectly clear to the user that they have options.

Some people cannot extrapolate one solution into another solution.

My goal is to open up this hobby of 3D printing to more users. The more people that get involved with 3D printing the better the firmware will get and the MCU boards will get upgraded.

I do not intend for my manuals and guides to be idiot proof. But I do want to make it easier for people to hook up the devices. If they have a sort of cook book to follow, they are given a starting point and then learn from there. Sometimes that is all that is needed to get people to try out a new item.

I never intended my guides and manuals to be insulting. In fact, if anyone ever finds wrong information in my guide or manuals PLEASE let me know. I need to learn and then I can fix the guide. Just like you did with the PT100 Guide. I really appreciate the input you gave. Thanks again.

@code505
Copy link
Author

code505 commented Aug 29, 2020

@GadgetAngel
Hi,
I also downloaded Marlin 2.0.6.1, and edited all the configuration including Platformio.ini file,
I have filament run out sensor and I commented out it's setting
installed V2.0.26 firmware on TFT35
I had the cr10s display and I thought I would give it a try without the TFT, but that also didn't work, that why I set the setting for the original cr10s display, but I revert every thing back now
but until now, no luck
one thing to mention, when I set #define SERIAL_PORT 1 and #define SERIAL_PORT_2 -1

the TFT give these messages:
IMG_9018
IMG_9019

@code505
Copy link
Author

code505 commented Aug 30, 2020

I have PT100 amplifier board (INA826 amp) , and I will connect it using table 21

to which pin should I use for 3.3v supply, ground and signal.

thank you

@GadgetAngel
Copy link

GadgetAngel commented Aug 31, 2020

@code505 The easiest way is to use any of the ADC lines on extension-1 header, get 3.3VDC and GND from power expansion header.

Extension-1 header:
IO Extension -1 header for SKR PRO V1 1

Color PIN diagram of SKR PRO V1.1 Board:
SKR_PRO_V1 1_Colored_PIN_Diagram_300ppi

@code505
Copy link
Author

code505 commented Aug 31, 2020

can I use 3.3v and GND from E1 endstop socket?, I have only one extruder

@AnHardt
Copy link

AnHardt commented Aug 31, 2020

On this board VREF+ is not different from VCC_3.3V and VDDA is not accessible - so yes for the 3.3V.
On this board we have more or less separate systems for GND and GNDA - so piking GNDA from a unused T input could make more sense to avoid some noise (but for functionality that should not make a difference - in the end they are connected via 0 Ohm R31).

image
image

SKR PRO V1.2 has the same analoge circuits.
GTR V1.0 got a better filtered VREF+ with a inductivity (also not accessible) and a maybe a tiny bit worse VDDA (but i can't really read that sketch)
image

The BTT002 has a nicely filtered coupled VREF+ and VDDA
image
but not accessible. The T inputs have normal GND and not a separate GNDA.

On all 3 boards the 4K7 pullup resistors go to the normal 3.3V supply, not to one of the likely better analoge voltages.

Up to now i could not find any board from any manufacturer with really,for our purposes, ideal analog circuits for the ADCs. To expensive!
Surprising to me is only the spread in variations from one manufacturer. Likely the boards have completely different designers.

@GadgetAngel
Copy link

can I use 3.3v and GND from E1 endstop socket?, I have only one extruder

yes

@GadgetAngel
Copy link

@AnHardt You wrote this:

Finally correct the 400 to a 430 in temperature.cpp at about line 1378 (there is only one occurrence)

        #if ENABLED(MAX6675_IS_MAX31865)
          max31865.temperature(100, 400)  // 100 ohms = PT100 resistance. 400 ohms = calibration resistor
        #else

400 Ohm is the calibration resistor. So for the Adafruit MAX31865 for PT100 you must change the calibration resistor to 430 in temperature.cpp. If you bought Adafruit MAX31865 for PT1000 you must use max31865.temperature(1000, 4300) in temperature.cpp. Is this correct?

@AnHardt
Copy link

AnHardt commented Sep 6, 2020

Yes!

Do you really have to be that loud - always? (big fonts) My eyes are bleeding. :-)

At least for now. One days this will be properly configurable from the configs.

@GadgetAngel
Copy link

Yes - one could.
But it also has no pins to connect the SPI-bus to. So it's has no advantage over soldering wires/pins directly to the mainboard at the SD-Card-slot or the processor. (Maybe the pins at the ESP are a bit larger? Ahhh - and if ruined this is a bit cheaper.)

Something like this would be even cheaper.
image

@AnHardt Can you find any document showing the 15P cable and which PINS correspond to MOSI, MISO, SCK ? I have looked and I can not find any document showing which PINS on the extension cable correspond to the SPI lines

@AnHardt
Copy link

AnHardt commented Sep 9, 2020

One side of the cable is a sd-card with some wires.
The other a sd-card-socket with some wires.
To make that work the wiring has to be straight, one by one, no crossings.
The cable can also be used to extend SDIO connected sockets - not only SPI.

https://www.google.com/search?sxsrf=ALeKk02d7DxB8_5DES9ppG2VqZWjRveTVw:1599686685325&source=univ&tbm=isch&q=sd+card+spi+interface&sa=X&ved=2ahUKEwjmwoWlgd3rAhXGlqQKHQs-AGAQsAR6BAgMEAE&biw=1280&bih=577

Soldering to the flat-cable is difficult. Better crack the housing of the sd-socket and solder to the contacts.

@GadgetAngel
Copy link

GadgetAngel commented Sep 11, 2020

One side of the cable is a sd-card with some wires.
The other a sd-card-socket with some wires.
To make that work the wiring has to be straight, one by one, no crossings.
The cable can also be used to extend SDIO connected sockets - not only SPI.

https://www.google.com/search?sxsrf=ALeKk02d7DxB8_5DES9ppG2VqZWjRveTVw:1599686685325&source=univ&tbm=isch&q=sd+card+spi+interface&sa=X&ved=2ahUKEwjmwoWlgd3rAhXGlqQKHQs-AGAQsAR6BAgMEAE&biw=1280&bih=577

Soldering to the flat-cable is difficult. Better crack the housing of the sd-socket and solder to the contacts.

This issue is the SD card socket has 15 pins on the back when I crack it open. The sd card on the other end has 8 pins. I agree they should be straight connect but why have 15 pins to 8? If every other pin was Ground then I would expect 16 pins to 8. I looked up the part number on the SD card socket: AoSheng100921TF . It is a patented product from China. I can not find how they go from 15 pins to 8 pins. Do you have any idea what they did?

EDIT: I will use an ohm meter and document which 8 lines correspond to the SD card lines

@GadgetAngel
Copy link

@GadgetAngel

Very good & exhaustive job!
In our fablab, we've a CR10S4 using SKR PRO & a PT100 with a MAX31865 extension board. At the moment, I use a specific table with an ADC amplifier @3,3V. Not really optimized!
I tried to connect it as a software SPI with your configuration but my tft is always disconnected.
Just to my mind, when you force using software SPI, do you add the #define MAX6675_IS_MAX31865 in your configuration.h?

You will find attached my conf.

pt100_max31865_Software-SPI.zip

thks,

No, I do not #define MAX6675_IS_MAX31865 because Marlin 2.0.x will do that when you set TEMP_SENSOR_0 and/or TEMP_SENSOR_1 to -5 in Configuration.h.

Marlin does the assignment of MAX6675_IS_MAX31865 in conditionals_post.h file :

MAX6675_IS_MAX31865 is set in conditionals_post h file

Which TFT screen are you using?

Is the TFT screen firmware up to date?

Can you upload your WHOLE Marlin firmware folder? Just zip your whole Marlin folder (include the platformio.ini file) to your free google drive. Then enable sharing of the folder on your google drive. Then place the shared link to your google drive here on this github thread so I can download your zipped Marlin folder.

I need to see your Marlin folder so I can walk through the code to see what is happening to the TFT screen.

@ymarco73
Copy link

ymarco73 commented Oct 2, 2020

@GadgetAngel

Understood for the variable.
Else, I use the BTT TFT35 screen. I upload both my Marlin & the TFT firmware I deployed.

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

https://drive.google.com/file/d/1wUijbP1WXV-yZZEDUGuLvSy7rN8-CnKk/view?usp=sharing

@GadgetAngel
Copy link

https://drive.google.com/file/d/1wUijbP1WXV-yZZEDUGuLvSy7rN8-CnKk/view?usp=sharing

Which version of the TFT35 do you use?

@ymarco73
Copy link

ymarco73 commented Oct 2, 2020

@GadgetAngel

I use the TFT35 V3

@ymarco73
Copy link

ymarco73 commented Oct 2, 2020

@GadgetAngel

I use the TFT35 V3

For your information, I use the TFT port on my SKR PRO V1-1

@ymarco73
Copy link

ymarco73 commented Oct 2, 2020

@GadgetAngel

I just tried to connect my printer with Repetier Host on my computer, using an USB cable. I'm not able to reach the printer even if the port is detected by Repetier. Strange...

@GadgetAngel
Copy link

GadgetAngel commented Oct 2, 2020

@GadgetAngel

I just tried to connect my printer with Repetier Host on my computer, using an USB cable. I'm not able to reach the printer even if the port is detected by Repetier. Strange...

ensure you comment out your #define MAX6675_IS_MAX31865 in configuration.h under the #define TEMP_SENSOR_0 -5. Let Marlin assign MAX6675_IS_MAX31865.

Try changing the

#define SERIAL_PORT -1 to #define SERIAL_PORT 1
and 
#define SERIAL_PORT_2 1 to #define SERIAL_PORT_2 -1

Edit:
Also try using the latest Marlin 2.0.7. You are at 2.0.5

@ymarco73
Copy link

ymarco73 commented Oct 2, 2020

@GadgetAngel

Ok I'm going to do it...

@GadgetAngel
Copy link

@ymarco73 The change in Marlin from 2.0.5, which is the version you are running and the newest Marlin 2.0.7 might solve the problem

@ymarco73
Copy link

ymarco73 commented Oct 2, 2020

I used
#define SERIAL_PORT -1 to #define SERIAL_PORT 1
and
#define SERIAL_PORT_2 1 to #define SERIAL_PORT_2 -1
and now I receive a printer halted kill.
Looks like a little bit better... but I need to investigate further

@ymarco73
Copy link

ymarco73 commented Oct 2, 2020

To be sure,

I connected:

CS pin from my MAX31865 to the PD0 of the SKR
CLK pin **************** to PE0 ***
SDO pin *************** to PD5
SDI pin *************** to PD2

@ymarco73
Copy link

ymarco73 commented Oct 2, 2020

@GadgetAngel

Here is my updated Marlin with the latest revision:
https://drive.google.com/file/d/1_0XJ2qHSDxxgBRcbiJXC1WrgqwYh9DDx/view?usp=sharing

So, to recap, if I use SERIAL_PORT 1 and SERIAL_PORT_2 -1, the TFT returns a "kill called" with a "no printer attached".
With SERIAL_PORT 1 and SERIAL_PORT_2 -1, neither "kill called", nor printer attached.
For both, unable to communicate with Repetier.

@GadgetAngel
Copy link

GadgetAngel commented Oct 3, 2020

@ymarco73 In configuration_adv.h set THERMOCOUPLE_MAX_ERRORS to 20. When you see the "printer halted kill" message, "no printer attached" you would get that from any display that is attached to the printer because for some reason the printer is getting a MIN/MAX temp error or noise is getting into the temperature measurement.

Setting THERMOCOUPLE_MAX_ERRORS does get used when reading PT100 temperature sensor from the MAX31865. You can also set MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED to 10 in Configuration_adv.h file. They both deal with errors coming from the temperature sensor device.

Another idea, in configuration_adv.h uncomment SHOW_TEMP_ADC_VALUE. Also, In configuraton_adv.h uncomment M115_GEOMETRY_REPORT. Use Pronterface software with the M155 gcode or M105 to examine the ADC values the MAX31865 board is sending the the SKR PRO V1.1 board:

// Show Temperature ADC value
// Enable for M105 to include ADC values read from temperature sensors.
#define SHOW_TEMP_ADC_VALUES
#define M115_GEOMETRY_REPORT

If you never have used Pronterface software just search YouTube and you should find a video on how to go about using this tool with your 3D printer. You might also want to read about the M105 and M155 gcode commands.


You said your TFT port was where your 3D printer screen was located.

For the SKR PRO V1.1 the following SERIAL PORTs are available: -1 is USB Port; 1 is TFT port; 6 is the WIFI port and 3 is the TX3/RX3 on UART header.

Any of these values are valid for SERIAL_PORT and SERIAL_PORT_2. The differences between SERIAL_PORT and SERIAL_PORT_2 is that SERIAL_PORT is the main connections that receives ALL errors coming from the 3D Printer. The SERIAL_PORT_2 does not receive ALL errors. That is why I told you to swap the settings. I needed to see if the printer was sending out an error message. So leave SERIAL_PORT set for 1 and SERIAL_PORT_2 set for -1. This way you see ALL errors on your TFT screen.

Try commenting out REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER in configuration.h file and ensure you have not enabled any other LCD in Marlin Firmware. The BTT TFT screen only uses the REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER if you switch the TFT to legacy mode. So as long as you are aware of it, let's disable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER to see if it is affecting your firmware.


Did you prepare the MAX31865 board?

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). Therefore, ensure your PT100 is hooked to the middle two terminals.

Preparing the MAX31865 board


To help troubleshoot:

Please provide a jpg image of the error message or messages that are displayed on your TFT screen. I can then search Marlin for that error message or messages so we can figure out which part of the firmware called the halt printer routine. Was there a heater id provided on the screen when the halt command was issued?

Did you intend to have your TMC2208 commented out in your firmware code? The way your firmware is configured you are running A4988 on all axes.

@ymarco73
Copy link

ymarco73 commented Oct 3, 2020

Hi @GadgetAngel

Thks for the advises. My machine isn't at home, I'll have a look at it tomorrow morning.
I downloaded the 2.0.7 Marlin revision. I use TMC2208 on all axis, with UART only on the X,Y & Z. The extruder is in standalone mode (TMC2208_STANDALONE).
My MAX31865 is configured as shown on your picture. I use a 2 wire PT100.
As you mentioned, I'll comment out the REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER. I'll check if it is the only declared lcd.
I'm not able to take a picture of my screen but the error message is "printer halted. kill() called", if use serial_port 1 and serial_port2 -1.

@GadgetAngel
Copy link

Hi @GadgetAngel

Thks for the advises. My machine isn't at home, I'll have a look at it tomorrow morning.
I downloaded the 2.0.7 Marlin revision. I use TMC2208 on all axis, with UART only on the X,Y & Z. The extruder is in standalone mode (TMC2208_STANDALONE).
My MAX31865 is configured as shown on your picture. I use a 2 wire PT100.
As you mentioned, I'll comment out the REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER. I'll check if it is the only declared lcd.
I'm not able to take a picture of my screen but the error message is "printer halted. kill() called", if use serial_port 1 and serial_port2 -1.

@ymarco73 I did look at the Marlin folder you uploaded. Did you know that your stepper motor drivers are COMMENTED OUT. You forgot to remove the // at the beginning of the lines.

This is from your firmware code you uploaded the second time to your google drive:

Your TMC2208 drivers are commented out

@ymarco73
Copy link

ymarco73 commented Oct 3, 2020

@GadgetAngel

Yes, I saw it this afternoon. This was not the case in my 2.0.5.
After a long week, my brain has burned! ;)

@GadgetAngel
Copy link

GadgetAngel commented Oct 3, 2020

I'm not able to take a picture of my screen but the error message is "printer halted. kill() called", if use serial_port 1 and serial_port2 -1.

@ymarco73 I just looked at the Marlin 2.0.7 code: If you did not get a heater ID with the "printer halted. kill() called" then the printer halted for another reason.

Maybe, it was not the MAX31865 that caused the halt message. If the halt message was due to temperature reading from temperature.cpp code, the error message would indicated a heater ID.

@ymarco73
Copy link

ymarco73 commented Oct 3, 2020

I'm not able to take a picture of my screen but the error message is "printer halted. kill() called", if use serial_port 1 and serial_port2 -1.

@ymarco73 I just looked at the Marlin 2.0.7 code: If you did not get a heater ID with the "printer halted. kill() called" then the printer halted for another reason.

Maybe, it was not the MAX31865 that caused the halt message. If the halt message was due to temperature reading from temperature.cpp code, the error message would indicated a heater ID.

ok clear. let's see tomorrow if it will read a temp.

@ymarco73
Copy link

ymarco73 commented Oct 4, 2020

@GadgetAngel
Hi,

Before swaping to the MAX31865, I tried to use SERIAL_PORT 1 and SERIAL_PORT_2 -1 but unfortunately, it doesn't work. No printer attached.
After going back to SERIAL_PORT -1 and SERIAL_PORT_2 1, here what I get in Pronterface:

M115
SENDING:M115
FIRMWARE_NAME:Marlin 2.0.5.4 (GitHub) SOURCE_CODE_URL:https://github.com/MarlinFirmware/Marlin PROTOCOL_VERSION:1.0 MACHINE_TYPE:3D Printer EXTRUDER_COUNT:1 UUID:cede2a2f-41a2-4748-9b12-c55c62f367ff
Cap:SERIAL_XON_XOFF:0
Cap:BINARY_FILE_TRANSFER:0
Cap:EEPROM:1
Cap:VOLUMETRIC:1
Cap:AUTOREPORT_TEMP:1
Cap:PROGRESS:0
Cap:PRINT_JOB:1
Cap:AUTOLEVEL:1
Cap:Z_PROBE:1
Cap:LEVELING_DATA:1
Cap:BUILD_PERCENT:0
Cap:SOFTWARE_POWER:0
Cap:TOGGLE_LIGHTS:0
Cap:CASE_LIGHT_BRIGHTNESS:0
Cap:EMERGENCY_PARSER:0
Cap:PROMPT_SUPPORT:0
Cap:AUTOREPORT_SD_STATUS:0
Cap:THERMAL_PROTECTION:1
Cap:MOTION_MODES:0
Cap:CHAMBER_TEMPERATURE:0

@ymarco73
Copy link

ymarco73 commented Oct 4, 2020

@GadgetAngel

I compiled this morning Marlin 2.0.7 with:

#define SERIAL_PORT -1
#define SERIAL_PORT_2 1
#define TEMP_0_PIN PD0
#ifndef MAX31865_CS_PIN
#define MAX31865_CS_PIN PF9 //ensure you are not using this PIN, this pin is on EXTENSION-1 header
//set MAX31865_CS_PIN so it CAN NOT be equal to MAX6675_SS_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
//MAX31865_CS_PIN to some unused PIN (the example here uses PG13 as a PIN not being used)
#define MAX6675_SS_PIN TEMP_0_PIN
#define MAX31865_MOSI_PIN PD2
#define MAX6675_DO_PIN PD5
#define MAX6675_SCK_PIN PE0
#endif

PF9 is a pin on extension 1 that I do not use.

On my TFT, no printer attached and no way to connect Pronterface throughout the USB.
The only conclusion today is that I must use SERIAL_PORT_2 1 to connect my TFT. That's all. Unable to connect the MAX31865.
Here are my latest sources: https://drive.google.com/file/d/1I-A7MgqrHtYwXW7Z10t31ytlBlLQ_ho6/view?usp=sharing

@GadgetAngel
Copy link

@ymarco73 Do you own a real REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER, instead of the TFT35 V3?

The message "no printer attached" is coming from the BTT TFT35 V3.0 firmware. I would like to remove that screen to take it out of the setup to see if we can get the MAX31865 board working. Once we get the MAX31865 board working then we can try to figure out why the TFT screen is not working. I am not an expert of the TFT display. All I can find on that error message to reinstall you firmware on the BTT TFT35 V3.0 screen (ensure you get the latest firmware version)

OR

You can buy a REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER here: https://www.amazon.com/KINGPRINT-Graphic-Display-Controller-Adapter/dp/B076WQQX5K

@GadgetAngel
Copy link

GadgetAngel commented Oct 5, 2020

@GadgetAngel

I compiled this morning Marlin 2.0.7 with:

#define SERIAL_PORT -1
#define SERIAL_PORT_2 1
#define TEMP_0_PIN PD0
#ifndef MAX31865_CS_PIN
#define MAX31865_CS_PIN PF9 //ensure you are not using this PIN, this pin is on EXTENSION-1 header
//set MAX31865_CS_PIN so it CAN NOT be equal to MAX6675_SS_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
//MAX31865_CS_PIN to some unused PIN (the example here uses PG13 as a PIN not being used)
#define MAX6675_SS_PIN TEMP_0_PIN
#define MAX31865_MOSI_PIN PD2
#define MAX6675_DO_PIN PD5
#define MAX6675_SCK_PIN PE0
#endif

PF9 is a pin on extension 1 that I do not use.

On my TFT, no printer attached and no way to connect Pronterface throughout the USB.
The only conclusion today is that I must use SERIAL_PORT_2 1 to connect my TFT. That's all. Unable to connect the MAX31865.
Here are my latest sources: https://drive.google.com/file/d/1I-A7MgqrHtYwXW7Z10t31ytlBlLQ_ho6/view?usp=sharing

@ymarco73, I believe your "no printer attached" message from the TFT is due to the fact that you are getting a "halt, kill() called" message that you do not see.

When you power up the printer with the new Marlin 2.0.7 firmware do you have the MAX31865 board wired into the SKR PRO V1.1 board?

Try changing the firmware back to #define TEMP_SENSOR_0 1, just to see if the "no printer attached" message goes away.

If the "no printer attached" goes away then we can basically say that when you see that message on the TFT screen it means that you're really getting a "halt, kill() called" message.


Can thermal runaway protection be causing the "halt, kill() called" message?

When Marlin firmware detects over temp it goes into shutdown and goes offline without any warning.
I think you can disable this by commenting out the "#define THERMAL_PROTECTION_HOTENDS" in configuration.h.
This should allow you to troubleshoot your hot end temp sensor but don't forget to restore this after you have resolved the issue.

The following was originally posted by @AnHardt in #163 (comment)

When there is any configuration for the serials where communication is possible - keep that.
When the communication fails when TEMP_SENSOR_0 -5 but not with TEMP_SENSOR_0 1 something with the MAX31865-system is wrong. The protection systems detect a MIN_TEMP_ERROR, a MAX_TEMP_ERROR or maybe a communication error and sends Marlin into KILL_STATE - stopping all communication.

Checklist:
Is the resistance of the PT100 at about 100 - 200 Ohm at room temperature? Does it rise when warmed?
How many wires has the PT100/1000 sensor?
Is the MAX31865-module prepared for that number of wires?
If the sensor has 3 wires use only two different color ones and prepare the module according to that. Marlin does not support 3_WIRE_MODE!
Is the sensor connected to the module?
To which of the SKR PRO V1.1 board's SPI-buses is the module connected to?
Is Marlin configured to use the same bus/pins? Likely you have to look into the pins-file.
Are the bus-wires not to long, not broken, connected to the right pins? Don't cross MISO and MOSI like you'd do with serials RX and TX.
Check the last three points also for SS. Don't reuse the T0 to T3 inputs for SS. The low pass filters on them may delay the signal too much.

Finally correct the 400 to a 430 in temperature.cpp at about line 1378 (there is only one occurrence)

            #if ENABLED(MAX6675_IS_MAX31865)
              max31865.temperature(100, 400)  // 100 ohms = PT100 resistance. 400 ohms = calibration resistor
            #else

If all that does not help try to check the hardware with different software like https://github.com/adafruit/Adafruit_MAX31865/blob/master/examples/max31865/max31865.ino


In the firmware code you sent me on your google drive you had NOT made the below changes in Marlin 2.0.7:

In the Marlin 2.0.7 firmware, if you want to use the Adafruit MAX31865 board with a PT100, 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(100, 430) // 100 ohms = PT100 resistance. 400 ohms = calibration resistor


EDIT:

After I wrote all the above I went back to look at the Marlin 2.0.7 code in temperature.cpp:

MAX31865 Software SPI in temperature cpp for Marlin 2 0 7 firmware

Notice this code:

Adafruit_MAX31865 max31865 = Adafruit_MAX31865(MAX31865_CS_PIN
    #if MAX31865_CS_PIN != MAX6675_SS_PIN
      , MAX31865_MOSI_PIN           // For software SPI also set MOSI/MISO/SCK
      , MAX31865_MISO_PIN
      , MAX31865_SCK_PIN
    #endif
  );
  //Adafruit_MAX31865 max31865 = Adafruit_MAX31865(MAX31865_CS_PIN, MAX31865_MOSI_PIN, MAX31865_MISO_PIN, MAX31865_SCK_PIN);

The above code is the only way to get the MAX31865 in Software SPI mode. Therefore with your setup MAX31865_CS_PIN is set to PF9, MAX31865_MOSI_PIN is set to PD2, MAX31865_MISO_PIN is set to MAX6675_DO_PIN and MAX31865_SCK_PIN is set to MAX6675_SCK_PIN

BUT

What we really need is the following:

#define SERIAL_PORT -1
#define SERIAL_PORT_2 1
#define TEMP_0_PIN PD0
#ifndef MAX31865_CS_PIN
   #define MAX6675_SS_PIN PF9 //ensure you are not using this PIN, this pin is on EXTENSION-1 header
    //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  MAX31865_CS_PIN TEMP_0_PIN
    #define MAX31865_MOSI_PIN PD2
    #define MAX6675_DO_PIN PD5
    #define MAX6675_SCK_PIN PE0
#endif

The above change will now force MAX31865_CS_PIN is set to TEMP_0_PIN and since MAX6675_SS_PIN is NOT equal the MAX31865_CS_PIN the software SPI call on a separate private SPI bus will be called correctly. Please make that change in your firmware.

@ymarco73
Copy link

ymarco73 commented Oct 5, 2020

Hi @GadgetAngel

Yes, the MAX31865 board is already connected when I start my printer.
Ok to test with the temp back to 1. I'll try it on Wednesday when I'll at the Fablab.

I added your code to define the pins like it is supposed to be. I also updated the resistance. I uploaded the Marlin to my Drive so that you can download it if necessary.
I've found a CR10 stock display. I'll be able to test it separately and remove the TFT. What I didn't understand is that I was not able to connect Pronterface but I'll restart the checklist from beginning and write in a Excel what I do ith which combination of component/firmware.

thks,

@GadgetAngel
Copy link

GadgetAngel commented Oct 5, 2020

IN SUMMARY:

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

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

  • Thermistor (that is an ADC Temp Sensor [uses a pure analog I/O pin]) on E0
  • PT100 (-5) on E0
  • PT1000 (-5) on E0
  • Thermocouple (-3) on E0

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

  • Thermistor (that is an ADC Temp Sensors [uses a pure analog I/O pin]) on E0 and Thermistor (that is an ADC Temp Sensor [uses a pure analog I/O pin]) on E1
    Examples of this are:
    - PT100 (uses table 20 or 21) on E0 and Thermocouple (-4 - use pure analog pin) on E1
    - Thermocouple (-4 [pure analog I/O pin]) on E0 and PT100 (uses table 20 or 21) on E1
    - PT1000 (uses table 1047) on E0 and PT100 (uses table 20 or 21) on E1
    - too many to enumerate (etc.)
  • PT100 (-5) on E0 and Thermistor (that is an ADC Temp Sensor [uses a pure analog I/O pin]) on E1
  • PT1000 (-5) on E0 and Thermistor (that is an ADC Temp Sensor [uses a pure analog I/O pin]) on E1
  • Thermocouple (-3) on E0 and Thermistor (that is an ADC Temp Sensor [uses a pure analog I/O pin]) on E1
  • PT100 (-5) on E0 and PT100 (-5) on E1 ====>>> issue fixed in the latest bugfix-2.0.x branch ONLY. You can use Software SPI or Hardware SPI for two (2) Adafruit MAX31865 boards.
  • PT1000 (-5) on E0 and PT1000 (-5) on E1 ====>>> issue fixed in the latest bugfix-2.0.x branch ONLY. You can use Software SPI or Hardware SPI for two (2) Adafruit MAX31865 boards.
  • PT100 (-5) on E0 and PT1000 (-5) on E1 ===>>> issue fixed in the latest bugfix-2.0.x branch ONLY. You can use Software SPI or Hardware SPI for two (2) Adafruit MAX31865 boards.
  • PT100 (-5) on E0 and PT1000 (-5) on E1 IS ALLOWED ===>>> issue fixed in the latest bugfix-2.0.x branch ONLY. You can use Software SPI or Hardware SPI for two (2) Adafruit MAX31865 boards.
  • Thermocouple (-3) on E0 and Thermocouple (-3) on E1===>>> can use either Software SPI or Hardware SPI. They both work for two MAX31855 boards and two thermocouples

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

  • PT100(-5) on E0 and a Thermocouple (-3) on E1 IS NOT ALLOWED
  • PT1000 (-5) on E0 and a Thermocouple (-3) on E1 IS NOT ALLOWED
  • Thermocouple (-3) on E0 and a PT100 (-5) on E1 IS NOT ALLOWED
  • Thermocouple (-3) on E0 and a PT1000 (-5) on E1 IS NOT ALLOWED
  • Thermistor ((that is an ADC Temp Sensor [uses a pure analog I/O pin]) on E0 and PT100 (-5) on E1 IS NOT ALLOWED ***
  • Thermistor ((that is an ADC Temp Sensor [uses a pure analog I/O pin]) on E0 and PT1000 (-5) on E1 is NOT ALLOWED ***
  • Thermistor ((that is an ADC Temp Sensor [uses a pure analog I/O pin]) on E0 and Thermocouple (-3) on E1 is NOT ALLOWED ***

*** 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:
    1. Use table 20: When the power supply for the PT100/PT1000 Amplifier board is equal to the ADC reference voltage for the MCU.
      -- 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
    1. Use table 21: When the power supply for the PT100/PT1000 Amplifier board is different to the ADC reference voltage for the MCU.
      -- The E3D PT100 Amplifier board wants 5V as its power supply. But the GTR V1.0 (like the SKR PRO) uses 3.3V as the ADC reference voltage for the MCU. If you use 5VDC power to the PT100 amplifier board, the amplifier can output a maximum signal with 5VDC. To protect the GTR V1.0 board (or the SKR PRO board), use a 3.6V Zener Diode (reverse biased hookup) between the output signal of the amplifier board and ground (to protect the MCU from getting fried from a 5V input).

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_0 1000
#define MAX31865_CALIBRATION_OHMS_0 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:
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

Below is a table of where this statement can be found for the BTT SKR series of boards:

     board                      pins-file                              SDCARD_CONNECTION setting                      default HW SPI BUS number
---------------           ------------------                       -------------------------------                    --------------------------
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 (SD card reader) ONLY when SDSUPPORT is enabled in configuration.h file; Use Bigtreetech's TF cloud device and hack into the SPI pins (SCK, MOSI, and MISO) off the ESP 12-S chip (https://www.amazon.com/BIGTREETECH-Direct-Wireless-Transmission-Motherboard/dp/B088WB5L8R). 
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
SKR PRO V1.1..............pins_BTT_SKR_PRO_common.h............................LCD.................................................2 (EXP2)
SKR PRO V1.2..............pins_BTT_SKR_PRO_common.h............................LCD.................................................2 (EXP2)
GTR V1.0..................pins_BTT_GTR_V1_0.h..................................ONBOARD.............................................1 (Micro SD card reader on the board)

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
#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, 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", which is used to override the variant.h file SPI Marlin variables. If the Marlin variable was "SOFTWARE_SPI", which indicates the SPI variables will be used as a Software SPI Bus, then no change occurs with the default hardware SPI bus.


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:

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 Bigtreetech's TF cloud device and hack the pins off the ESP 12-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 MAX31865.

G_Hardware_SPI_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:
  • use the Marlin variables for MAX6675: (MAX6675_SS_PIN, MAX6675_DO_PIN, MAX6675_SCK_PIN)
  • ensure that the MAX31865_CS_PIN is NOT EQUAL to the MAX6675_SS_PIN, and ensure the MAX31865_CS_PIN is defined
  • MUST use MAX6675_DO_PIN as the variable for MISO
  • MUST use MAX6675_SCK_PIN as the variable for SCK
  • MUST use MAX31865_MOSI_PIN as the variable for MOSI
  • MUST set MAX31865_CS_PIN as the pin to be used as the chip select pin for MAX31865
  • **MUST USE ONLY 1 (one) MAX31865 board for Software SPI in Marlin 2.0.7.2 or earlier version of Marlin. Software SPI does not work for two Adafruit MAX31865 boards in Marlin 2.0.7.2 or earlier. To get two (2) Adafruit MAX31865 boards in software SPI mode to work either use the current Bugfix-2.0.x branch or wait for Marlin release 2.0.7.3.
  • Either set MAX31865_CS_PIN equal to TEMP_0_PIN or just use the same PIN number in both variables

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

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  //ensure you are not using this PIN
    //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  //ensure you are not using this PIN
#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:

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


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:
  • use the Marlin variables for MAX6675: (MAX6675_SS_PIN, MAX6675_DO_PIN, MAX6675_SCK_PIN)
  • MUST use MAX6675_DO_PIN as the variable for MISO
  • MUST use MAX6675_SCK_PIN as the variable for SCK
  • MUST set MAX6675_SS_PIN as the pin to be used as the chip select pin on MAX31855
  • Either set MAX6675_SS_PIN equal to TEMP_0_PIN or just use the same PIN number in both variables

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.
  • If you have a MCU like the GTR V1.0 board, which already has a MAX31855 built into the board (I will call this ONBOARD_MAX31855), then to use the GTR V1.0 board with an external MAX31855 you MUST use the Clock Line (SCK) and Data Output Line (DO) of the ONBOARD_MAX31855 PINs defined in pins_BTT_GTR_V1_0.h file. This would mean you have to tie the second (external) MAX31855 amplifier board to the M5 connector of the GTR V1.0 board so that you gain access to the DO and SCK lines of the ONBOARD_MAX31855 chip.

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 SUMMARY

@ymarco73
Copy link

ymarco73 commented Oct 7, 2020

Hi @GadgetAngel

Yeeees, it works now fine with MAX31865! Thks a lot for your investigations & advises.
I just have to solve now a new issue with my BLTouch but I should solve it by myself easily.

@GadgetAngel
Copy link

@code505 You can close this issue now. Bugfix-2.0.x has fixed all issues with Adafruit MAX31865 boards and I opened a NEW issue which has the above summary as a GUIDE.

You are the only one that can close this issue since you opened it. So please close this issue out. Thanks.

@karabas2011
Copy link

karabas2011 commented Nov 10, 2021

Is it possible to connect two MAX31865 for dual extruder and one thermistor for chamber and one for bed?
Skr 1.1 pro

@GadgetAngel
Copy link

Is it possible to connect two MAX31865 for dual extruder and one thermistor for chamber and one for bed? Skr 1.1 pro

Marlin firmware does not support using a MAX31865 for the bed!

Marlin will allow you to use two MAX31865s for the dual extruders.

Just use TEMP0_ and TEMP1_ .

Keep in mind that when I did the testing for the MAX31865 and Marlin (which was over a year ago), I tested using two MAX31865 boards. Marlin firmware has changed a lot since I did the testing on the MAX31865 boards.

I use Klipper now. So if you have problems getting two MAX31865 boards running for a dual extruder setup, you should get on DISCORD server for Marlin and ask questions there { https://discord.com/invite/n5NJ59y }.

Good luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants