GNSS module problem, no working code available

The code included in the wiki is full of errors and wont even compile, does anyone have a working solution?

#include <TinyGPSPlus.h>
#include <SoftwareSerial.h>
/*
This sample sketch demonstrates how to use L76K GNSS Module on SeeedStudio XIAO.
*/
static const int RXPin = D7, TXPin = D6;
static const uint32_t GPSBaud = 9600;

// The TinyGPSPlus object
TinyGPSPlus gps;

// The serial connection to the GNSS module
SoftwareSerial ss(RXPin, TXPin);

void setup() {
Serial.begin(115200);
#ifdef ARDUINO_SEEED_XIAO_RP2040
pinMode(D10,OUTPUT);
digitalWrite(D10,1);
pinMode(D0,OUTPUT);
digitalWrite(D0,1);
#endif
ss.begin(GPSBaud);

Serial.println(F(“DeviceExample.ino”));
Serial.println(F(“A simple demonstration of TinyGPSPlus with L76K GNSS Module”));
Serial.print(F("Testing TinyGPSPlus library v. "));
Serial.println(TinyGPSPlus::libraryVersion());
Serial.println(F(“by Mikal Hart”));
Serial.println();
}

void loop() {
// This sketch displays information every time a new sentence is correctly encoded.
while (ss.available() > 0)
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();
}

which XIAO are you using? some are software seral and some hardware serial

did you install the tinygpsplus library?

Esp32c3

Yes i installed the tinygpsplus library

static const int RXPin = 7, TXPin = 6;

try remove the D and just use the number

Try TinyGPSPlus → Kitchen Sink Sketch… I got them to work with a little modifications

Make sure the module is installed on the XIAO the correct way and not reversed… Power and Ground Pins matching… GPS antenna opposite USB

But the supplied sketch wont even compile.
I will try the kitchen sink sketch

What compile errors

Make sure you have XIAO ESP32C3 as Board selected!

Its for sure hooked up correctly.

Board installed, programmed many for other uses.

Software serial errors

what errors can you cut and paste

Hi there,

SO ease up on the caffeine , take a deep breath and HUM, this will work to yourself 3 times. PLEASE edit your post and use the code tags above "</> " paste it in there.

Initially you :index_pointing_at_the_viewer: loaded the WRONG BSP’s for the sketch and the versions of the LIBs used , What BSP did you use ?
Probably the latest one NO? Do you know? (loud Gong)

Please don’t pass Go , and do NOT collect $200 dollars .
Start from the beginning and load the proper BSP? which one that is , I won’t say to spoil the fun of your discovery… Read the wiki and some threads on here , You will gain the knowledge necessary to be a Xiao master!

HTH
GL :slight_smile: PJ :v:

1 Like

The fun of discovering is why we are so good at what we do…

tried kitchen sink and get this error

c:\Users\Rb\Documents\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:41:10: fatal error: avr/interrupt.h: No such file or directory
41 | #include <avr/interrupt.h>
| ^~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1

something is not setup right on your end

I do not disagree. I followed examples perfectly.

“Initially you :index_pointing_at_the_viewer: loaded the WRONG BSP’s for the sketch and the versions of the LIBs used , What BSP did you use ?
Probably the latest one NO? Do you know? (loud Gong)”

Please dont use shorthand, acronyms, or slang to try and help. I have no idea what a LIBs is or a BSP, every forum has a different slang for different things and all that does is create confusion. I followed the wiki 100% to the T, and skipped nothing. I ran the code given and it doesnt compile. I came here for help, since it did not work. I have used hundreds of xiaos, but never on this.

Hi there,

Ah’ I see, I didn’t know this was your first Day :face_with_hand_over_mouth:Please help yourself to the WiKi it will give you some idea of what to do.
The BSP is the “Board Support Package”
The “LiB” is the LIBRARY you use.
HTH
GL :slight_smile: PJ :v:

correct board support package
correct library
followed the wiki 100%, by all means try it yourself, maybe im doing something wrong(very likely), but I do not see it. I am no expert by any stretch, but am familiar with xiao projects…all worked fine by following the wiki except this one.

Hi there,

Can you provide the Compiler output you get? The first 3 lines and the last 10-12 before it uploads.
Use the code tags above “</>” and paste it in there.
curious, Do you know which BSP you are compiling with?
HTH
GL :slight_smile: PJ :v:

Hi there,

So this error , is very common one.
are you using an AVR, I don’t think So … So there’s That!

GL :slight_smile: PJ :v:

I am using esp32c3.
I have no idea why avr is coming up or how to get rid of it.

Hi there,

I know, You don’t it’s the Wrong LIB loading… hence the error.
Can you answer the Q’s and provide the output ?
start with the first 3 lines. then.

GL :slight_smile: PJ :v: