I am using Boron with OS 3.1.0 (also tested with 4.0.2 and 5.3.0).
Starting from a blank project created in Workbench (that compiles fine) I add the ublox GPS libraries to the src folder and add the #include libraryname in the .ino, then I get the below error. Then, I delete the #include lines, so I’m back to a blank .ino file and it still gives the below error.
There are no folders in the chain that have any spaces.
The terminal process “C:\Users\astro.particle\toolchains\buildtools\1.1.1\bin\bash.exe ‘-c’, ‘make -f ‘C:\Users\astro.particle\toolchains\buildscripts\1.11.0\Makefile’ compile-user -s’” terminated with exit code: 2.
Press any key to close the terminal.
Below is the .ino code
//#include <Wire.h> //Needed for I2C to GNSS
//#include <SparkFun_u-blox_GNSS_v3.h> //http://librarymanager/All#SparkFun_u-blox_GNSS_v3
//SFE_UBLOX_GNSS myGNSS; // SFE_UBLOX_GNSS uses I2C. For Serial or SPI, see Example2 and Example3
// setup() runs once, when the device is first turned on.
void setup() {
// Put initialization like pinMode and begin functions here.
}
// loop() runs over and over again, as quickly as it can execute.
void loop() {
// The core of your code will likely live here.
}
I assume you are using the library from this Github.
Don’t copy the whole thing into the src directory. Instead, create a lib directory in the top of your project directory (same level as src) and copy the SparkFun_u-blox_GNSS_Arduino_Library-main directory into lib.
I was able to compile successfully with both cloud and local compilers.
Thanks Rick.
I am using the SparkFun_u-blox_GNSS_v3.h library, which is their latest and supports M10 series GPS modules from ublox.
I tried making the lib folder at the src level, and copying in the SparkFun_u-blox_GNSS_v3.h file into that, but I still get the same 'make[2]: *** […/…/…/build/recurse.mk:12: user] Error 2 ’ as before.
Let me know any other thoughts, thanks…
What directory do you have open in Workbench? Make sure you have the project directory, not the directory above the project directory, open. It should look like this:
I switched to that version of the library and it still builds for me both local and cloud after fixing an error. In sfe_bus.cpp, line 468, requires a cast:
Thanks, Rick, making the code change with the casting (char *) worked - I did not need to make any other changes to the environment or folders. Oddly, that error was just not listed in the terminal.
On another note - after successfully compiling the code in Device OS 5.3.0 and making no other code changes, I switched to Device OS 3.1.0 (which was already downloaded) and it took 5mins 47 secs to compile. I have a basic Windows 10 PC with a decent average I5 processor and 8 GB RAM. Is it typical for it to take that long just to switch device OS? Just wondering if there’s something sub-optimal about my setup.
Builds are very slow on Windows, especially the first build of Device OS. The problem is that it uses Cygwin to run gmake and gcc, and Cygwin is really slow launching processes, which it has to do many thousands of times, twice for each file. Also makes are sequential with no parallelism, so unfortunately that just makes it worse.
Linux and Mac are much, much faster. I’ve heard WSL on Windows is also faster, but I never tried it.
Particle BSoM, B404, Os version 5.0.1
SparkFun U-blox SAM-MQ8 Module via I2C
I am also trying to use this library, specifically the AssistNow_Autonomous example #1. I have taken all the steps you outlined above and everything compiles and flashes fin to my board, however the program keeps getting hung up after it calls
if(myGNSS.begin() == false) //Connect to the Ublox module using Wire port
{
Serial.println(F("u-blox GPS not detected at default I2C address. Please check wiring. Freezing."));
while(1);
}
I have double checked my I2C wiring connections and everything is looking good as far as hardware is concerned.
Here is my full ino file:
#include "Particle.h"
#include <Wire.h>
#include <Arduino.h>
#include <SparkFun_u-blox_GNSS_v3.h> //http://librarymanager/All#SparkFun_u-blox_GNSS_v3
#include "MCP23008-RK.h"
SFE_UBLOX_GNSS myGNSS;
MCP23008 gpio6(Wire, 6);
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Callback: printSATdata will be called when new NAV SAT data arrives
// See u-blox_structs.h for the full definition of UBX_NAV_SAT_data_t
// _____ You can use any name you like for the callback. Use the same name when you call setAutoNAVSATcallback
// / _____ This _must_ be UBX_NAV_SAT_data_t
// | / _____ You can use any name you like for the struct
// | | /
// | | |
void printSATdata(UBX_NAV_SAT_data_t *ubxDataStruct)
{
//Serial.println();
Serial.print(F("UBX-NAV-SAT contains data for "));
Serial.print(ubxDataStruct->header.numSvs);
if (ubxDataStruct->header.numSvs == 1)
Serial.println(F(" SV"));
else
Serial.println(F(" SVs"));
uint16_t numAopAvail = 0; // Count how many SVs have AssistNow Autonomous data available
for (uint16_t block = 0; block < ubxDataStruct->header.numSvs; block++) // For each SV
{
if (ubxDataStruct->blocks[block].flags.bits.aopAvail == 1) // If the aopAvail bit is set
numAopAvail++; // Increment the number of SVs
}
Serial.print(F("AssistNow Autonomous data is available for "));
Serial.print(numAopAvail);
if (numAopAvail == 1)
Serial.println(F(" SV"));
else
Serial.println(F(" SVs"));
}
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Callback: printAOPstatus will be called when new NAV AOPSTATUS data arrives
// See u-blox_structs.h for the full definition of UBX_NAV_AOPSTATUS_data_t
// _____ You can use any name you like for the callback. Use the same name when you call setAutoNAVAOPSTATUScallback
// / _____ This _must_ be UBX_NAV_AOPSTATUS_data_t
// | / _____ You can use any name you like for the struct
// | | /
// | | |
void printAOPstatus(UBX_NAV_AOPSTATUS_data_t *ubxDataStruct)
{
//Serial.println();
Serial.print(F("AOPSTATUS status is "));
Serial.println(ubxDataStruct->status);
}
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Callback: printPVTdata will be called when new NAV PVT data arrives
// See u-blox_structs.h for the full definition of UBX_NAV_PVT_data_t
// _____ You can use any name you like for the callback. Use the same name when you call setAutoPVTcallback
// / _____ This _must_ be UBX_NAV_PVT_data_t
// | / _____ You can use any name you like for the struct
// | | /
// | | |
void printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct)
{
// Print the UBX-NAV-PVT data so we can see how quickly the fixType goes to 3D
Serial.println();
long latitude = ubxDataStruct->lat; // Print the latitude
Serial.print(F("Lat: "));
Serial.print(latitude);
long longitude = ubxDataStruct->lon; // Print the longitude
Serial.print(F(" Long: "));
Serial.print(longitude);
Serial.print(F(" (degrees * 10^-7)"));
long altitude = ubxDataStruct->hMSL; // Print the height above mean sea level
Serial.print(F(" Alt: "));
Serial.print(altitude);
Serial.print(F(" (mm)"));
byte fixType = ubxDataStruct->fixType; // Print the fix type
Serial.print(F(" Fix: "));
if(fixType == 0) Serial.print(F("No fix"));
else if(fixType == 1) Serial.print(F("Dead reckoning"));
else if(fixType == 2) Serial.print(F("2D"));
else if(fixType == 3) Serial.print(F("3D"));
else if(fixType == 4) Serial.print(F("GNSS + Dead reckoning"));
else if(fixType == 5) Serial.print(F("Time only"));
Serial.println();
}
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void setup()
{
delay(1000);
Serial.begin(115200);
Serial.println(F("AssistNow Example"));
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Start I2C. Connect to the GNSS.
Wire.begin(); //Start I2C
// Disable the faulty Ublox GPS Module by pulling the reset pin low
gpio6.begin();
gpio6.pinMode(0,OUTPUT);
gpio6.digitalWrite(0,false);
myGNSS.enableDebugging(Serial, true); // Uncomment this line to see the 'major' debug messages on Serial
if(myGNSS.begin() == false) //Connect to the Ublox module using Wire port
{
Serial.println(F("u-blox GPS not detected at default I2C address. Please check wiring. Freezing."));
while(1);
}
Serial.println(F("Assuming u-blox module connected"));
myGNSS.setI2COutput(COM_TYPE_UBX); //Turn off NMEA noise
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Enable AssistNow Autonomous data collection.
if (myGNSS.setAopCfg(1) == true)
{
Serial.println(F("aopCfg enabled"));
}
else
{
Serial.println(F("Could not enable aopCfg. Please check wiring. Freezing."));
while (1);
}
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Enable automatic UBX-NAV-SAT and UBX-NAV-AOPSTATUS messages and set up the callbacks
myGNSS.setNavigationFrequency(1); //Produce one solution per second
myGNSS.setAutoNAVSATcallbackPtr(&printSATdata); // Enable automatic NAV SAT messages with callback to printSATdata
myGNSS.setAutoAOPSTATUScallbackPtr(&printAOPstatus); // Enable automatic NAV AOPSTATUS messages with callback to printAOPstatus
myGNSS.setAutoPVTcallbackPtr(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
}
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void loop()
{
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
Serial.print(".");
delay(50);
}
I just realized I am using the older SAM-MQ8 GPS module, and the read me of version3 states that I should be using Version2 of this library in this case. I will give that a shot and see what happens.