@@ -462,6 +462,9 @@ void menuDebugHardware()
462
462
systemPrint (" 16) Print LoRa Debugging: " );
463
463
systemPrintf (" %s\r\n " , settings.debugLora ? " Enabled" : " Disabled" );
464
464
465
+ if (present.radio_lora )
466
+ systemPrintln (" 17) STM32 direct connect" );
467
+
465
468
systemPrintln (" e) Erase LittleFS" );
466
469
467
470
systemPrintln (" t) Test Screen" );
@@ -581,6 +584,47 @@ void menuDebugHardware()
581
584
{
582
585
settings.debugLora ^= 1 ;
583
586
}
587
+ else if (incoming == 17 && present.radio_lora )
588
+ {
589
+ // Note: STM32 bootloading is not stable above 57600bps
590
+
591
+ // Stop all UART1 tasks
592
+ tasksStopGnssUart ();
593
+
594
+ // If the radio is off, turn it on
595
+ if (digitalRead (pin_loraRadio_power) == LOW)
596
+ {
597
+ systemPrintln (" Turning on radio" );
598
+ loraPowerOn ();
599
+ delay (500 ); // Allow power to stablize
600
+ }
601
+
602
+ systemPrintln (" Entering STM32 direct connect for firmware update. Use STM32CubeProgrammer to update the "
603
+ " firmware. Baudrate: 57600bps. Parity: None. RTS/DTR: High. Power cycle RTK Torch to return "
604
+ " to normal operation." );
605
+
606
+ // Make sure ESP-UART1 is connected to LoRA STM32 UART0
607
+ muxSelectLora ();
608
+
609
+ // Change Serial speed of UART0
610
+ Serial.begin (57600 );
611
+
612
+ serialGNSS->begin (115200 , SERIAL_8N1, pin_GnssUart_RX,
613
+ pin_GnssUart_TX); // Make sure UART1 is at 115200 for the STM32 comm
614
+
615
+ loraEnterBootloader (); // Push boot pin high and reset STM32
616
+
617
+ // Push any incoming ESP32 UART0 to UART1 and vice versa
618
+ while (1 )
619
+ {
620
+ while (Serial.available ())
621
+ serialGNSS->write (Serial.read ());
622
+
623
+ while (serialGNSS->available ())
624
+ Serial.write (serialGNSS->read ());
625
+ }
626
+ }
627
+
584
628
else if (incoming == ' e' )
585
629
{
586
630
systemPrintln (" Erasing LittleFS and resetting" );
0 commit comments