Page 1 of 1

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

Posted: Fri May 05, 2023 6:27 am
by DronePilot
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

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

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

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

Posted: Fri May 05, 2023 8:36 am
by DronePilot
I am using ESP32S (DEVKIT 1).

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

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

Posted: Fri May 05, 2023 8:49 am
by DronePilot
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??

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

Posted: Fri May 05, 2023 12:38 pm
by ESP_Sprite
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.

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

Posted: Fri May 05, 2023 1:29 pm
by DronePilot
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.