Hi,
We have teensy 3.2 and we want to use GPS sensor which have GY-NEO 6MV2. We don't get any data, but it works on arduino.
Additionally we have pressure/temperature/gyro sensor (10-DOF IMU), SD card module (arduino), wifi module (esp8266), buzzer, voltage divider (we measure with analog input pin). All of these work good (without GPS sensor). But when we add to GPS sensor on circuit, everything goes bad. All sensors don't wor

We don't understand, where do we go wrong.

Code:

Code:
#include <Wire.h>
#include <Adafruit_BMP280.h>
#include <OneWire.h>
#include "MPU9255.h"
#include <TinyGPS.h>
#include <SPI.h>
#include <SD.h>

int16_t accelCount[3];
int16_t gyroCount[3];
int16_t magCount[3];
int16_t tempCount;
float f_accelCount[3];
float f_gyroCount[3];
float f_magCount[3];
float AccelScale, GyroScale, MagScale;
float temperature;
int doklG = 250; // stopni / sekunde - dokladnosc dla czujnika zyroskopowego
int doklA = 2; // +- 2g - dokladnosc dla akcelerometru
int doklM = 6; // 0.6 mGaussa - dokladnosc dla magnetometru
float approxGndPress;

Adafruit_BMP280 bmp; // inicjalizacja czujnika cisnienia/altymetru + termometru
MPU9255 mpu(12, doklG, doklA,doklM); // inicjalizacja akcelerometru-zyroskopu-magnetometru

/* START GPS */
TinyGPS gps;

void gpsdump(TinyGPS &gps);
String printFloat(double f = 0, int digits = 2);

/* END GPS */


/* START WIFI */

String agAdi = "POCOFONE";                 //Ağımızın adını buraya yazıyoruz.    
String agSifresi = "fener1234";           //Ağımızın şifresini buraya yazıyoruz.

//esp nin rx = 1 - tx = 0

String ip = "184.106.153.149";                                //Thingspeak ip adresi
float sicaklik, nem;

/* END WIFI */

/* START VOLTAJ BOLUCU */
int analogInput = 0;
float vout = 0.0;
float vin = 0.0;
float R1 = 100000.0; // 100K ohm direnç
float R2 = 10000.0; // 10K ohm direnç
int valueVoltajBolucu = 0;
/* END VOLTAJ BOLUCU */

/* START SD CARD ADAPTOR */
Sd2Card card;
SdVolume volume;
SdFile root;

const int chipSelect = 4;  
File myFile;
/* END SD CARD ADAPTOR */

int buzzerPin = 20;

int paketNo = 1;


bool espBuldu = false;

String telemetri = "";

String sdCardFile = "21072020.txt";

boolean sdError = false;
 
void setup()
{
  delay(2000);
  
  Serial.begin(115200);
  
  pinMode(analogInput, INPUT); // voltaj bolucu - a0 (14)
  
  pinMode(buzzerPin, OUTPUT); //BUZZER
  
  /* START SD CARD ADAPTOR */

  SPI.setCS(4);

   Serial.print("\nInitializing SD card...");

  pinMode(chipSelect, OUTPUT);     
  
 sdError = false;
 
  if (!card.init(SPI_QUARTER_SPEED, chipSelect)) {
    Serial.println("initialization failed. Things to check:");
    Serial.println("* is a card is inserted?");
    Serial.println("* Is your wiring correct?");
    Serial.println("* did you change the chipSelect pin to match your shield or module?");
    sdError = true;
  } else {
   Serial.println("Wiring is correct and a card is present.");
  }

  
  // print the type of card
  Serial.print("\nCard type: ");
  switch(card.type()) {
    case SD_CARD_TYPE_SD1:
      Serial.println("SD1");
      break;
    case SD_CARD_TYPE_SD2:
      Serial.println("SD2");
      break;
    case SD_CARD_TYPE_SDHC:
      Serial.println("SDHC");
      break;
    default:
      Serial.println("Unknown");
  }
 
  // Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32
  if (!volume.init(card)) {
    Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card");
    sdError = true;
  }

  if (sdError == false)
  {
        
      // print the type and size of the first FAT-type volume
      long volumesize;
      Serial.print("\nVolume type is FAT");
      Serial.println(volume.fatType(), DEC);
      Serial.println();
     
      volumesize = volume.blocksPerCluster();    // clusters are collections of blocks
      volumesize *= volume.clusterCount();       // we'll have a lot of clusters
      volumesize *= 512;                            // SD card blocks are always 512 bytes
      Serial.print("Volume size (bytes): ");
      Serial.println(volumesize);
      Serial.print("Volume size (Kbytes): ");
      volumesize /= 1024;
      Serial.println(volumesize);
      Serial.print("Volume size (Mbytes): ");
      volumesize /= 1024;
      Serial.println(volumesize);
     
      Serial.println("\nFiles found on the card (name, date and size in bytes): ");
      root.openRoot(volume);
     
      // list all files in the card with date and size
      root.ls(LS_R | LS_DATE | LS_SIZE);
     
      delay(2000);
    
       if (!SD.begin(chipSelect)) {
        Serial.println("initialization failed!");
        //return;
        
      } else {
        Serial.println("SD card initialized");
        myFile = SD.open(sdCardFile.c_str(), FILE_WRITE);    // open file for writing
        if (myFile) {  // if file can be opened, write to it
          Serial.print(sdCardFile + " file opened for writing");
          myFile.close();
        } else {  // if not, show an error
          myFile.println("asdwfkq");
          Serial.println("ERROR: not able to open " + sdCardFile);
          myFile.close();
        }
      }

  
  }
 
  
  /* END SD CARD ADAPTOR */
  
	Wire.begin();//inicjalizacja protokolu I2C
	TWBR = 24;
	mpu.initMPU9250();//inicjalizacja akcelerometru-zyroskopu
	float magCalibration[3];
	mpu.initAK8963(magCalibration);//inicjalizacja magnetometru
	if (!bmp.begin()) {
		Serial.println("10 dof imu hatali - Nie mozna nawiazac polaczenia z czujnikiem cisnienia BMP280!");
		//while (1);
	}
	
  for(int i=0;i<5;i++)
  {
    approxGndPress+=bmp.readPressure();
    delay(1000);
    }
    approxGndPress/=5;
	switch (doklG)
	{
	case 250: GyroScale = 131.0; break;
	case 500: GyroScale = 65.5; break;
	case 1000: GyroScale = 32.8; break;
	case 2000: GyroScale = 16.4; break;
	default: GyroScale = 131.0; break;
	}
	switch (doklA)
	{
	case 2: AccelScale = 16384.0; break;
	case 4: AccelScale = 8192.0; break;
	case 8: AccelScale = 4096.0; break;
	case 16: AccelScale = 2048.0; break;
	default: AccelScale = 16384.0; break;
	}
	switch (doklM)
	{
	case 6: MagScale=0.6; break;
	case 15: MagScale=0.15; break;
	default: MagScale =1; break;
	}
Serial.println("10 dof imu sensoru ayarlari yapildi.");
/* START WIFI */

 Serial.println("WİFİ Started");
  Serial3.begin(115200);                                          //ESP8266 ile seri haberleşmeyi başlatıyoruz.
  Serial3.println("AT");                                          //AT komutu ile modül kontrolünü yapıyoruz.
  Serial.println("AT Yollandı");
  int espDenemeSayisi = 0;
  while(!Serial3.find("OK") && espDenemeSayisi < 5){                                     //Modül hazır olana kadar bekliyoruz.
    Serial3.println("AT");
    Serial.println("ESP8266 Bulunamadı."); //TODO HASAN (20 kere dene yoksa diğer kodlara geç)
    espDenemeSayisi++;
  }

  if (!(espDenemeSayisi >= 5))
  { 
    Serial.println("OK Komutu Alındı");
    Serial3.println("AT+CWMODE=1");                                 //ESP8266 modülünü client olarak ayarlıyoruz.
    espDenemeSayisi = 0;
    while(!Serial3.find("OK") && espDenemeSayisi < 5){                                     //Ayar yapılana kadar bekliyoruz.
      Serial3.println("AT+CWMODE=1");
      Serial.println("Ayar Yapılıyor....");
      espDenemeSayisi++;
    }
    Serial.println("Client olarak ayarlandı");
    Serial.println("Aga Baglaniliyor...");
    Serial3.println("AT+CWJAP=\""+agAdi+"\",\""+agSifresi+"\"");    //Ağımıza bağlanıyoruz.
    espDenemeSayisi = 0;
    while(!Serial3.find("OK") && espDenemeSayisi < 5)
    {
        espDenemeSayisi++;  
    }
    if (!(espDenemeSayisi >= 5))
    {
      Serial.println("Aga Baglandi.");
      espBuldu = true;
      delay(1000);
    }
    else
    {
      /*
        // _reboot_Teensyduino_();       
        */  
      Serial.println("WIFI ESP ağa bağlanmadı");
    }
    
  }
  else
  {
    Serial.println("WIFI ESP CALISMADI");
  }
  
/* END WIFI */


  /* START GPS */
  Serial1.begin(9600);
  delay(1000);
  //Serial.println("uBlox Neo 6M");
  //Serial.print("Testing TinyGPS library v. "); Serial.println(TinyGPS::library_version());
  //Serial.println("by Mikal Hart");
  //Serial.println();
  Serial.print("Sizeof(gpsobject) = gps ayarlanacak"); 
  Serial.println(sizeof(TinyGPS));
  Serial.println(); 
  
  /* END GPS */




  /* START XBEE */

  Serial2.begin(9600);
  
  /* END XBEE */
}
void loop()
{

  
  /* START GPS */

   long lat, lon;
    float flat = 5.33642, flon = 1.263321;
    unsigned long age1, date, time, chars;
    int year;
    byte month, day, hour, minute, second, hundredths;
    unsigned short sentences, failed;
  
while(0)
{
  
  
      bool newdata = false;
    unsigned long start = millis();
    // Every 5 seconds we print an update
    while (millis() - start < 5000) 
    {
      if (Serial1.available()) 
      
      {
        char c = Serial1.read();
        //Serial.print(c);  // uncomment to see raw GPS data
        //Serial.println("gps e bakıyor");
        if (gps.encode(c)) 
        {
          newdata = true;
          break;  // uncomment to print new data immediately!
        }
      }
    }
  
    
    if (newdata) 
    {
      Serial.println("Acquired Data");
      Serial.println("-------------");
      //gpsdump(gps);
      
      gps.get_position(&lat, &lon, &age1);
      Serial.print("Lat/Long(10^-5 deg): "); Serial.print(lat); Serial.print(", "); Serial.print(lon); 
      //Serial.print(" Fix age: "); Serial.print(age); Serial.println("ms.");
      
      // On Arduino, GPS characters may be lost during lengthy Serial.print()
      // On Teensy, Serial prints to USB, which has large output buffering and
      //   runs very fast, so it's not necessary to worry about missing 4800
      //   baud GPS characters.

      age1 = 0;
      
      gps.f_get_position(&flat, &flon, &age1);
      Serial.print("Lat/Long(float): "); printFloat(flat, 7); Serial.print(", "); printFloat(flon, 7);
        //Serial.print(" Fix age: "); Serial.print(age); Serial.println("ms.");
    
      age1 = 0;
      
      gps.get_datetime(&date, &time, &age1);
      Serial.print("Date(ddmmyy): "); Serial.print(date); Serial.print(" Time(hhmmsscc): ");
        Serial.print(time);
      //Serial.print(" Fix age: "); Serial.print(age); Serial.println("ms.");
    
      gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths, &age1);
      Serial.print("Date: "); Serial.print(static_cast<int>(month)); Serial.print("/"); 
        Serial.print(static_cast<int>(day)); Serial.print("/"); Serial.print(year);
      Serial.print("  Time: "); Serial.print(static_cast<int>(hour+8));  Serial.print(":"); //Serial.print("UTC +08:00 Malaysia");
        Serial.print(static_cast<int>(minute)); Serial.print(":"); Serial.print(static_cast<int>(second));
        Serial.print("."); Serial.print(static_cast<int>(hundredths)); Serial.print(" UTC +08:00 Malaysia");
      //Serial.print("  Fix age: ");  Serial.print(age); Serial.println("ms.");
    
      Serial.print("Alt(cm): "); Serial.print(gps.altitude()); Serial.print(" Course(10^-2 deg): ");
        Serial.print(gps.course()); Serial.print(" Speed(10^-2 knots): "); Serial.println(gps.speed());
      Serial.print("Alt(float): "); printFloat(gps.f_altitude()); Serial.print(" Course(float): ");
        printFloat(gps.f_course()); Serial.println();
      Serial.print("Speed(knots): "); printFloat(gps.f_speed_knots()); Serial.print(" (mph): ");
        printFloat(gps.f_speed_mph());
      Serial.print(" (mps): "); printFloat(gps.f_speed_mps()); Serial.print(" (kmph): ");
        printFloat(gps.f_speed_kmph()); Serial.println();
    
      gps.stats(&chars, &sentences, &failed);
      Serial.print("Stats: characters: "); Serial.print(chars); Serial.print(" sentences: ");
        Serial.print(sentences); Serial.print(" failed checksum: "); Serial.println(failed);
    
    
  
      
      Serial.println("-------------");
      Serial.println();
  

      break;
    }

   
  
}
  
  /* END GPS */
  
/* START 10 DOF İMU */

		mpu.readAccelData(f_accelCount);
    
    for(int i=0;i<3;i++)f_accelCount[i]/=AccelScale; // podziel kazda ze skladowych przyspieszenia przez czynnik skali dla akcelerometru

      Serial.print("\tax "); Serial.print(f_accelCount[0]);
		Serial.print("\tay "); Serial.print(f_accelCount[1]);
		Serial.print("\taz "); Serial.print(f_accelCount[2]);

		tempCount = mpu.readTempData();
		Serial.print("\tT ");
		Serial.print(tempCount / 100.0);
		Serial.print(" *C");
		Serial.print("\tP = ");
		Serial.print(bmp.readPressure()/100.0);
		Serial.print(" hPa");
		Serial.print("\tApprox alt = ");
		Serial.print(bmp.readAltitude(1019.0)); // wysokość liczona wzgledem cisnienia przy powierzchni
		Serial.println(" m");

/* END 10 DOF İMU */

/* START WIFI */

    if (espBuldu == true)
    {
         Serial3.println("AT+CIPSTART=\"TCP\",\""+ip+"\",80");           //Thingspeak'e bağlanıyoruz.
          if(Serial3.find("Error")){                                      //Bağlantı hatası kontrolü yapıyoruz.
            Serial.println("AT+CIPSTART Error");
           }
  
          String tweet = "POST /apps/thingtweet/1/statuses/update HTTP/1.1\n";
              tweet+="Host: api.thingspeak.com\n";
              tweet+="Connection: close\n";
              tweet+="Content-Type: application/x-www-form-urlencoded\n";
              tweet+="Content-Length:51\r\n\r\napi_key=";
              tweet+=String("9E5QX2123KGHVXLB");                             //ThingSpeak'den aldığımız Twitter API KEY'ini buraya yazıyoruz.
              tweet+=String("&status=");
              tweet+=String("#helloesp8266 Try 2");                           // Yollamak istediğimiz tweeti buraya yazıyoruz.
          
           Serial3.print("AT+CIPSEND=");                    //veri yollayacağımız zaman bu komutu kullanıyoruz. Bu komut ile önce kaç tane karakter yollayacağımızı söylememiz gerekiyor.
           delay(100);
           Serial3.println(tweet.length());
           
           if(Serial3.find(">")){                           //eğer sunucu ile iletişim sağlayıp komut uzunluğunu gönderebilmişsek ESP modülü bize ">" işareti ile geri dönüyor.
                                                           // arduino da ">" işaretini gördüğü anda sıcaklık verisini esp modülü ile thingspeak sunucusuna yolluyor.
             Serial3.println(tweet);
             Serial3.println("AT+CIPCLOSE=0");
            
             Serial.println(tweet);
                Serial.println("tweet gonderildi.");
                
            }
          
            Serial.println("Baglantı Kapatildi.");
            Serial3.println("AT+CIPCLOSE");                                //Bağlantıyı kapatıyoruz
            

    }
    
/* END WIFI */


  /* START VOLTAJ BOLUCU */
   valueVoltajBolucu = analogRead(analogInput);
   Serial.print("value= ");

    Serial.println(valueVoltajBolucu);
    
   vout = (valueVoltajBolucu * 5) / 1024.0; 
   vin = vout / (R2/(R1+R2)); 
   if (vin<0.09) {
      vin=0.0;
    } 
    Serial.print("VOLTAJ Vout= ");

    Serial.println(vout);
    
    Serial.print("VOLTAJ Vin= ");

    Serial.println(vin);
    
    /* END VOLTAJ BOLUCU */

  telemetri = "3431,";
  
  telemetri += String(paketNo) + ",";

  //double vout2 = static_cast<double>(vout);
  //vout2 = 50001.0;
  //String vout3 = String(vout2).substring(0,3);
  //Serial.println(vout3);
  paketNo++;
    telemetri += String(static_cast<int>(day)) + "/" + String(static_cast<int>(month)) + "/" + String(year);
    telemetri += "-" + String(static_cast<int>(hour+3)) + ":" + String(static_cast<int>(minute)) + ":" + String(static_cast<int>(second)) + ",";
    telemetri += "UYDU STATUSU,";
    telemetri += String(bmp.readAltitude(1019.0)) + ","; // yükseklik
    telemetri += String(bmp.readPressure()/100.0) + ","; // basınc
    telemetri += String(tempCount / 100.0) + ","; //sıcaklık
    telemetri += String(vin,2) + ","; //pil gerilimi (voltaj bolucu)
    telemetri += String(f_accelCount[0]) + ","; //yunuslama (ax)
    telemetri += String(f_accelCount[1]) + ","; //yalpalanma (ay)
    telemetri += String(f_accelCount[2]) + ","; //yuvarlanma (az)
    //telemetri += String(printFloat(flat, 5)) + ","; //boylam (latitute)
    //telemetri += String(printFloat(flon, 5)) + ","; //enlem (longitute)
    telemetri += String(flat,7) + ","; //boylam (latitute)
    telemetri += String(flon,7) + ","; //enlem (longitute)
    
    telemetri += String(gps.altitude()) + ",F:"; //gps yukseklik (altitude cm)
    telemetri += String(gps.f_altitude());
/*
 * 
 * 
 * 
 * <3431>,<13>,<29/08/2020-12:37:48>, <3>, <153.75>, <101900>,<22.3>,<3.7>,<23.44>,<13.89>,<21.03>,<28.539>,<41.02>,<14.5>


< Takım Numarası >, < Paket Numarası >, < Gönderme Zamanı >, < Uydu Statüsü >, <Yükseklik>, <Basınç>, < Sıcaklık >, < Pil Gerilimi >, < Yunuslama >, < Yalpalanma >, <Yuvarlanma >, < GPS Boylam >, < GPS Enlem >, < GPS Yükseklik >



 */
    Serial.println("\ntelemetri verisi:");
    Serial.println(telemetri);


    /* START SD KART */
   myFile = SD.open(sdCardFile.c_str(), FILE_WRITE);            
                  myFile.println(telemetri);
                  Serial.println("SD Karta kaydedildi. Paket: " + String(paketNo)); //Yazılanları ekstra ekranda görmek için..

                  myFile.close();

    /* END SD KART */

    
    /* START XBEE */

  Serial2.println(telemetri);//Ending symbol
  
    /* END XBEE */
    
    tone(buzzerPin, 440);
delay(400);

    noTone(buzzerPin);
  
    


    
}



/* START GPS FUNCTIONS */

void gpsdump(TinyGPS &gps)
{
 
}

String printFloat(double number, int digits)
{
  String returnValue = "";
  
  // Handle negative numbers
  if (number < 0.0) 
  {
     Serial.print('-');
     returnValue += "-";
     
     number = -number;
  }

  // Round correctly so that print(1.999, 2) prints as "2.00"
  double rounding = 0.5;
  for (uint8_t i=0; i<digits; ++i)
    rounding /= 10.0;
  
  number += rounding;

  // Extract the integer part of the number and print it
  unsigned long int_part = (unsigned long)number;
  double remainder = number - (double)int_part;
  Serial.print(int_part);
  returnValue += String(int_part);

  // Print the decimal point, but only if there are digits beyond
  if (digits > 0)
  {
    Serial.print("."); 
    returnValue += ".";
  }
  
  // Extract digits from the remainder one at a time
  while (digits-- > 0) 
  {
    remainder *= 10.0;
    int toPrint = int(remainder);
    Serial.print(toPrint);
    returnValue += String(toPrint);
    remainder -= toPrint;
  }
}

/* END GPS FUNCTIONS */