Hi
I’ve made a function that is suppose to find out the baud rate my GPS module is using. I just test every speed the GPS can use to see when I get a correct message. The problem I’m having is that the serial port only gets interrupts when I’m debugging. If I stop debugging and restart the Panda with the reset button the port no longer responds. I don’t understand how this could be.
private bool FindGPSBaudrate()
{
if(SP.IsOpen)
SP.Close();
SP.BaudRate = 4800;
SP.Open();
RMC = "not";
Thread.Sleep(1200); // 1.2 second to receieve something on UART, GPS updates every second.
if (RMC != "not")
return true;
SP.Close();
SP.BaudRate = 9600;
SP.Open();
Thread.Sleep(1200);
if (RMC != "not")
return true;
SP.Close();
SP.BaudRate = 14400;
SP.Open();
Thread.Sleep(1200);
if (RMC != "not")
return true;
SP.Close();
SP.BaudRate = 19200;
SP.Open();
Thread.Sleep(1200);
if (RMC != "not")
return true;
SP.Close();
SP.BaudRate = 38400;
SP.Open();
Thread.Sleep(1200);
if (RMC != "not")
return true;
SP.Close();
SP.BaudRate = 57600;
SP.Open();
Thread.Sleep(1200);
if (RMC != "not")
return true;
SP.Close();
SP.BaudRate = 115200;
SP.Open();
Thread.Sleep(1200);
if (RMC != "not")
return true;
return false;
}
Thank you