"Internal" GPS (on notecard) not working

Hi, no luck in acquiring (internal) GPS sentences on the Cell/Wifi Notecard (with Iridium card). I’ve modeled the firmware using acquireGPSLocation() source code from one of your examples. Here are my code snippetts ..

req = NoteNewRequest("card.transport");
JAddStringToObject(req, "method", "cell");
req = NoteNewRequest("hub.set");
JAddStringToObject(req, "mode", "periodic");
JAddStringToObject(req, "product", productUID);
JAddIntToObject(req, "outbound",120);
JAddIntToObject(req, "inbound", 240);

Loop until 'synced'
  NoteNewRequest("hub.sync");

Loop until "hub.status" is "connected"    NoteRequestResponse(NoteNewRequest("hub.status"));

Loop FOREVER …

req = NoteNewRequest("card.location.mode");
  JAddStringToObject(req, "mode", "off");

NoteRequestResponse(NoteNewRequest("card.location"));
  gps_time_s = JGetInt(rsp, "time");

NoteNewRequest("card.location.mode");
  JAddStringToObject(req, "mode", "continuous");

Loop until 'gps time-out' OR gps-time change(indicating a new FIX). ("gps-timeout" set at 320 seconds.)

 rsp = NoteRequestResponse(NoteNewRequest("card.location"));
   Get time from JGetInt(rsp, "time");
   Get status from JGetString(rsp, "status") !!! NOTE that status always returns
   "GPS waiting to start {gps-starting}{gps-active}"

NOTE that after a 'cold' start, I am able to acquire one (and only one) valid    GPS 'location' update.

Delay 3 seconds

Thx, Rich ..



Hi @richf,

I think there are a few things going on here:

Once a Notecard has been paired with a Starnote, the Starnote’s GNSS module permanently becomes the location source and the Notecard will not fall back (and setting card.transport to cell doesn’t change that, that’s just the transport method).

Loop until 'synced'
  NoteNewRequest("hub.sync");

:backhand_index_pointing_up: This may be a typo, but you are telling Notecard to sync repeatedly here and not actually waiting on a response.

Your "GPS waiting to start {gps-starting}{gps-active}" means GPS was enabled but zero NMEA sentences ever arrived, basically the Starnote’s GNSS isn’t producing data. On Starnote for Iridium, the single u.FL antenna carries both the satellite link and GPS, so please confirm it’s attached and has a clear view of the sky.

I would also strongly recommend updating to the latest versions of Notecard and Starnote firmware, as we have fixed a couple of GPS-related issues recently.

Hope that helps!
Rob

Hi Rob, Thx a lot for the quick response. Regarding the ‘hub.sync’ call – below is the loop - I’ll update the firmware as suggested – is the Iridium firmware update procedure similar to how the Notecard is updated?

regards, Rich ..

success = false;
do
{
	req = NoteNewRequest("hub.sync");
	rsp = NoteRequestResponse(req);
	if (NoteResponseError(rsp))
	{
		dbgPrintf("hub.sync failed\r\n");
	}
	else
	{
		dbgPrintf("hub.sync success\r\n");
		success = true;
	}
	NoteDeleteResponse(rsp);
	delay_s(3);
} while (success == false);

Hi @richf,

The hub.sync command is fire-and-forget - so you’re retrying a sync until the request itself is accepted by the Notecard (it’s not waiting for a sync).

A better way forward is to poll hub.sync.status. Here is some AI-generated code that looks like it should work (disclaimer that I didn’t actually test it myself!)

// Initiate a sync and wait for the Notecard to report it finished.
// Returns true only when the sync completed with nothing left pending.
static bool syncAndWait(uint32_t timeoutSecs)
{
    // Fire-and-forget: a clean response only means the request was accepted.
    if (!NoteRequest(NoteNewRequest("hub.sync"))) {
        dbgPrintf("hub.sync request rejected\r\n");
        return false;
    }

    for (uint32_t elapsed = 0; elapsed < timeoutSecs; elapsed += 3) {
        delay_s(3);

        J *rsp = NoteRequestResponse(NoteNewRequest("hub.sync.status"));
        if (rsp == NULL) {
            continue;   // transaction failed; just poll again
        }

        bool inFlight  = JIsPresent(rsp, "requested");
        bool completed = JIsPresent(rsp, "completed");
        bool alert     = JGetBool(rsp, "alert");
        bool pending   = JGetBool(rsp, "sync");   // unsynced Notes remain
        dbgPrintf("sync: %s\r\n", JGetString(rsp, "status"));
        NoteDeleteResponse(rsp);                  // status string dies here

        if (inFlight) {
            continue;
        }
        if (completed) {
            if (alert) {
                dbgPrintf("sync completed with an error\r\n");
                return false;
            }
            return !pending;
        }
    }

    dbgPrintf("sync timed out\r\n");
    return false;
}