Skip to content

Commit 1b878c9

Browse files
authored
Merge pull request #7 from sparkfun/release_candidate
Updates for GNSSDO+
2 parents 842437e + 5d6eaad commit 1b878c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+281656
-241447
lines changed

.github/workflows/build-for-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ on:
55

66
env:
77
FILENAME_PREFIX: GNSSDO_Firmware
8-
FIRMWARE_VERSION_MAJOR: 1
9-
FIRMWARE_VERSION_MINOR: 5
8+
FIRMWARE_VERSION_MAJOR: 2
9+
FIRMWARE_VERSION_MINOR: 0
1010
CORE_VERSION: 3.0.7
1111

1212
jobs:

Firmware/GNSSDO_Firmware/Begin.ino

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,30 @@ void identifyBoard()
5858

5959
// Order the following ID checks, by millivolt values high to low
6060

61-
// GNSSDO: 1/1 --> 1571mV < 1650mV < 1729mV
61+
// GNSSDO: 1/1 --> 1564mV < 1650mV < 1736mV
6262
if (idWithAdc(idValue, 1, 1))
63-
productVariant = RTK_MOSAIC_T;
63+
productVariant = GNSSDO;
64+
65+
// GNSSDO+: 1/2.2 --> 2193mV < 2269mV < 2342mV
66+
else if (idWithAdc(idValue, 1, 2.2))
67+
productVariant = GNSSDO_PLUS;
6468

6569
else
6670
{
6771
systemPrintln("Out of band or nonexistent resistor IDs");
68-
productVariant = RTK_UNKNOWN;
72+
productVariant = GNSSDO_UNKNOWN;
6973
}
7074
}
7175

7276
void beginBoard()
7377
{
74-
if (productVariant == RTK_UNKNOWN)
78+
if (productVariant == GNSSDO_UNKNOWN)
7579
{
7680
reportFatalError("RTK Variant Unknown");
7781
}
7882

7983
// Setup hardware pins
80-
if (productVariant == RTK_MOSAIC_T)
84+
if (productVariant == GNSSDO || productVariant == GNSSDO_PLUS)
8185
{
8286
// ESP32-WROVER-IE Pin Allocations:
8387
// D0 : Boot + Boot Button
@@ -96,37 +100,32 @@ void beginBoard()
96100
// D19 : I2C SCL2 (SiT5358)
97101
// D21 : I2C SDA (OLED)
98102
// D22 : I2C SCL (OLED)
99-
// D23 : N/C
103+
// D23 : Serial TX Alt (mosaic-T COM3 RX)
100104
// D25 : Serial TX (mosaic-T COM4 RX)
101105
// D26 : Serial CTS (mosaic-T COM1 CTS)
102106
// D27 : Serial RTS (mosaic-T COM1 RTS)
103107
// D32 : Error LED
104108
// D33 : Lock LED
105-
// A34 : N/C
109+
// A34 : Serial RX Alt (mosaic-T COM3 TX)
106110
// A35 : Device Sense (resistor divider)
107111
// A36 : MRDY (mosaic-T module ready)
108112
// A39 : N/C
109113

110-
pin_errorLED = 32;
111-
pin_lockLED = 33;
112-
113-
pin_serial0TX_Alt = 23;
114-
pin_serial0RX_Alt = 34;
115-
pin_serial1TX = 14;
116-
pin_serial1RX = 13;
117-
pin_serial1CTS = 26;
118-
pin_serial1RTS = 27;
119-
120-
pin_serial2TX = 25;
114+
pin_setupButton = 0;
121115
pin_serial2RX = 4;
122-
123-
pin_SDA1 = 21;
124-
pin_SCL1 = 22;
125-
116+
pin_serial1RX = 13;
117+
pin_serial1TX = 14;
126118
pin_SDA2 = 18;
127119
pin_SCL2 = 19;
128-
129-
pin_setupButton = 0;
120+
pin_SDA1 = 21;
121+
pin_SCL1 = 22;
122+
pin_serial0TX_Alt = 23;
123+
pin_serial2TX = 25;
124+
pin_serial1CTS = 26;
125+
pin_serial1RTS = 27;
126+
pin_errorLED = 32;
127+
pin_lockLED = 33;
128+
pin_serial0RX_Alt = 34;
130129

131130
displayType = DISPLAY_128x64;
132131
}
@@ -287,7 +286,7 @@ void beginFS()
287286
// Set LEDs for output and configure PWM
288287
void beginLEDs()
289288
{
290-
if (productVariant == RTK_MOSAIC_T)
289+
if (productVariant == GNSSDO || productVariant == GNSSDO_PLUS)
291290
{
292291
pinMode(pin_errorLED, OUTPUT);
293292
pinMode(pin_lockLED, OUTPUT);
@@ -317,7 +316,7 @@ void beginSystemState()
317316
factoryReset(false); // We do not have the SD semaphore
318317
}
319318

320-
if (productVariant == RTK_MOSAIC_T)
319+
if (productVariant == GNSSDO || productVariant == GNSSDO_PLUS)
321320
{
322321
if (settings.lastState == STATE_NOT_SET) // Default after factory reset
323322
settings.lastState = STATE_GNSS_NOT_CONFIGURED;
@@ -515,8 +514,16 @@ void pinI2C2Task(void *pvParameters)
515514
void beginTCXO(TwoWire *i2cBus)
516515
{
517516
if (!i2cBus)
518-
reportFatalError("Illegal TCXO i2cBus");
519-
517+
{
518+
// No i2cBus for TCXO
519+
// There is some redundancy here. If online.tcxo is never set true,
520+
// the myTCXO-> methods are never called...
521+
myTCXO = new GNSSDO_TCXO();
522+
systemPrintln("Illegal TCXO i2cBus! TCXO / OCXO not found?");
523+
strncpy(oscillatorType, "NONE", sizeof(oscillatorType));
524+
return;
525+
}
526+
520527
// In order of priority: use STP3593LF or SiT5811 if present
521528
if (presentSTP3593LF)
522529
{
@@ -578,6 +585,10 @@ void beginTCXO(TwoWire *i2cBus)
578585
else
579586
{
580587
// No TCXO present!
588+
// There is some redundancy here. If online.tcxo is never set true,
589+
// the myTCXO-> methods are never called...
590+
myTCXO = new GNSSDO_TCXO();
591+
systemPrintln("TCXO / OCXO not found!");
581592
strncpy(oscillatorType, "NONE", sizeof(oscillatorType));
582593
return;
583594
}
@@ -622,6 +633,7 @@ int64_t getFrequencyControlWord()
622633
void updateTCXOClockBias()
623634
{
624635
tcxoClockBias_ms = gnssClockBias_ms; // Default to the PVTGeodetic RxClkBias
636+
tcxoClockDrift_ppm = gnssClockDrift_ppm;
625637
snprintf(rxClkBiasSource, sizeof(rxClkBiasSource), "PVT");
626638

627639
if (settings.preferNonCompositeGPSBias || settings.preferNonCompositeGalileoBias) // These are mutex
@@ -630,6 +642,7 @@ void updateTCXOClockBias()
630642
if (fugroTimeSystems[index].updated) // If we have the preferred non-composite bias, use that
631643
{
632644
tcxoClockBias_ms = fugroTimeSystems[index].RxClkBias_ms;
645+
tcxoClockDrift_ppm = fugroTimeSystems[index].RxClkDrift_ppm;
633646
fugroTimeSystems[index].updated = false;
634647
snprintf(rxClkBiasSource, sizeof(rxClkBiasSource), fugroTimeSystems[index].name);
635648
}

Firmware/GNSSDO_Firmware/GNSS.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ bool initializeGNSS()
180180

181181
// Restore default configuration
182182
// Note: the IP settings set by the setIPSettings and setIPPortSettings commands keep their value
183-
while (!sendWithResponse("eccf, RxDefault, Current\n\r", "CopyConfigFile") && (retries > 0))
183+
while (!sendWithResponse("eccf, RxDefault, Current\n\r", "CopyConfigFile", 5000) && (retries > 0))
184184
{
185185
systemPrintln("No response from mosaic. Retrying - with escape sequence...");
186186
sendWithResponse("SSSSSSSSSSSSSSSSSSSS\n\r", "COM4>"); // Send escape sequence
@@ -237,7 +237,7 @@ bool initializeGNSS()
237237
}
238238

239239
// Copy current configuration into boot
240-
if (!sendWithResponse("eccf, Current, Boot\n\r", "CopyConfigFile"))
240+
if (!sendWithResponse("eccf, Current, Boot\n\r", "CopyConfigFile", 5000))
241241
{
242242
systemPrintln("GNSS FAIL (CopyConfigFile)");
243243
return false;

Firmware/GNSSDO_Firmware/GNSSDO_Firmware.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ float gnssAltitude_m = 0.0;
140140
uint8_t gnssTimeSys = 255; // Unknown
141141
uint8_t gnssError = 255; // Unknown
142142
double gnssClockBias_ms = 0.0;
143+
float gnssClockDrift_ppm = 0.0;
143144

144145
// IPStatus 4058
145146
uint8_t ethernetMACAddress[6] = { 0,0,0,0,0,0 }; // Display this address in the system menu
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Class to contain all possible oscillators
2+
3+
// Begin the oscillator
4+
bool GNSSDO_TCXO::begin(TwoWire &wirePort, const uint8_t &address)
5+
{
6+
return true;
7+
}
8+
9+
// Get the frequency control word
10+
int64_t GNSSDO_TCXO::getFrequencyControlWord(void)
11+
{
12+
return settings.tcxoControl;
13+
}
14+
15+
// Set the frequency by bias millis
16+
bool GNSSDO_TCXO::setFrequencyByBiasMillis(double bias, double Pk, double Ik)
17+
{
18+
return true;
19+
}
20+
21+
// Save the frequency control word - if supported
22+
bool GNSSDO_TCXO::saveFrequencyControlValue(void)
23+
{
24+
return true;
25+
}
26+
27+
// Get the default P and I terms - for the default settings
28+
double GNSSDO_TCXO::getDefaultFrequencyByBiasPTerm(void)
29+
{
30+
return settings.Pk;
31+
}
32+
double GNSSDO_TCXO::getDefaultFrequencyByBiasITerm(void)
33+
{
34+
return settings.Ik;
35+
}

Firmware/GNSSDO_Firmware/Tasks.ino

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,11 @@ void processConsumerMessage(PARSE_STATE *parse, uint8_t type)
628628
uint64_t unsigned64;
629629
} dblUnsigned64;
630630

631+
union {
632+
float flt;
633+
uint32_t unsigned32;
634+
} fltUnsigned32;
635+
631636
dblUnsigned64.unsigned64 = 0;
632637
for (int i = 0; i < 8; i++)
633638
dblUnsigned64.unsigned64 |= ((uint64_t)parse->buffer[16 + i]) << (i * 8);
@@ -658,6 +663,15 @@ void processConsumerMessage(PARSE_STATE *parse, uint8_t type)
658663
if (gnssClockBias_ms > 999.999)
659664
gnssClockBias_ms = 999.999;
660665

666+
fltUnsigned32.unsigned32 = 0;
667+
for (int i = 0; i < 4; i++)
668+
fltUnsigned32.unsigned32 |= ((uint32_t)parse->buffer[68 + i]) << (i * 8);
669+
gnssClockDrift_ppm = fltUnsigned32.flt;
670+
if (gnssClockDrift_ppm < -999999.999)
671+
gnssClockDrift_ppm = -999999.999;
672+
if (gnssClockDrift_ppm > 999999.999)
673+
gnssClockDrift_ppm = 999999.999;
674+
661675
gnssTimeSys = parse->buffer[72];
662676
}
663677
else if ((parse->message & 0x1FFF) == 4058) // IPStatus
@@ -686,21 +700,35 @@ void processConsumerMessage(PARSE_STATE *parse, uint8_t type)
686700
uint8_t SysUsage = parse->buffer[20 + (b * SBLength) + 0];
687701
uint8_t TimeSystem = parse->buffer[20 + (b * SBLength) + 2];
688702

703+
// Convert uint64_t to double
689704
union {
690705
double dbl;
691706
uint64_t unsigned64;
692707
} dblUnsigned64;
693708

709+
// Extract RxClkBias_ms
694710
dblUnsigned64.unsigned64 = 0;
695711
for (int i = 0; i < 8; i++)
696712
dblUnsigned64.unsigned64 |= ((uint64_t)parse->buffer[20 + (b * SBLength) + 4 + i]) << (i * 8);
697713

714+
// Convert uint32_t to float
715+
union {
716+
float flt;
717+
uint32_t unsigned32;
718+
} fltUnsigned32;
719+
720+
// Extract RxClkDrift_ppm
721+
fltUnsigned32.unsigned32 = 0;
722+
for (int i = 0; i < 4; i++)
723+
fltUnsigned32.unsigned32 |= ((uint32_t)parse->buffer[20 + (b * SBLength) + 12 + i]) << (i * 8);
724+
698725
// If this block contains a non-composite clock indicator, store it
699726
for (int TS = 0; TS < NUM_FUGRO_CLK_BIASES; TS++)
700727
{
701728
if (fugroTimeSystems[TS].SysUsage == SysUsage)
702729
{
703730
fugroTimeSystems[TS].RxClkBias_ms = dblUnsigned64.dbl;
731+
fugroTimeSystems[TS].RxClkDrift_ppm = fltUnsigned32.flt;
704732
fugroTimeSystems[TS].updated = true;
705733
break;
706734
}
@@ -718,7 +746,7 @@ void ButtonCheckTask(void *e)
718746

719747
while (true)
720748
{
721-
if (productVariant == RTK_MOSAIC_T)
749+
if (productVariant == GNSSDO || productVariant == GNSSDO_PLUS)
722750
{
723751
if (setupBtn &&
724752
(settings.disableSetupButton == false)) // Allow check of the setup button if not overridden by settings

Firmware/GNSSDO_Firmware/menuSystem.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ void printCurrentConditions(bool CSV)
584584
{
585585
if (firstTime)
586586
{
587-
systemPrintln("YYYY/MM/DD,HH:MM:SS,Epoch,Lat,Lon,Alt,TimeSys,Error,Fine,PPS,Bias,Source,TCXO,Pk,Ik");
587+
systemPrintln("YYYY/MM/DD,HH:MM:SS,Epoch,Lat,Lon,Alt,TimeSys,Error,Fine,PPS,Bias,Drift,Source,TCXO,Pk,Ik");
588588
firstTime = false;
589589
}
590590

@@ -620,6 +620,8 @@ void printCurrentConditions(bool CSV)
620620

621621
systemPrintf(",%.3e", tcxoClockBias_ms / 1000.0); // Display clock bias in seconds
622622

623+
systemPrintf(",%.3e", tcxoClockDrift_ppm / 1000000.0); // Display clock drift in parts
624+
623625
systemPrint(",");
624626
systemPrint((const char *)rxClkBiasSource),
625627

@@ -669,6 +671,8 @@ void printCurrentConditions(bool CSV)
669671
systemPrintf(", Bias: %.3fns",
670672
(float)(tcxoClockBias_ms * 1000000.0));
671673

674+
systemPrintf(", Drift: %.3e", tcxoClockDrift_ppm / 1000000.0);
675+
672676
systemPrint(", Source: ");
673677
systemPrint((const char *)rxClkBiasSource),
674678

Firmware/GNSSDO_Firmware/settings.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,32 @@ bool newSystemStateRequested = false;
2323

2424
typedef enum
2525
{
26-
RTK_MOSAIC_T = 0,
26+
GNSSDO = 0,
27+
GNSSDO_PLUS,
2728
// Add new values just above this line
28-
RTK_UNKNOWN,
29+
GNSSDO_UNKNOWN,
2930
} ProductVariant;
30-
ProductVariant productVariant = RTK_UNKNOWN;
31+
ProductVariant productVariant = GNSSDO_UNKNOWN;
3132

3233
const char *const productDisplayNames[] = {
3334
"GNSSDO",
35+
"GNSSDO+",
3436
// Add new values just above this line
3537
"Unknown",
3638
};
3739
const int productDisplayNamesEntries = sizeof(productDisplayNames) / sizeof(productDisplayNames[0]);
3840

3941
const char *const platformFilePrefixTable[] = {
4042
"SFE_GNSSDO",
43+
"SFE_GNSSDO_PLUS",
4144
// Add new values just above this line
4245
"SFE_Unknown",
4346
};
4447
const int platformFilePrefixTableEntries = sizeof(platformFilePrefixTable) / sizeof(platformFilePrefixTable[0]);
4548

4649
const char *const platformPrefixTable[] = {
4750
"GNSSDO",
51+
"GNSSDO_PLUS",
4852
// Add new values just above this line
4953
"Unknown",
5054
};
@@ -80,6 +84,7 @@ typedef struct {
8084
const uint8_t SysUsage;
8185
const char name[8];
8286
double RxClkBias_ms;
87+
float RxClkDrift_ppm;
8388
bool updated;
8489
} fugroTimeSystem;
8590

@@ -127,6 +132,7 @@ uint8_t mosaicTimeSystemIndexFromName(const char *name)
127132
return 0; // This should never happen
128133
}
129134
double tcxoClockBias_ms; // Updated by updateTCXOClockBias
135+
float tcxoClockDrift_ppm;
130136
char rxClkBiasSource[8];
131137

132138
const char *const mosaicPVTErrorTable[] = {

Firmware/GNSSDO_Firmware/support.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,11 +689,11 @@ bool findSpiffsPartition(void)
689689
void verifyTables()
690690
{
691691
// Verify the product name table
692-
if (productDisplayNamesEntries != (RTK_UNKNOWN + 1))
692+
if (productDisplayNamesEntries != (GNSSDO_UNKNOWN + 1))
693693
reportFatalError("Fix productDisplayNames to match ProductVariant");
694-
if (platformFilePrefixTableEntries != (RTK_UNKNOWN + 1))
694+
if (platformFilePrefixTableEntries != (GNSSDO_UNKNOWN + 1))
695695
reportFatalError("Fix platformFilePrefixTable to match ProductVariant");
696-
if (platformPrefixTableEntries != (RTK_UNKNOWN + 1))
696+
if (platformPrefixTableEntries != (GNSSDO_UNKNOWN + 1))
697697
reportFatalError("Fix platformPrefixTable to match ProductVariant");
698698

699699
tasksValidateTables();

0 commit comments

Comments
 (0)