Page 1 of 1

How to send PMTK Command to GPS module

Posted: Fri Jul 26, 2019 9:51 am
by Ritu21
Hi,

I am adding gps facility in my project for which I need to first configure the settings in gps as per our need. I am trying to send PMTK command for changing baudrate, type of NMEA messages and the data rate. I used a function already given in example of UART for sending data as mentioned below:

int sendData(const char* logName, const char* data)
{
const int len = strlen(data);
const int txBytes = uart_write_bytes(UART_NUM_2, data, len);
ESP_LOGI(logName, "Wrote %d bytes", txBytes);
return txBytes;
}
void app_main()
{
init_UART2();
sendData("GPS_Transmit", "$PMTK250,1,0,38400*27\x0d\x0a"); //command for changing the baud rate.
}

This sends the data to GPS but doesn't change the baud rate.

Whereas, I tried sending the same command using a utility - HTerm, here I sent the text file in which this command was written and that not only changed the baud rate but ACK message was also received by GPS module.

I am wondering, how do I implement the same thing in my code so that I could change the settings of GPS module ???

Thanks
Ritu