SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions about carrier boards have here!
I'm trying to use the above breakout board ( part # GPS-17285, with GPS-14986 antenna) to sample location data. I would like to get at least 10 data points per second, as this will be mounted in a race car travelling up to 100 MPH. I have attached the I2C bus on a Teensy 4.1 (Cortex M7 at 600 Mhz) to the Qwiic connector.

I've tried MANY different setup configurations, but none seem to be able to sample quickly. I put code in to toggle an I/O pin I can watch on my oscilloscope. When I first power up it takes 500mS to get the Latitude and Longitude, but after a few seconds this expands to 2.25 seconds.

Also, every time I change code I have to power cycle the board after uploading. Otherwise, the new code does not seem to change the configuration of the u-blox.

My code is below - can anyone see what I'm missing?


Code: Select all
#include <Wire.h>         // For I2C
#include <SparkFun_u-blox_GNSS_v3.h>

// Pins for checking timing with the oscilloscope
#define PULSE_PIN 34
#define PULSE_PIN2 35

#define BAUDRATE 115200

// GPS/GNSS globals for NEO-M9N

volatile float Latitude = 1.1;
volatile float Longitude = -1.1;

// Initialize everything
void setup( void )
  Serial.begin( BAUDRATE );

  // Set the Pulse Pins (used to measure timing with an oscilloscope) to output
  pinMode( PULSE_PIN, OUTPUT );
  pinMode( PULSE_PIN2, OUTPUT );
  digitalWrite( PULSE_PIN, LOW );
  digitalWrite( PULSE_PIN2, LOW );

  Wire2.setClock( 400000 );    // Set I2C clock speed

  Serial.println( "Wire2 Initialized" );

    // Set up GNSS for location, velocity, etc.
    while( theGNSS.begin( Wire2 ) == false ) //Connect to the u-blox module using Wire port
      Serial.println( F("u-blox GNSS not detected at default I2C address. Retrying...") );
      delay( 1000 );
    Serial.println( "GNSS Up, " );

    // Reset to factory default to clear any old test setups, auto messages, etc.
    theGNSS.factoryDefault(); delay(5000);
    theGNSS.setI2COutput( COM_TYPE_UBX ); //Set the I2C port to output UBX only (turn off NMEA noise)
    theGNSS.saveConfigSelective( VAL_CFG_SUBSEC_IOPORT ); //Save (only) the communications port settings to flash and BBR
    // Turn off all but GPS - should help speed up samples
    theGNSS.enableGNSS(true, SFE_UBLOX_GNSS_ID_GPS); // Make sure GPS is enabled (we must leave at least one major GNSS enabled!)
    theGNSS.enableGNSS(false, SFE_UBLOX_GNSS_ID_SBAS); // Disable SBAS
    theGNSS.enableGNSS(false, SFE_UBLOX_GNSS_ID_GALILEO); // Disable Galileo
    theGNSS.enableGNSS(false, SFE_UBLOX_GNSS_ID_BEIDOU); // Disable BeiDou
    theGNSS.enableGNSS(false, SFE_UBLOX_GNSS_ID_IMES); // Disable IMES
    theGNSS.enableGNSS(false, SFE_UBLOX_GNSS_ID_QZSS); // Disable QZSS
    theGNSS.enableGNSS(false, SFE_UBLOX_GNSS_ID_GLONASS); // Disable GLONASS

    theGNSS.setNavigationFrequency( 10 ); // Produce 10 solutions per second
    //theGNSS.setAutoPVT( true ); // Tell the GNSS to output each solution periodically
    theGNSS.saveConfiguration();  // Save current settings to Flash and Battery Backed RAM

  delay( 3000 );
  Serial.println( "GNSS Initialized" );
void loop(void)
  char buf[ 16 ];

  Serial.println( "Top of Loop" );
  digitalWrite( PULSE_PIN2, HIGH );
  digitalWrite( PULSE_PIN, HIGH );
      // Get the latitude and longitude
      long latit = theGNSS.getLatitude(  );
      long longi = theGNSS.getLongitude();
      Latitude = latit / 10000000.0;
      Longitude = longi / 10000000.0;

  digitalWrite( PULSE_PIN, LOW );
  digitalWrite( PULSE_PIN2, LOW );

  sprintf( buf,  "%3.6f", Latitude );
  Serial.print( buf );
  Serial.print( ", " );
  sprintf( buf,  "%3.6f", Longitude );
  Serial.println( buf );

  delay( 500 );
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum