void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
when i am using this code on the arduino uno it works normally and sends data. when it is used on the stm32 same connections nothing displays.
#include <NMEAGPS.h>
#define gpsPort Serial1
#define GPS_PORT_NAME "Serial1"
#define DEBUG_PORT Serial
int32_t Lat, Long;
static NMEAGPS gps; // This parses the GPS characters
void setup()
{
DEBUG_PORT.begin(115200);
while (!DEBUG_PORT);
DEBUG_PORT.println( F("Looking for GPS device on " GPS_PORT_NAME) );
DEBUG_PORT.flush();
gpsPort.begin(9600);
}
void loop(){
// DEBUG_PORT.println( F("Looking for GPS device on " GPS_PORT_NAME) );
while (gps.available(gpsPort)) {
gps_fix fix = gps.read();
if (fix.valid.location) {
DEBUG_PORT.print(fix.latitudeL());
DEBUG_PORT.print(", ");
DEBUG_PORT.println(fix.longitudeL());
//DEBUG_PORT.print( fix.speed_mph(), 2 );
}
}
}
this code works normally but refresh every second it is slow for my project i want to increase the refresh rate to 10hz.
b707
July 18, 2022, 5:59pm
3
The code has nothing to do with it. Module default sample rate is 1 Hz. For changing it you should to setup the module itself.
And the short look to the internet showed the maximum GPS sample rate for the module is 5 Hz
To change the refresh rate you can use the u-blox u-center software .
Here is a Sparkfun tutorial for using the u-center software.
ok i know how to do that my problem was that i was afraid that it wipes out when power off
b707
July 18, 2022, 6:11pm
6
do not afraid, just test it
system
Closed
January 14, 2023, 6:23pm
8
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.