運営の方のご指摘のとおり、情報不足のため回答になっているかどうか分かりませんが、SPRESENSEでGPSのホットスタートを試したことがあるので、そのコードを掲載します。私もGPSに詳しいわけではないので、コードの内容については保証できません。やってみたらできた程度の内容なので、ご参考程度にしてください。
#include <GPS.h>
#include <LowPower.h>
#include <RTC.h>
static SpGnss Gnss;
void setup() {
int resut;
Serial.begin(115200);
RTC.begin();
LowPower.begin();
LowPower.clockMode(CLOCK_MODE_32MHz);
bootcause_e bc = LowPower.bootCause(); /* get boot cause */
sleep(3);
Gnss.begin();
Gnss.select(GPS);
Gnss.select(GLONASS);
Gnss.select(QZ_L1CA);
Gnss.select(QZ_L1S);
if ((bc == POR_SUPPLY) || (bc == POR_NORMAL)) {
Serial.println("Power on reset");
Gnss.start(COLD_START);
} else {
Serial.println("Wakeup from deep sleep");
RtcTime now = RTC.getTime();
// Print the current clock
printf("%04d/%02d/%02d %02d:%02d:%02d\n",
now.year(), now.month(), now.day(),
now.hour(), now.minute(), now.second());
SpGnssTime gnss_time;
gnss_time.year = now.year();
gnss_time.month = now.month();
gnss_time.day = now.day();
gnss_time.hour = now.hour();
gnss_time.minute = now.minute();
gnss_time.sec = now.second();
gnss_time.usec = now.nsec() / 1000;
Gnss.setTime(&gnss_time);
Gnss.start(HOT_START);
}
}
void loop() {
if (!Gnss.waitUpdate(-1)) return;
SpNavData NavData;
Gnss.getNavData(&NavData);
/* print satellites count */
Serial.print("numSat: " + String(NavData.numSatellites) + " ");
/* update RTC time */
RtcTime gps_time(NavData.time.year
, NavData.time.month
, NavData.time.day
, NavData.time.hour
, NavData.time.minute
, NavData.time.sec
, NavData.time.usec * 1000 /* RtcTime requires nsec */);
Serial.print(String(gps_time.year()) + "/"
+ String(gps_time.month()) + "/"
+ String(gps_time.day()) + " "
+ String(gps_time.hour()) + ":"
+ String(gps_time.minute()) + ":"
+ String(gps_time.second()) + " ");
/* When time is different more than 1 sec, update RTC time */
if (abs(RTC.getTime() - gps_time) >= 1) {
RTC.setTime(gps_time);
Serial.print(" * Updated RTC time * ");
}
/* print position data */
if (NavData.posFixMode == FixInvalid && NavData.posDataExist == 0) {
Serial.print("No Position");
} else {
static int g_loop = 0;
Serial.print("Lat=" + String(NavData.latitude, 6));
Serial.print(", Lon=" + String(NavData.longitude, 6));
unsigned long passed_time;
Serial.println("");
passed_time = millis();
Serial.println("POSITION FIXED TIME: " + String(passed_time));
if (g_loop > 10) {
// Go to deep sleep for 60 seconds
Gnss.saveEphemeris();
Gnss.stop();
Gnss.end();
passed_time = millis();
Serial.println("Go to deep sleep... " + String(passed_time));
LowPower.deepSleep(60);
}
++g_loop;
}
Serial.println("");
}