Code Monkey home page Code Monkey logo

Comments (2)

ansonl avatar ansonl commented on July 30, 2024

I read MarlinFirmware/Marlin#25774 and used some clues with TEMP_SENSOR_FORCE_HW_SPI to get SPI MAX31865 on motor driver to work correctly when EXP2 (LCD SD SPI) is connected to the EXP2 on the board.

SOFTWARE_SPI for both temp sensors must be commented out. If it is not disabled, the SPI connection for MAX31865 fails when the SD card is used. As soon as the card is inserted into the LCD SD slot and the SD is read from, the MAX31865 SPI fails with a temp error even though it worked fine before any SD was inserted. I have 2 2 wire PT1000s connected to both the onboard MAX31865 and stepper driver MAX31865. The temp error is first thrown on the onboard MAX31865 so I assume that SPI to both MAX31865 is failing. The onboard MAX31865 used to work fine with the LCD SD SPI in the past so there is an issue where the onboard MAX31865 works with SOFTWARE_SPI and fails with HW_SPI while the stepper driver SPI works with HW_SPI and fails with SOFTWARE_SPI.

It's not clear why there are separate defines for SOFTWARE_SPI and TEMP_SENSOR_FORCE_HW_SPI when it comes to temp sensors. Since they can be enabled and disabled independent of each other, it is not self explanatory whether soft or hard SPI take precedence for temp sensor without viewing the code.

@bigtreetech Hopefully the below config helps with the immediate SPI issue but I don't know why software spi does not work for stepper driver SPI and EXP2 (LCD SD) SPI at the same time.

#if TEMP_SENSOR_0 == -5
  #define TEMP_0_CS_PIN                     PF8   // Max31865 CS
  #define TEMP_0_SCK_PIN                    PA5
  #define TEMP_0_MISO_PIN                   PA6
  #define TEMP_0_MOSI_PIN                   PA7
  //#define SOFTWARE_SPI                            // Max31865 and LCD SD share a set of SPIs, Set SD to softwareSPI for Max31865
  #define FORCE_SOFT_SPI
#else
  #define TEMP_0_PIN                        PF4   // TH0
#endif


//Define E3 or TEMP_SENSOR_1 on MOTOR 7
#if TEMP_SENSOR_1 == -5
  #define TEMP_1_CS_PIN                     PD3   // Max31865 CS MOTOR 7
  #define TEMP_1_SCK_PIN                    PA5
  #define TEMP_1_MISO_PIN                   PA6
  #define TEMP_1_MOSI_PIN                   PA7
  //#define SOFTWARE_SPI                            // Max31865 and LCD SD share a set of SPIs, Set SD to softwareSPI for Max31865
  #define FORCE_SOFT_SPI

  /*
  #ifndef MAX31865_CS_PIN
    #define MAX31865_MISO_PIN PA6
    #define MAX31865_SCK_PIN PA5
    #define MAX31865_MOSI_PIN PA7
    #define MAX6675_SS_PIN PD3
    //#define MAX31865_CS_PIN PD3
  #endif
  */
#else
  #define TEMP_1_PIN                        PF5   // TH1

  //Define E3 if MOTOR 7 not used for TEMP_SENSOR_1 MAX module
  #define E3_STEP_PIN                         PE6   // MOTOR 7
  #define E3_DIR_PIN                          PA14
  #define E3_ENABLE_PIN                       PE0
  #ifndef E3_CS_PIN
    #define E3_CS_PIN                         PD3
  #endif
#endif


/**
 * Thermocouple Options — for MAX6675 (-2), MAX31855 (-3), and MAX31865 (-5).
 */
#define TEMP_SENSOR_FORCE_HW_SPI                // Ignore SCK/MOSI/MISO pins; use CS and the default SPI bus.
#define MAX31865_SENSOR_WIRES_0 2               // (2-4) Number of wires for the probe connected to a MAX31865 board.
#define MAX31865_SENSOR_WIRES_1 2
//#define MAX31865_SENSOR_WIRES_2 2

from bigtreetech-octopus-pro.

ansonl avatar ansonl commented on July 30, 2024

Update: The printer fails to read temp via SPI from both the onboard and stepper module MAX31865 when SD card is inserted into the LCD SD reader that uses SPI. This happens randomly so it's basically not possible to use the LCD SD slot right now.

from bigtreetech-octopus-pro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.