GPS shield does not work

Hello
I am facing some issue with the GPS shield
the sketch from examples stops here

  if (!GPS.begin()) {
    Serial.println("Failed to initialize GPS!");
    while (1);
  }

I am using the board MKR ZERO+GPS shield+128x64 oled display
MKR ZERO+128x64 work properly but when I add the GPS shiled it stops
looking for help

/*
  GPS Location

  This sketch uses the GPS to determine the location of the board
  and prints it to the Serial monitor.

  Circuit:
   - MKR board
   - MKR GPS attached via I2C cable

  This example code is in the public domain.
*/
#include <Arduino_MKRGPS.h>

//oled
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);



void setup() {
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // If you are using the MKR GPS as shield, change the next line to pass
  // the GPS_MODE_SHIELD parameter to the GPS.begin(...)
  if (!GPS.begin())
  {
    Serial.println("Failed to initialize GPS!");
    while (1);

    pinMode(LED_BUILTIN, OUTPUT);

    // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
    if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS))
    {
      Serial.println(F("SSD1306 allocation failed"));
      for (;;); // Don't proceed, loop forever
    }

    // Show initial display buffer contents on the screen --
    // the library initializes this with an Adafruit splash screen.
    display.display();
    delay(2000); // Pause for 2 seconds

    // Clear the buffer
    display.clearDisplay();
  }
}

void loop()
{
  // check if there is new GPS data available
  if (GPS.available())
  {
    // read GPS values
    float latitude   = GPS.latitude();
    float longitude  = GPS.longitude();
    float altitude   = GPS.altitude();
    float speed      = GPS.speed();
    int   satellites = GPS.satellites();

    // print GPS values
    Serial.print("Location: ");
    Serial.print(latitude, 7);
    Serial.print(", ");
    Serial.println(longitude, 7);

    Serial.print("Altitude: ");
    Serial.print(altitude);
    Serial.println("m");

    Serial.print("Ground speed: ");
    Serial.print(speed);
    Serial.println(" km/h");

    Serial.print("Number of satellites: ");

    Serial.println(satellites);

    Serial.println();

    display.clearDisplay();
    display.setTextSize(2);      // Normal 1:1 pixel scale
    display.setTextColor(SSD1306_WHITE); // Draw white text
    display.setCursor(0, 0);     // Start at top-left corner
    // display.cp437(true);         // Use full 256 char 'Code Page 437' font
    display.println(latitude, 7);
    // Not all the characters will fit on the display. This is normal.
    // Library will draw what it can and the rest will be clipped.
    display.display();
    delay(2000);
  }
  else
  {
    Serial.println("waiting");
  }
}

Stefano

Does it work if you remove the display?

How are the elements powered?

If I remove the oled SCL SCA connections the sketch executes the ELSE
the oled is connected to VCC and GND on the top of the shield

which else ?

Hi
I made this
the OLED is not more attached

  if (!GPS.begin(GPS_MODE_SHIELD))
  {
    Serial.println("Failed to initialize GPS!");
    while (1);
   }

but now after some upgrade of AVR boards the IDE doesn t do upload anymore

Arduino: 1.8.19 (Windows 10), Board: "Arduino MKRZERO"

Sketch uses 39216 bytes (14%) of program storage space. Maximum is 262144 bytes.

Global variables use 3884 bytes (11%) of dynamic memory, leaving 28884 bytes for local variables. Maximum is 32768 bytes.

An error occurred while uploading the sketch



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.