Skip to content

Commit 8d5323f

Browse files
committed
Allow UM980 firmware update through debug menu
1 parent 9cc09e4 commit 8d5323f

File tree

3 files changed

+39
-10
lines changed

3 files changed

+39
-10
lines changed

Firmware/RTK_Everywhere/Begin.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ void beginBoard()
159159

160160
pin_GNSS_TimePulse = 39; // PPS on UM980
161161

162+
pin_muxA = 18; //Controls U12 switch between ESP UART1 to UM980 or LoRa
162163
pin_usbSelect = 21;
163164
pin_powerAdapterDetect = 36; // Goes low when USB cable is plugged in
164165

@@ -208,6 +209,9 @@ void beginBoard()
208209
pinMode(pin_usbSelect, OUTPUT);
209210
digitalWrite(pin_usbSelect, HIGH); // Keep CH340 connected to USB bus
210211

212+
pinMode(pin_muxA, OUTPUT);
213+
digitalWrite(pin_muxA, LOW); // Keep ESP UART1 connected to UM980
214+
211215
settings.dataPortBaud = 115200; // Override settings. Use UM980 at 115200bps.
212216

213217
pinMode(pin_loraRadio_power, OUTPUT);
@@ -783,7 +787,7 @@ void pinGnssUartTask(void *pvParameters)
783787
serialGNSS = new HardwareSerial(2); // Use UART2 on the ESP32 for communication with the GNSS module
784788

785789
serialGNSS->setRxBufferSize(
786-
settings.uartReceiveBufferSize); // TODO: work out if we can reduce or skip this when using SPI GNSS
790+
settings.uartReceiveBufferSize);
787791
serialGNSS->setTimeout(settings.serialTimeoutGNSS); // Requires serial traffic on the UART pins for detection
788792

789793
if (pin_GnssUart_RX == -1 || pin_GnssUart_TX == -1)

Firmware/RTK_Everywhere/menuSystem.ino

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -505,23 +505,48 @@ void menuDebugHardware()
505505
}
506506
else if (incoming == 13 && present.gnss_um980)
507507
{
508-
systemPrintln("Press ! to exit");
508+
// Stop all UART tasks
509+
tasksStopGnssUart();
510+
511+
systemPrintln("Entering UM980 direct connect at 115200bps for firmware update and configuration. Use "
512+
"UPrecise to update "
513+
"the firmware. Power cycle RTK Torch to "
514+
"return to normal operation.");
515+
516+
// Make sure ESP-UART1 is connected to UM980
517+
digitalWrite(pin_muxA, LOW);
518+
519+
// UPrecise needs to query the device before entering bootload mode
520+
// Wait for UPrecise to send bootloader trigger (character T followed by character @) before resetting UM980
521+
bool inBootMode = false;
509522

510523
// Echo everything to/from UM980
511524
while (1)
512525
{
513-
while (serialGNSS->available())
526+
// Data coming from UM980 to external USB
527+
if (serialGNSS->available())
514528
systemWrite(serialGNSS->read());
515529

530+
// Data coming from external USB to UM980
516531
if (systemAvailable())
517532
{
518533
byte incoming = systemRead();
519-
if (incoming == '!')
520-
break;
521-
else if (incoming == '1')
522-
serialGNSS->println("mask");
523-
else if (incoming == '2')
524-
serialGNSS->println("config");
534+
serialGNSS->write(incoming);
535+
536+
// Detect bootload sequence
537+
if (inBootMode == false && incoming == 'T')
538+
{
539+
byte nextIncoming = Serial.peek();
540+
if (nextIncoming == '@')
541+
{
542+
// Reset UM980
543+
um980Reset();
544+
delay(25);
545+
um980Boot();
546+
547+
inBootMode = true;
548+
}
549+
}
525550
}
526551
}
527552
}

Firmware/RTK_Everywhere/settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,7 @@ struct struct_present
16861686

16871687
bool needsExternalPpl = false;
16881688

1689-
float antennaReferencePoint_mm = 0.0;
1689+
float antennaReferencePoint_mm = 0.0; //Used to setup tilt compensation
16901690
} present;
16911691

16921692
// Monitor which devices on the device are on or offline.

0 commit comments

Comments
 (0)