Skip to content

Commit

Permalink
Modify SystemCheck for use during UART ZED firmware update
Browse files Browse the repository at this point in the history
  • Loading branch information
nseidle committed May 3, 2023
1 parent f3fd0fb commit fc7283c
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 33 deletions.
13 changes: 13 additions & 0 deletions Firmware/Test Sketches/System_Check/System_Check.ino
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,19 @@ void setup()
oled.display();
}

//Select port 0 on MUX so UART1 is connected to ZED if bootloading is needed
if(pin_muxA >= 0)
{
pinMode(pin_muxA, OUTPUT);
digitalWrite(pin_muxA, LOW);
}
if(pin_muxB >= 0)
{
pinMode(pin_muxB, OUTPUT);
digitalWrite(pin_muxB, LOW);
Serial.println("MUX should now be UART");
}

menuSystem();
}

Expand Down
Binary file modified Firmware/Test Sketches/System_Check/System_Check.ino.esp32.bin
Binary file not shown.
70 changes: 37 additions & 33 deletions Firmware/Test Sketches/System_Check/menuSystem.ino
Original file line number Diff line number Diff line change
Expand Up @@ -106,39 +106,6 @@ void menuSystem()
Serial.print(macAddress);
Serial.print(F("): "));

//Verify the ESP UART2 can communicate TX/RX to ZED UART1
if (online.gnss == true)
{
if (zedUartPassed == false)
{
//stopUART2Tasks(); //Stop absoring ZED serial via task

theGNSS.setSerialRate(460800, COM_PORT_UART1); //Defaults to 460800 to maximize message output support
serialGNSS.begin(460800); //UART2 on pins 16/17 for SPP. The ZED-F9P will be configured to output NMEA over its UART1 at the same rate.

SFE_UBLOX_GNSS myGNSS;
if (myGNSS.begin(serialGNSS) == true) //begin() attempts 3 connections
{
zedUartPassed = true;
Serial.print(F("Online"));
}
else
Serial.print(F("Offline"));

theGNSS.setSerialRate(settings.dataPortBaud, COM_PORT_UART1); //Defaults to 460800 to maximize message output support
serialGNSS.begin(settings.dataPortBaud); //UART2 on pins 16/17 for SPP. The ZED-F9P will be configured to output NMEA over its UART1 at the same rate.

//startUART2Tasks(); //Return to normal operation
}
else
Serial.print(F("Online"));
}
else
{
Serial.print("Can't check (GNSS offline)");
}
Serial.println();

Serial.println(F("s) Scan I2C"));
Serial.println(F("S) Verbose scan of I2C"));
Serial.println(F("t) Toggle pin"));
Expand Down Expand Up @@ -298,3 +265,40 @@ void printCurrentConditions()
Serial.println();
}
}

void testGNSS()
{
//The following ZED test blocks the usage of UART1 for bootloading.
//Verify the ESP UART2 can communicate TX/RX to ZED UART1
if (online.gnss == true)
{
if (zedUartPassed == false)
{
//stopUART2Tasks(); //Stop absoring ZED serial via task

theGNSS.setSerialRate(460800, COM_PORT_UART1); //Defaults to 460800 to maximize message output support
serialGNSS.begin(460800); //UART2 on pins 16/17 for SPP. The ZED-F9P will be configured to output NMEA over its UART1 at the same rate.

SFE_UBLOX_GNSS myGNSS;
if (myGNSS.begin(serialGNSS) == true) //begin() attempts 3 connections
{
zedUartPassed = true;
Serial.print(F("Online"));
}
else
Serial.print(F("Offline"));

theGNSS.setSerialRate(settings.dataPortBaud, COM_PORT_UART1); //Defaults to 460800 to maximize message output support
serialGNSS.begin(settings.dataPortBaud); //UART2 on pins 16/17 for SPP. The ZED-F9P will be configured to output NMEA over its UART1 at the same rate.

//startUART2Tasks(); //Return to normal operation
}
else
Serial.print(F("Online"));
}
else
{
Serial.print("Can't check (GNSS offline)");
}
Serial.println();
}

0 comments on commit fc7283c

Please sign in to comment.