ESP32 + GPS - > permanently got error" GPS not detected. Check wiring".

DronePilot
Posts: 7
Joined: Mon Mar 27, 2023 10:43 am

ESP32 + GPS - > permanently got error" GPS not detected. Check wiring".

Postby DronePilot » Fri May 05, 2023 6:27 am

Using this code I permanently got the error" GPS not detected. Check wiring".

Code: Select all

#include <HardwareSerial.h>
#include <TinyGPSPlus.h>

HardwareSerial GPSSerial (2);
TinyGPSPlus gps;

void setup()
{
  Serial.begin(9600);
  GPSSerial.begin ( 9600, SERIAL_8N1, 16, 17 ); // begin GPS hardware serial
}

void loop()
{
  Serial.begin(9600);
  // This sketch displays information every time a new sentence is correctly encoded.
  while (GPSSerial.available() > 0)
    if (gps.encode(GPSSerial.read()))
      displayInfo();

  if (millis() > 10000 && gps.charsProcessed() < 10)
  {
    Serial.println(F("No GPS detected: check wiring."));
    while(true);
  }
}

void displayInfo()
{
  Serial.print(F("Location: ")); 
  if (gps.location.isValid())
  {
    Serial.print(gps.location.lat(), 9);
    Serial.print(F(","));
    Serial.print(gps.location.lng(), 9);
  }
  else
  {
    Serial.print(F("INVALID"));
  }
}
I have checked connections several times.

CC

ESP_Sprite
Posts: 9751
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 + GPS - > permanently got error" GPS not detected. Check wiring".

Postby ESP_Sprite » Fri May 05, 2023 8:31 am

Are you sure you're not using an ESP32 (module) with PSRAM? If so, GPIO 17 is generally unavailable.

DronePilot
Posts: 7
Joined: Mon Mar 27, 2023 10:43 am

Re: ESP32 + GPS - > permanently got error" GPS not detected. Check wiring".

Postby DronePilot » Fri May 05, 2023 8:36 am

I am using ESP32S (DEVKIT 1).

From the image below I see thta RX, TX (GPIO16 and GPIO 17) are UART2.
Image

DronePilot
Posts: 7
Joined: Mon Mar 27, 2023 10:43 am

Re: ESP32 + GPS - > permanently got error" GPS not detected. Check wiring".

Postby DronePilot » Fri May 05, 2023 8:49 am

ESP_Sprite wrote:
Fri May 05, 2023 8:31 am
Are you sure you're not using an ESP32 (module) with PSRAM? If so, GPIO 17 is generally unavailable.
Isn't GPIO 17 a UART U2_TXD??

ESP_Sprite
Posts: 9751
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 + GPS - > permanently got error" GPS not detected. Check wiring".

Postby ESP_Sprite » Fri May 05, 2023 12:38 pm

It's the default pin for that, yes, but you can route that function to different pins, and that pin can be used for different functions as well.

DronePilot
Posts: 7
Joined: Mon Mar 27, 2023 10:43 am

Re: ESP32 + GPS - > permanently got error" GPS not detected. Check wiring".

Postby DronePilot » Fri May 05, 2023 1:29 pm

Finally, I changed cables (once again) and now GPS has a proper power supply (red LED is switched on). Still don't have the coordinates but I am in the room, interior...I think I should go outdoors.

Who is online

Users browsing this forum: themindfactory and 31 guests