ESP32-S3 + GPS Module

dneubern
Posts: 1
Joined: Tue Apr 16, 2024 9:45 am

ESP32-S3 + GPS Module

Postby dneubern » Tue Apr 16, 2024 9:53 am

Hello all,
I'm trying to run a GPS Module (NEO-M8N ATGM336H) on a ESP32-S3 based board made by WaveShare ( https://www.waveshare.com/esp32-s3-lcd-1.28.htm )

Unfortunately, whatever I do, I cannot get any data from the GPS module. No information is sent from the module to the board.
I've tried several libraries already, and none seem to work. I'm lost already.
I've also tried using UART2 but I still can't see any information coming from the module.
It seems the TX/RX ports from the board are 17/18.

This is the current code I'm using for the module (Although I've tried many more).
In this case I'm trying to use UART2 (since the default UART doesn't work as well).

Code: Select all

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

/*
   This sample sketch demonstrates the normal use of a TinyGPSPlus (TinyGPSPlus) object.
   It requires the use of SoftwareSerial, and assumes that you have a
   4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
*/
static const int RXPin = 34, TXPin = 34;
static const uint32_t GPSBaud = 9600;

HardwareSerial SerialPort(2); // use UART2

void displayInfo();

// The TinyGPSPlus object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

void setup()
{
  Serial.begin(115200);

  Serial2.begin(9600, SERIAL_8N1, 36, 34); 

  ss.begin(GPSBaud);

  Serial.println(F("DeviceExample.ino"));
  Serial.println(F("A simple demonstration of TinyGPSPlus with an attached GPS module"));
  Serial.print(F("Testing TinyGPSPlus library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
  Serial.println(F("by Mikal Hart"));
  Serial.println();
}

void loop()
{
  while (Serial2.available()) {
    Serial.print(char(Serial2.read()));
  }
  
  // This sketch displays information every time a new sentence is correctly encoded.
  while (ss.available() > 0)
  Serial.println("available");
    if (gps.encode(ss.read()))
      displayInfo();

  if (millis() > 5000 && 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(), 6);
    Serial.print(F(","));
    Serial.print(gps.location.lng(), 6);
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F("  Date/Time: "));
  if (gps.date.isValid())
  {
    Serial.print(gps.date.month());
    Serial.print(F("/"));
    Serial.print(gps.date.day());
    Serial.print(F("/"));
    Serial.print(gps.date.year());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F(" "));
  if (gps.time.isValid())
  {
    if (gps.time.hour() < 10) Serial.print(F("0"));
    Serial.print(gps.time.hour());
    Serial.print(F(":"));
    if (gps.time.minute() < 10) Serial.print(F("0"));
    Serial.print(gps.time.minute());
    Serial.print(F(":"));
    if (gps.time.second() < 10) Serial.print(F("0"));
    Serial.print(gps.time.second());
    Serial.print(F("."));
    if (gps.time.centisecond() < 10) Serial.print(F("0"));
    Serial.print(gps.time.centisecond());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.println();
}

These are the current libraries using on this sketch:
tinyu-zhao/TinyGPSPlus-ESP32@^0.0.2
jdollar/SoftwareSerialEsp32@0.0.0-alpha+sha.6d373ecd5f


When pressing the reset button on the board, I get the following Serial:
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x39 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbd8
load:0x403cc700,len:0x2a80
entry 0x403c98d0
E (85) gpio: esp_ipc_call_blocking failed (0x103)
[ 85][E][esp32-hal-gpio.c:178] __attachInterruptFunctionalArg(): GPIO ISR Service Failed To Start
E (102) esp_core_dump_flash: Core dump data check failed:
Calculated checksum='f5fe2fa7'
Image checksum='ffffff��DeviceExample.ino
A simple demonstration of TinyGPSPlus with an attached GPS module
Testing TinyGPSPlus library v. 1.0.2
by Mikal Hart


Thankyou for the help :)

lbernstone
Posts: 829
Joined: Mon Jul 22, 2019 3:20 pm

Re: ESP32-S3 + GPS Module

Postby lbernstone » Wed Apr 17, 2024 7:25 am

Take out all the softwareSerial stuff. You are starting up Serial2 correctly. Take out the stuff where you are reading Serial2 at the beginning of loop(). Change the while to look something like this:

Code: Select all

  while (Serial2.available() > 0) {
    char nextbyte = Serial2.read();
    Serial.print(nextbyte);
    if (gps.encode(nextbyte) {
       Serial.println();
       displayInfo();
    }   
    ...
Note that some GPS devices may have binary transfer modes (which will look like garbage characters in your serial monitor), and there is some command that will switch it over to NMEA mode.

Who is online

Users browsing this forum: No registered users and 97 guests