ESP32: SD-Card Module + MAX6675 on HSPI Bus (Known SD Card Problem?)

Hi there!

For my current project ( Meat Probe Logger) I am using an NRF24 on VSPI and an SD Card Module + MAX6675 on HSPI. Just in case someone is wondering: I only use the MAX6675 for Grill temp monitoring, not as an acutal meatprobe. Those are NTCs in a voltage divider going into an ADC1115.

My Problem:
Like many posts on the web the SD Module (I attached a pic of it) and the MAX6675 seem to interfere - or better: The SD wont release MISO (?).
My question is now if I do have one of the faulty SD Modules because it does not have an On-Board chip at all. This Chip again seems to be the Problem in many other posts.

Can anyone give me some insight?

Here is the code I am using for testing:

#include "FS.h"
#include "SD.h"
#include "SPI.h"
#include "max6675.h"                // MAX6675 Thermoelemente on SPI

SPIClass spiSD(HSPI);
#define SD_CS 25  // MAX6675 CS@27

//MAX6675 Variablen___________________________________
int thermoCLK = 14;
int thermoDO = 26;
int thermoCS_1 = 27;
int MAX6675_Value;
MAX6675 thermocouple_1(thermoCLK, thermoCS_1, thermoDO);

void setup()
{
  Serial.begin(9600);
  
  spiSD.begin(14, 26, 13, 25); //CLK,MISO,MOIS,SS
  if (!SD.begin(25, spiSD))
  {
    Serial.println("Card Mount Failed");
    return;
  }
  else
  {
    Serial.println("Card Mount Successful");
  }
}

void loop()
{ 
  MAX6675_Value = (int)(thermocouple_1.readCelsius() * 100);
  Serial.print("MAX6675: ");
  Serial.print(MAX6675_Value);
  Serial.println();
  delay(250); 
}

In this configuration the SD Card works but the MAX6675 wont read.
If I comment the SD Card stuff out but leave the actual module in place the MAX reads.

Any insight?

Thanks all!

I just changed the code to read out the MAX6675 in the SETUP part BEFORE initialising the SD Card a few times. Then init the SD card and try to read the MAX6675 again.
Result:
Before the SD init the MAX6675 can be read, after the init it fails.

MAX6675: 2950
MAX6675: 2925
MAX6675: 2925
Card Mount Successful
MAX6675: 0
MAX6675: 0
MAX6675: 0
MAX6675: 0
MAX6675: 0
MAX6675: 0
MAX6675: 0
MAX6675: 0

any help is very much appreciated

The faulty microSD modules have a voltage regulator and a level shifting IC. They are meant for connecting an SD card to a 5V MCU, and the problem is that the level shifting IC never releases MISO. But your module doesn't have any of that. It appears to be what you need to connect to a 3.3V MCU such as your ESP32. So it doesn't appear that the module is the problem.

@ShermanP I agree. As the ESP32 is using the 3.3 logic anyways I would not need the level shifter. I really dont get why the MAX6675 works as long as the SD is not initialised.
Maybe I need a Pullup/Pulldown on my SD Card CS Pin so it really can release? Is there anything special about IO25 on an ESP?

I've never used an ESP32, and don't really know anything about them.

What happens if you have the Sd module attached, with an SD card in it, but comment out the SD code? Does the MAX6675 work then?

I don't know if it's a CS issue or a MISO issue, or possibly even something else like a library conflict of some kind. It wouldn't hurt to try a pullup resistor on the CS lines, and you could try inserting a 3.3K resistor in series with the SD card's MISO line.

Edit: It looks like you have resistors on the SD module, and they may be pullup resistors. You might see if you can reverse engineer the module and work up a schematic so you know what's already there.