SAMD21 + u-blox + Sparkfun GPS lib

Does anyone know whether the Sparfun GPS library even works like that on SAMD21? I can't get this minimal program to work. No GPS time is displayed. If I use a Tinygps ++ it works fine on SAMD.


#include "SparkFun_u-blox_GNSS_Arduino_Library.h"
#include "wiring_private.h"

#define SerialCon Serial1
#define SerialGPS Serial2

SFE_UBLOX_GNSS myGNSS;

long lastTime = 0;

//------------------------------------------------------------------------------
Uart SerialGPS(&sercom2, 3, 4, SERCOM_RX_PAD_1, UART_TX_PAD_0);

void SERCOM2_Handler()
{
  SerialGPS.IrqHandler();
}

//------------------------------------------------------------------------------
void setup()
{
  SerialCon.begin(115200);
  while (!SerialCon);
  SerialCon.println();
  SerialCon.println("Start..");

  SerialGPS.begin(9600);
  pinPeripheral(3, PIO_SERCOM_ALT);
  pinPeripheral(4, PIO_SERCOM_ALT);


  SerialCon.print("GPS u-blox init.. ");
  if (myGNSS.begin(SerialGPS))
  {
    SerialCon.println("OK!");
  }
  else
  {
    SerialCon.println("FAIL!");
  }

/*  
  SerialCon.print("GPS u-blox set PVT.. ");
  if (myGNSS.setAutoPVT(true)) 
  {
    SerialCon.println("OK!");
  }
  else
  {
    SerialCon.println("FAIL!");
  }
*/
  
  myGNSS.setUART1Output(COM_TYPE_UBX); //Set the UART port to output UBX only
  //myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
  myGNSS.saveConfiguration(); //Save the current settings to flash and BBR
}

//------------------------------------------------------------------------------
void loop() 
{
  if (millis() - lastTime > 1000)
  {
    lastTime = millis(); //Update the timer

    if (myGNSS.getDateValid())
    {
      SerialCon.print(myGNSS.getYear());
      SerialCon.print("-");
      SerialCon.print(myGNSS.getMonth());
      SerialCon.print("-");
      SerialCon.print(myGNSS.getDay());
      SerialCon.print(" ");
    }

    if (myGNSS.getTimeValid())
    {
      SerialCon.print(myGNSS.getHour());
      SerialCon.print(":");
      SerialCon.print(myGNSS.getMinute());
      SerialCon.print(":");
      SerialCon.print(myGNSS.getSecond());
    }
  }
}

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.