Skip to content

Commit bde9a8b

Browse files
committed
Add support for GNSSDO+. Add support for no TCXO
1 parent d877959 commit bde9a8b

File tree

5 files changed

+85
-35
lines changed

5 files changed

+85
-35
lines changed

Firmware/GNSSDO_Firmware/Begin.ino

Lines changed: 39 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
}
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ void ButtonCheckTask(void *e)
718718

719719
while (true)
720720
{
721-
if (productVariant == RTK_MOSAIC_T)
721+
if (productVariant == GNSSDO || productVariant == GNSSDO_PLUS)
722722
{
723723
if (setupBtn &&
724724
(settings.disableSetupButton == false)) // Allow check of the setup button if not overridden by settings

Firmware/GNSSDO_Firmware/settings.h

Lines changed: 7 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
};

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)