Sd card won’t initialize

I have an arduino pro mini 3,3V for a temperature data logger with sd card breakout board. My issue is that suddenly sd card won’t initialize. Any idea for that?

One idea would be for you to post an image of your now not working project.

Another idea is can the code be uploaded into the possibly defective MCU?

Another idea would be for you to post a schematic of the project.

Another idea is to load into the MCU a SD card example to see if the example code will work.

#include <avr/sleep.h>                                          
#define interruptPin 2
#include <DS3232RTC.h>
#include <TimeLib.h>  
#include <SPI.h>        
#include <SD.h>
#include <Wire.h>
#include <DHT.h>
#include <DHT_U.h>


#define DHTPIN 4                                                  
#define DHTTYPE DHT22                                             
DHT dht(DHTPIN, DHTTYPE);
File myFile;
DS3232RTC rtc;
const int chipSelect = 10;                                       

const int time_interval=15;                                      





void setup() {
  // put your setup code here, to run once:
Serial.begin(115200);
  
  Serial.print("Initializing SD card...");                        
  pinMode(10, OUTPUT);
  //digitalWrite(10, HIGH);
  
  if (!SD.begin(chipSelect)) {  
    Serial.println("No SD Card present in module");
    return;
  }
  Serial.println("SD Card Ready");

  setSyncProvider(RTC.get);                                        
    if(timeStatus() != timeSet)                                   
        Serial.println("Unable to sync with the RTC");
    else
        Serial.println("RTC has set the system time");
  
  rtc.begin(); 

  

  pinMode(LED_BUILTIN,OUTPUT);
  pinMode(interruptPin,INPUT_PULLUP);
  digitalWrite(LED_BUILTIN,HIGH);

  
    RTC.setAlarm(ALM1_MATCH_DATE, 0, 0, 0, 1);                    
    RTC.setAlarm(ALM2_MATCH_DATE, 0, 0, 0, 1);
    RTC.alarm(ALARM_1);
    RTC.alarm(ALARM_2);
    RTC.alarmInterrupt(ALARM_1, false);
    RTC.alarmInterrupt(ALARM_2, false);
    RTC.squareWave(SQWAVE_NONE);

    /* Begin block
     tmElements_t tm;
    tm.Hour = 14;               // set the RTC to an arbitrary time
    tm.Minute = 42;
    tm.Second = 00;
    tm.Day = 23;
    tm.Month = 11;
    tm.Year = 2021 - 1970;      // tmElements_t.Year is the offset from 1970
    RTC.write(tm);              // set the RTC from the tm structure
     //Block end * */

     time_t t; 
    t=RTC.get();                                                               

    
    
    RTC.setAlarm(ALM1_MATCH_MINUTES , 0, minute(t)+time_interval, 0, 0);

    RTC.alarm(ALARM_1);

    RTC.squareWave(SQWAVE_NONE);
    RTC.alarmInterrupt(ALARM_1, true);
    
    dht.begin();
}

void loop() {
  // put your main code here, to run repeatedly:

File dataFile = SD.open("Data.txt", FILE_WRITE);                            

  
  dht.read(DHTPIN);
  float h = dht.readHumidity();
  float T = dht.readTemperature();

  time_t t; 
    t=RTC.get();

    
  
  

 // digital clock display of the time
    Serial.print("Time ");
    Serial.print(" ");
    Serial.print("Date ");
    Serial.print(" ");
    Serial.print("Temperature");
    Serial.print(" ");
    Serial.println("Humidity");
    Serial.print(hour(t));
    Serial.print(":");
    Serial.print(minute(t));
    Serial.print(":");
    Serial.print(second(t));
    Serial.print(' ');
    //Serial.print("Date: ");
    Serial.print(day());
    Serial.print('-');
    Serial.print(month());
    Serial.print('-');
    Serial.print(year());
    Serial.print(' ');
    Serial.print(T); 
    Serial.print(" C  ");
    Serial.print(' ');
    Serial.print(h);
    Serial.println(" %  ");
    

  

    
    if (dataFile)                                          
  {  
    
    dataFile.print(hour(t));
    dataFile.print(":");
    dataFile.print(minute(t));
    dataFile.print(":");
    dataFile.print(second(t));
    dataFile.print(' ');
    
    dataFile.print(day());
    dataFile.print('-');
    dataFile.print(month());
    dataFile.print('-');
    dataFile.print(year());
    dataFile.print(' ');
    dataFile.print(T); 
    dataFile.print(" C  ");
    dataFile.print(' ');
    dataFile.print(h);
    dataFile.println(" %  ");
    
     
     dataFile.close();                                             
  }  
  else {
    Serial.println("Error opening the file!");                      
  }

delay(2000);
  
Going_To_Sleep();                                                

}

void Going_To_Sleep(){
    sleep_enable();                                                                                        
    attachInterrupt(0, wakeUp, LOW);
    set_sleep_mode(SLEEP_MODE_PWR_DOWN);
    digitalWrite(LED_BUILTIN,LOW);
    time_t t;
    t=RTC.get(); 

   

    Serial.println("Sleep  Time: "+String(hour(t))+":"+String(minute(t))+":"+String(second(t)));
    delay(2000); 
    sleep_cpu();
    
    digitalWrite(LED_BUILTIN,HIGH);
    Serial.println("just woke up!");
    
    t=RTC.get();
    Serial.println("WakeUp Time: "+String(hour(t))+":"+String(minute(t))+":"+String(second(t)));

    RTC.setAlarm(ALM1_MATCH_MINUTES , 0, (minute(t) + time_interval) % 60, 0, 0);
    //RTC.setAlarm(ALM1_MATCH_MINUTES , 0, minute(t)+time_interval, 0, 0);

    RTC.alarm(ALARM_1);
}

void wakeUp(){
  Serial.println("Interrrupt Fired");
   sleep_disable();                                                 
  detachInterrupt(0); 
 
}