0

I want to set the baud rate of the Neo 6M GPS Module to 115200 or a higher value. I'm building a time messurement system where it simply takes to long to recive the Nema sentence with the standart 9600 Baudrate. I use this board. I did a scatch in the Arduino IDE and want to include it into my bigger project. Here is the code I tried to follow this instructions. I also fount the manuel for the Neo 6M GPS Module.

The problem is that in my case the GPS Module is fixed on the board and I can't directly connect it to the PC. So there is no option of using the U-Center to config the GPS Modul. This code won't work. I get no serial feedback at all.

Any tips or links to a solution are welcome.

#include <SoftwareSerial.h>   
    
void setup() {
    Serial.begin(115200);
    Serial1.begin(9600, SERIAL_8N1, 34, 12);   //default mode
    changeBaudrate();
    delay(100);
    Serial1.flush();
    Serial1.end();
}
    
void loop() {
    Serial1.begin(115200, SERIAL_8N1, 34, 12);   //new 115k boost mode
    Serial.println("try to send data with 115200");
    delay(1000);

    while(Serial1.available()) {
        Serial.write(Serial1.read());
        Serial1.println();
    }

    Serial1.flush();
    Serial1.end();
    Serial1.begin(9600, SERIAL_8N1, 34, 12);   //new 115k boost mode
    Serial.println("try to send data with 9600");
    delay(1000);

    while(Serial1.available()) {
        Serial.write(Serial1.read());
        Serial1.println();
    }

    Serial1.flush();
    Serial1.end();
}
    
void changeBaudrate() {
    // CFG-PRT
    byte packet[] = {
        0xB5, // sync char 1
        0x62, // sync char 2
        0x06, // class
        0x00, // id
        0x14, // length
        0x00, // 
        0x01, // payload
        0x00, // payload
        0x00, // payload
        0x00, // payload
        0xD0, // payload
        0x08, // payload
        0x00, // payload
        0x00, // payload
        0x00, // payload
        0xC2, // payload
        0x01, // payload
        0x00, // payload
        0x07, // payload
        0x00, // payload
        0x03, // payload
        0x00, // payload
        0x00, // payload
        0x00, // payload
        0x00, // payload
        0x00, // payload  
        0xC0, // CK_A
        0x7E, // CK_B
    };

    sendPacket(packet, sizeof(packet));
}
    
void sendPacket(byte *packet, byte len) {    
    for (byte i = 0; i < len; i++) {
        Serial1.write(packet[i]);
        Serial.println("in Send Packet");
    }
}

I just get feedback if I set the connection to 9600 baudrate:

Serial plot:

    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.245 -> in Send Packet
    23:42:16.338 -> try to send data with 115200
    23:42:17.368 -> try to send data with 9600
    23:42:18.409 -> $GPRMC,,V,,,,,,,,,,N*53
    23:42:18.409 -> $GPVTG,,,,,,,,,N*30
    23:42:18.409 -> $GPGGA,,,,,,0,00,99.99,,,,,,*48
    23:42:18.409 -> $GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
    23:42:18.501 -> $GPGSV,1,1,00*79
    23:42:18.550 -> $GPGLL,,,,,,V,N*64
    23:42:18.596 -> $GPTXT,01,01,00,rxbuf alloc port 1*51
    23:42:18.829 -> try to send data with 115200
Sercan
  • 4,739
  • 3
  • 17
  • 36
blablabla
  • 1
  • 1

3 Answers3

1

Here's my code snipped for doing the same:

  void init(int tx, int rx){

    SerialGPS.begin ( 9600 , SERIAL_8N1, tx , rx );
    
    changeFrequency();
    delay(200);

    SerialGPS.flush();

    changeBaudrate();
    
    delay(200);

    SerialGPS.flush();

    SerialGPS.end();
    
    SerialGPS.begin ( 115200 , SERIAL_8N1, tx , rx );

    Serial.println("GPS interface initialized");

  }



void changeBaudrate() {
    byte packet38400[] = {
      0xB5, 0x62, 0x06, 0x00, 0x14, 0x00, 0x01, 0x00, 0x00, 
      0x00, 0xD0, 0x08, 0x00, 0x00, 0xF0, 0x87, 0x00, 0x00, 
      0x07, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x24,
    };

    byte packet115200[] = {
      0xB5, 0x62, 0x06, 0x00, 0x14, 0x00, 0x01, 0x00, 0x00, 
      0x00, 0xD0, 0x08, 0x00, 0x00, 0x00, 0xC2, 0x01, 0x00, 
      0x07, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x7E,
    };
    sendPacket(packet115200, sizeof(packet115200));
}

void changeFrequency() {
    byte packet[] = {
      0xB5,0x62,0x06,0x08,0x06,0x00,0xC8,0x00,0x01,0x00,0x01,0x00,0xDE,0x6A,
    };
    sendPacket(packet, sizeof(packet));
}

void sendPacket(byte *packet, byte len) {
    for (byte i = 0; i < len; i++)
    {
        SerialGPS.write(packet[i]);
    }
}

There's a catch though - it might not work on some LiLy Go devices at random. I have 3 TTGO boards and 3 GPS units , it worked only on one of TTGO regardless of which GPS it was connected. Others would sork only with 9600 baud rate. Still trying to figure out why.

Also you do not need additional UART controller, you may use existing board and turn it into a serial bridge to use with U-Center:

https://github.com/loginov-rocks/UbxGps/blob/main/extras/Configuration/Serial-Bridge-Uno/Serial-Bridge-Uno.ino

(the code is for Uno but if you add ESP Serial library it'll work)

the.Legend
  • 626
  • 5
  • 13
0

You can use the micro USB port on the board to directly update the NEO-6M GPS module's internal firmware using the U-Center. The schematic design of the board including the relevant units is available below:

enter image description here

As you can see, the micro usb port on the board is directly connected to the NEO-6M GPS module. The application configuration topology should be as follows:

enter image description here

enter image description here

Related Links

Sercan
  • 4,739
  • 3
  • 17
  • 36
0

The posted "t-beam" board schematic is not accurate to my TTGO T22_V1.1, where it indicates a direct USB connection to the NEO-6M. The resistors R26/R30 between USB and NEO-6M pins 5 and 6 (D1-,D1+) are missing on my board, and it looks like they are missing on the board photo in the post above.

Nutz-E
  • 1
  • 2
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 27 '22 at 09:25