Save GPS Data on SD Card (sim808 and Datalogger)

Hello,

I want to use the DFRobot sim808 Shield GPS to save data on the SD card with the AzDelivery Datalogger Shield.

GPS sensor works (get data) and the datalogger also works independently.

When writing a sketch to save GPS data to the SD card, I no longer receive GPS data. I still get data from other sensors.

As I currently estimate it is because the two shields use the same pins.
Datalogger uses pins 10-13 and the sim808 pins 0.1 (data) and 12 (on / off).

Once I get the command: File dataFile = SD.open (“datalog.txt”, FILE_WRITE);
in the sketch, I no longer receive GPS data.

I’m grateful for any help!

#include <DFRobot_sim808.h>
#include <SoftwareSerial.h>
#include <SPI.h>
#include <SD.h>

DFRobot_SIM808 sim808(&Serial);

const int chipSelect = 10;

void setup() {
  //mySerial.begin(9600);
  Serial.begin(9600);
  
  Serial.print("Initializing SD card...");

  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    while (1);
  }
  Serial.println("card initialized.");

  //******** Initialize sim808 module *************
  while(!sim808.init()) { 
      delay(1000);
      Serial.print("Sim808 init error\r\n");
  }

  //************* Turn on the GPS power************
  if( sim808.attachGPS())
      Serial.println("Open the GPS power success");
  else 
      Serial.println("Open the GPS power failure");
}

float lat = 0;
float lon = 0;

void loop() {
   //************** Get GPS data *******************
   if (sim808.getGPS()) {
    
    Serial.print("lat :");
    lat = sim808.GPSdata.lat;
    Serial.println(lat);

    Serial.print("lon :");
    lon = sim808.GPSdata.lon;
    Serial.println(lon);

    //************* Turn off the GPS power ************
    sim808.detachGPS();
  }

  File dataFile = SD.open("datalog.txt", FILE_WRITE);
  
  //more Code for SD saving...
}