Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-for-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:

env:
FILENAME_PREFIX: GNSSDO_Firmware
FIRMWARE_VERSION_MAJOR: 1
FIRMWARE_VERSION_MINOR: 5
FIRMWARE_VERSION_MAJOR: 2
FIRMWARE_VERSION_MINOR: 0
CORE_VERSION: 3.0.7

jobs:
Expand Down
69 changes: 41 additions & 28 deletions Firmware/GNSSDO_Firmware/Begin.ino
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,30 @@ void identifyBoard()

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

// GNSSDO: 1/1 --> 1571mV < 1650mV < 1729mV
// GNSSDO: 1/1 --> 1564mV < 1650mV < 1736mV
if (idWithAdc(idValue, 1, 1))
productVariant = RTK_MOSAIC_T;
productVariant = GNSSDO;

// GNSSDO+: 1/2.2 --> 2193mV < 2269mV < 2342mV
else if (idWithAdc(idValue, 1, 2.2))
productVariant = GNSSDO_PLUS;

else
{
systemPrintln("Out of band or nonexistent resistor IDs");
productVariant = RTK_UNKNOWN;
productVariant = GNSSDO_UNKNOWN;
}
}

void beginBoard()
{
if (productVariant == RTK_UNKNOWN)
if (productVariant == GNSSDO_UNKNOWN)
{
reportFatalError("RTK Variant Unknown");
}

// Setup hardware pins
if (productVariant == RTK_MOSAIC_T)
if (productVariant == GNSSDO || productVariant == GNSSDO_PLUS)
{
// ESP32-WROVER-IE Pin Allocations:
// D0 : Boot + Boot Button
Expand All @@ -96,37 +100,32 @@ void beginBoard()
// D19 : I2C SCL2 (SiT5358)
// D21 : I2C SDA (OLED)
// D22 : I2C SCL (OLED)
// D23 : N/C
// D23 : Serial TX Alt (mosaic-T COM3 RX)
// D25 : Serial TX (mosaic-T COM4 RX)
// D26 : Serial CTS (mosaic-T COM1 CTS)
// D27 : Serial RTS (mosaic-T COM1 RTS)
// D32 : Error LED
// D33 : Lock LED
// A34 : N/C
// A34 : Serial RX Alt (mosaic-T COM3 TX)
// A35 : Device Sense (resistor divider)
// A36 : MRDY (mosaic-T module ready)
// A39 : N/C

pin_errorLED = 32;
pin_lockLED = 33;

pin_serial0TX_Alt = 23;
pin_serial0RX_Alt = 34;
pin_serial1TX = 14;
pin_serial1RX = 13;
pin_serial1CTS = 26;
pin_serial1RTS = 27;

pin_serial2TX = 25;
pin_setupButton = 0;
pin_serial2RX = 4;

pin_SDA1 = 21;
pin_SCL1 = 22;

pin_serial1RX = 13;
pin_serial1TX = 14;
pin_SDA2 = 18;
pin_SCL2 = 19;

pin_setupButton = 0;
pin_SDA1 = 21;
pin_SCL1 = 22;
pin_serial0TX_Alt = 23;
pin_serial2TX = 25;
pin_serial1CTS = 26;
pin_serial1RTS = 27;
pin_errorLED = 32;
pin_lockLED = 33;
pin_serial0RX_Alt = 34;

displayType = DISPLAY_128x64;
}
Expand Down Expand Up @@ -287,7 +286,7 @@ void beginFS()
// Set LEDs for output and configure PWM
void beginLEDs()
{
if (productVariant == RTK_MOSAIC_T)
if (productVariant == GNSSDO || productVariant == GNSSDO_PLUS)
{
pinMode(pin_errorLED, OUTPUT);
pinMode(pin_lockLED, OUTPUT);
Expand Down Expand Up @@ -317,7 +316,7 @@ void beginSystemState()
factoryReset(false); // We do not have the SD semaphore
}

if (productVariant == RTK_MOSAIC_T)
if (productVariant == GNSSDO || productVariant == GNSSDO_PLUS)
{
if (settings.lastState == STATE_NOT_SET) // Default after factory reset
settings.lastState = STATE_GNSS_NOT_CONFIGURED;
Expand Down Expand Up @@ -515,8 +514,16 @@ void pinI2C2Task(void *pvParameters)
void beginTCXO(TwoWire *i2cBus)
{
if (!i2cBus)
reportFatalError("Illegal TCXO i2cBus");

{
// No i2cBus for TCXO
// There is some redundancy here. If online.tcxo is never set true,
// the myTCXO-> methods are never called...
myTCXO = new GNSSDO_TCXO();
systemPrintln("Illegal TCXO i2cBus! TCXO / OCXO not found?");
strncpy(oscillatorType, "NONE", sizeof(oscillatorType));
return;
}

// In order of priority: use STP3593LF or SiT5811 if present
if (presentSTP3593LF)
{
Expand Down Expand Up @@ -578,6 +585,10 @@ void beginTCXO(TwoWire *i2cBus)
else
{
// No TCXO present!
// There is some redundancy here. If online.tcxo is never set true,
// the myTCXO-> methods are never called...
myTCXO = new GNSSDO_TCXO();
systemPrintln("TCXO / OCXO not found!");
strncpy(oscillatorType, "NONE", sizeof(oscillatorType));
return;
}
Expand Down Expand Up @@ -622,6 +633,7 @@ int64_t getFrequencyControlWord()
void updateTCXOClockBias()
{
tcxoClockBias_ms = gnssClockBias_ms; // Default to the PVTGeodetic RxClkBias
tcxoClockDrift_ppm = gnssClockDrift_ppm;
snprintf(rxClkBiasSource, sizeof(rxClkBiasSource), "PVT");

if (settings.preferNonCompositeGPSBias || settings.preferNonCompositeGalileoBias) // These are mutex
Expand All @@ -630,6 +642,7 @@ void updateTCXOClockBias()
if (fugroTimeSystems[index].updated) // If we have the preferred non-composite bias, use that
{
tcxoClockBias_ms = fugroTimeSystems[index].RxClkBias_ms;
tcxoClockDrift_ppm = fugroTimeSystems[index].RxClkDrift_ppm;
fugroTimeSystems[index].updated = false;
snprintf(rxClkBiasSource, sizeof(rxClkBiasSource), fugroTimeSystems[index].name);
}
Expand Down
4 changes: 2 additions & 2 deletions Firmware/GNSSDO_Firmware/GNSS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ bool initializeGNSS()

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

// Copy current configuration into boot
if (!sendWithResponse("eccf, Current, Boot\n\r", "CopyConfigFile"))
if (!sendWithResponse("eccf, Current, Boot\n\r", "CopyConfigFile", 5000))
{
systemPrintln("GNSS FAIL (CopyConfigFile)");
return false;
Expand Down
1 change: 1 addition & 0 deletions Firmware/GNSSDO_Firmware/GNSSDO_Firmware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ float gnssAltitude_m = 0.0;
uint8_t gnssTimeSys = 255; // Unknown
uint8_t gnssError = 255; // Unknown
double gnssClockBias_ms = 0.0;
float gnssClockDrift_ppm = 0.0;

// IPStatus 4058
uint8_t ethernetMACAddress[6] = { 0,0,0,0,0,0 }; // Display this address in the system menu
Expand Down
35 changes: 35 additions & 0 deletions Firmware/GNSSDO_Firmware/GNSSDO_TCXO.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Class to contain all possible oscillators

// Begin the oscillator
bool GNSSDO_TCXO::begin(TwoWire &wirePort, const uint8_t &address)
{
return true;
}

// Get the frequency control word
int64_t GNSSDO_TCXO::getFrequencyControlWord(void)
{
return settings.tcxoControl;
}

// Set the frequency by bias millis
bool GNSSDO_TCXO::setFrequencyByBiasMillis(double bias, double Pk, double Ik)
{
return true;
}

// Save the frequency control word - if supported
bool GNSSDO_TCXO::saveFrequencyControlValue(void)
{
return true;
}

// Get the default P and I terms - for the default settings
double GNSSDO_TCXO::getDefaultFrequencyByBiasPTerm(void)
{
return settings.Pk;
}
double GNSSDO_TCXO::getDefaultFrequencyByBiasITerm(void)
{
return settings.Ik;
}
30 changes: 29 additions & 1 deletion Firmware/GNSSDO_Firmware/Tasks.ino
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,11 @@ void processConsumerMessage(PARSE_STATE *parse, uint8_t type)
uint64_t unsigned64;
} dblUnsigned64;

union {
float flt;
uint32_t unsigned32;
} fltUnsigned32;

dblUnsigned64.unsigned64 = 0;
for (int i = 0; i < 8; i++)
dblUnsigned64.unsigned64 |= ((uint64_t)parse->buffer[16 + i]) << (i * 8);
Expand Down Expand Up @@ -658,6 +663,15 @@ void processConsumerMessage(PARSE_STATE *parse, uint8_t type)
if (gnssClockBias_ms > 999.999)
gnssClockBias_ms = 999.999;

fltUnsigned32.unsigned32 = 0;
for (int i = 0; i < 4; i++)
fltUnsigned32.unsigned32 |= ((uint32_t)parse->buffer[68 + i]) << (i * 8);
gnssClockDrift_ppm = fltUnsigned32.flt;
if (gnssClockDrift_ppm < -999999.999)
gnssClockDrift_ppm = -999999.999;
if (gnssClockDrift_ppm > 999999.999)
gnssClockDrift_ppm = 999999.999;

gnssTimeSys = parse->buffer[72];
}
else if ((parse->message & 0x1FFF) == 4058) // IPStatus
Expand Down Expand Up @@ -686,21 +700,35 @@ void processConsumerMessage(PARSE_STATE *parse, uint8_t type)
uint8_t SysUsage = parse->buffer[20 + (b * SBLength) + 0];
uint8_t TimeSystem = parse->buffer[20 + (b * SBLength) + 2];

// Convert uint64_t to double
union {
double dbl;
uint64_t unsigned64;
} dblUnsigned64;

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

// Convert uint32_t to float
union {
float flt;
uint32_t unsigned32;
} fltUnsigned32;

// Extract RxClkDrift_ppm
fltUnsigned32.unsigned32 = 0;
for (int i = 0; i < 4; i++)
fltUnsigned32.unsigned32 |= ((uint32_t)parse->buffer[20 + (b * SBLength) + 12 + i]) << (i * 8);

// If this block contains a non-composite clock indicator, store it
for (int TS = 0; TS < NUM_FUGRO_CLK_BIASES; TS++)
{
if (fugroTimeSystems[TS].SysUsage == SysUsage)
{
fugroTimeSystems[TS].RxClkBias_ms = dblUnsigned64.dbl;
fugroTimeSystems[TS].RxClkDrift_ppm = fltUnsigned32.flt;
fugroTimeSystems[TS].updated = true;
break;
}
Expand All @@ -718,7 +746,7 @@ void ButtonCheckTask(void *e)

while (true)
{
if (productVariant == RTK_MOSAIC_T)
if (productVariant == GNSSDO || productVariant == GNSSDO_PLUS)
{
if (setupBtn &&
(settings.disableSetupButton == false)) // Allow check of the setup button if not overridden by settings
Expand Down
6 changes: 5 additions & 1 deletion Firmware/GNSSDO_Firmware/menuSystem.ino
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ void printCurrentConditions(bool CSV)
{
if (firstTime)
{
systemPrintln("YYYY/MM/DD,HH:MM:SS,Epoch,Lat,Lon,Alt,TimeSys,Error,Fine,PPS,Bias,Source,TCXO,Pk,Ik");
systemPrintln("YYYY/MM/DD,HH:MM:SS,Epoch,Lat,Lon,Alt,TimeSys,Error,Fine,PPS,Bias,Drift,Source,TCXO,Pk,Ik");
firstTime = false;
}

Expand Down Expand Up @@ -620,6 +620,8 @@ void printCurrentConditions(bool CSV)

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

systemPrintf(",%.3e", tcxoClockDrift_ppm / 1000000.0); // Display clock drift in parts

systemPrint(",");
systemPrint((const char *)rxClkBiasSource),

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

systemPrintf(", Drift: %.3e", tcxoClockDrift_ppm / 1000000.0);

systemPrint(", Source: ");
systemPrint((const char *)rxClkBiasSource),

Expand Down
12 changes: 9 additions & 3 deletions Firmware/GNSSDO_Firmware/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,32 @@ bool newSystemStateRequested = false;

typedef enum
{
RTK_MOSAIC_T = 0,
GNSSDO = 0,
GNSSDO_PLUS,
// Add new values just above this line
RTK_UNKNOWN,
GNSSDO_UNKNOWN,
} ProductVariant;
ProductVariant productVariant = RTK_UNKNOWN;
ProductVariant productVariant = GNSSDO_UNKNOWN;

const char *const productDisplayNames[] = {
"GNSSDO",
"GNSSDO+",
// Add new values just above this line
"Unknown",
};
const int productDisplayNamesEntries = sizeof(productDisplayNames) / sizeof(productDisplayNames[0]);

const char *const platformFilePrefixTable[] = {
"SFE_GNSSDO",
"SFE_GNSSDO_PLUS",
// Add new values just above this line
"SFE_Unknown",
};
const int platformFilePrefixTableEntries = sizeof(platformFilePrefixTable) / sizeof(platformFilePrefixTable[0]);

const char *const platformPrefixTable[] = {
"GNSSDO",
"GNSSDO_PLUS",
// Add new values just above this line
"Unknown",
};
Expand Down Expand Up @@ -80,6 +84,7 @@ typedef struct {
const uint8_t SysUsage;
const char name[8];
double RxClkBias_ms;
float RxClkDrift_ppm;
bool updated;
} fugroTimeSystem;

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

const char *const mosaicPVTErrorTable[] = {
Expand Down
6 changes: 3 additions & 3 deletions Firmware/GNSSDO_Firmware/support.ino
Original file line number Diff line number Diff line change
Expand Up @@ -689,11 +689,11 @@ bool findSpiffsPartition(void)
void verifyTables()
{
// Verify the product name table
if (productDisplayNamesEntries != (RTK_UNKNOWN + 1))
if (productDisplayNamesEntries != (GNSSDO_UNKNOWN + 1))
reportFatalError("Fix productDisplayNames to match ProductVariant");
if (platformFilePrefixTableEntries != (RTK_UNKNOWN + 1))
if (platformFilePrefixTableEntries != (GNSSDO_UNKNOWN + 1))
reportFatalError("Fix platformFilePrefixTable to match ProductVariant");
if (platformPrefixTableEntries != (RTK_UNKNOWN + 1))
if (platformPrefixTableEntries != (GNSSDO_UNKNOWN + 1))
reportFatalError("Fix platformPrefixTable to match ProductVariant");

tasksValidateTables();
Expand Down
Loading