Skip to content

Commit

Permalink
Allow UM980 firmware update through debug menu
Browse files Browse the repository at this point in the history
  • Loading branch information
nseidle committed May 10, 2024
1 parent 9cc09e4 commit 8d5323f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
6 changes: 5 additions & 1 deletion Firmware/RTK_Everywhere/Begin.ino
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ void beginBoard()

pin_GNSS_TimePulse = 39; // PPS on UM980

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

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

pinMode(pin_muxA, OUTPUT);
digitalWrite(pin_muxA, LOW); // Keep ESP UART1 connected to UM980

settings.dataPortBaud = 115200; // Override settings. Use UM980 at 115200bps.

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

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

if (pin_GnssUart_RX == -1 || pin_GnssUart_TX == -1)
Expand Down
41 changes: 33 additions & 8 deletions Firmware/RTK_Everywhere/menuSystem.ino
Original file line number Diff line number Diff line change
Expand Up @@ -505,23 +505,48 @@ void menuDebugHardware()
}
else if (incoming == 13 && present.gnss_um980)
{
systemPrintln("Press ! to exit");
// Stop all UART tasks
tasksStopGnssUart();

systemPrintln("Entering UM980 direct connect at 115200bps for firmware update and configuration. Use "
"UPrecise to update "
"the firmware. Power cycle RTK Torch to "
"return to normal operation.");

// Make sure ESP-UART1 is connected to UM980
digitalWrite(pin_muxA, LOW);

// UPrecise needs to query the device before entering bootload mode
// Wait for UPrecise to send bootloader trigger (character T followed by character @) before resetting UM980
bool inBootMode = false;

// Echo everything to/from UM980
while (1)
{
while (serialGNSS->available())
// Data coming from UM980 to external USB
if (serialGNSS->available())
systemWrite(serialGNSS->read());

// Data coming from external USB to UM980
if (systemAvailable())
{
byte incoming = systemRead();
if (incoming == '!')
break;
else if (incoming == '1')
serialGNSS->println("mask");
else if (incoming == '2')
serialGNSS->println("config");
serialGNSS->write(incoming);

// Detect bootload sequence
if (inBootMode == false && incoming == 'T')
{
byte nextIncoming = Serial.peek();
if (nextIncoming == '@')
{
// Reset UM980
um980Reset();
delay(25);
um980Boot();

inBootMode = true;
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Firmware/RTK_Everywhere/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -1686,7 +1686,7 @@ struct struct_present

bool needsExternalPpl = false;

float antennaReferencePoint_mm = 0.0;
float antennaReferencePoint_mm = 0.0; //Used to setup tilt compensation
} present;

// Monitor which devices on the device are on or offline.
Expand Down

0 comments on commit 8d5323f

Please sign in to comment.