Skip to content

Error in connecting in serial mode #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
a-3isa opened this issue May 31, 2024 · 2 comments
Closed

Error in connecting in serial mode #57

a-3isa opened this issue May 31, 2024 · 2 comments

Comments

@a-3isa
Copy link

a-3isa commented May 31, 2024

i am getting this
1

when i am try to connect to gps02-ubx using esp32c3

`#include "HardwareSerial.h"
#include <SparkFun_u-blox_GNSS_v3.h> //http://librarymanager/All#SparkFun_u-blox_GNSS_v3
SFE_UBLOX_GNSS myGNSS;

HardwareSerial mySerial(1);

long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.

struct gps_readings {
long lat, lon, alt;
};

void gps_init() {
Serial.println("GPS initializing....");

do {
Serial.println("GNSS: trying 38400 baud");

mySerial.begin(38400, SERIAL_8N1, RX1_PIN, TX1_PIN);

myGNSS.enableDebugging();  // Uncomment this line to enable helpful debug messages on Serial
myGNSS.connectedToUART2();  // This tells the library we are connecting to UART2 so it uses the correct configuration keys

if (myGNSS.begin(mySerial) == true) break;

delay(100);
Serial.println("GNSS: trying 9600 baud");
mySerial.begin(9600, SERIAL_8N1, RX1_PIN, TX1_PIN);
if (myGNSS.begin(mySerial) == true) {
  Serial.println("GNSS: connected at 9600 baud, switching to 38400");
  myGNSS.setSerialRate(38400);
  delay(100);
} else {
  //myGNSS.factoryDefault();
  delay(2000);  //Wait a bit before trying again to limit the Serial output
}

} while (1);
// Serial.println("GNSS serial connected");
Serial.println("The GPS is successfully initialized.");
Serial.println("================================================");

myGNSS.setUART1Output(COM_TYPE_UBX); //Set the UART port to output UBX only
myGNSS.saveConfiguration(); //Save the current settings to flash and BBR
}
`

@PaulZC
Copy link
Collaborator

PaulZC commented Jun 3, 2024

Hi @a-3isa ,

In your code, you are trying to use Serial to communicate with the gps02-ubx module on UART2 (myGNSS.connectedToUART2();). But I think the gps02-ubx module does not provide access to UART2, only UART1?

In your screenshot, I think you are using I2C to communicate with the gps02-ubx module? This does not match your code.

To help you further, we need to see a schematic and a photo of how you have connected the gps02-ubx module to the ESP32.

Best wishes,
Paul

@PaulZC
Copy link
Collaborator

PaulZC commented Jun 5, 2024

Closing... Please reopen if you need more help with this.

@PaulZC PaulZC closed this as completed Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants