Configurating Ublox GPS on bootup from arduino

Hi , Need special help , I have a GPS Neo7 that has No Flash and an Inoperable EEPROM I need a means to upload Baud of 57600 , Rate of 5Hz , NAV5 Dynamic model of - Pedestrian. from an Arduino Mega 2560 using serial 2. from the GPS default of 9600 baud and 1Hz Rate

the GPS doesn't store any Config when unplug so this is my only means around it.
and UCenter isnt going to work either. as the GPS is plug to the arduino

alot of the tutorial and sources I found isnt clear on configuration . a ino file of a solution would be helpful and it can be added to the setup part of any scripts

@frewon9, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with your project :wink: See About the Installation & Troubleshooting category.

This article helped me a lot in sending configuration commands to my UBLOX GPS module.

At some point when you want to create configuration commands you may need to calculate the checksum for a UBLOX command. I found that to be a pain in the ***, so created a small sketch to do so.

/*UBlox GPS message checksum calculator
  V1.0 by Hans Meijdam
 U-Blox checksum calculator.
 V1.1 Hans Meijdam, March 2021
  This sketch will calculate the UBLOX checksum. The checksum algorithm used is the 8-Bit Fletcher Algorithm, which is used in the TCP standard (RFC 1145).
  leave out the first two sync-char of the UBLOX sentence and the last two bytes are the checksum bytes.

  expected outcome of the below example should be: CK_A = 91 and CK_B = 84
*/
const static uint8_t myStr[] PROGMEM = {0xB5, 0x62, 0x06, 0x00, 0x14, 0x00, 0x01, 0x00, 0x00, 0x00, 0xD0, 0x08, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x07, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,  0x91, 0x84};
//                                      ====sync=== ============================================== checksum calculated over these bytes ===========================================================  =checksum=
//uint16_t prnt; // helper for printing

void setup() {
  Serial.begin(9600);
  uint8_t CK_A = 0;
  uint8_t CK_B = 0;
  uint8_t i;

  for (i = 0; i < sizeof(myStr) - 4; i++) { // "-4" because leave the first two and the last two bytes out of the checksum calculation.
    CK_A = CK_A + pgm_read_byte(&myStr[i + 2]); // "+2" because we skip the first 2 sync bytes
    CK_B = CK_B + CK_A;
  }
  Serial.print(" CK_A = ");
  Serial.print(CK_A, HEX);
  Serial.print(" and CK_B = ");
  Serial.println(CK_B, HEX);
}

void loop() {
}

U-Center, the tool from Ublox, will allow you to test any config changes and will also tell you the string of bytes to send.

There is an explanation of the process here;

At the end of the article is a link to a working example of a sketch to change the update rate, turn off unwanted NMEA messages etc.

base on the 90_UBlox_GPS_Configuration.ino scripts will just update the hexfile?
also would this work on hardware serial like serial 2 in arduino mega. just want to avoid having an 2nd arduino board to config the GPS

I dont know what you mean by the 'hexfile'

And yes the program would work with Hardware serial.

will try it out so I change
#define RXpin A3 //this is the pin that the Arduino will use to receive data from the GPS
#define TXpin A2 //this is the pin that the Arduino can use to send data (commands) to the GPS - not used

into RX2 - D17 and TX2 - D16

as for multiple strings how would this goes?
im changing the the following
UBX - CFG (Config) - NAV5 (Navigation 5) as (Dynamic Model - Pedestrian)
UBX - CFG (Config) - RATE (Rates) as ( 200ms - 5Hz)
UBX - CFG (Config) - PRT (Ports) as (baud 57600)

just need some help with the strings though

Here you have a snippet from the declaration and setup section of my GPS sketch. You can see I define the strings first and then use serial write to send them. GPS module is connected to the hardware serial port.

Note that I am turning off all NMEA sentences and then turn on only the UBLOX "PVT" sentence (PVT contains all the info I need), with increased refreshrate and set the GPS module to airborne mode.

//format hex command strings for sending to UBLOX
const static char PROGMEM airborne[] = {0xb5, 0x62, 0x06, 0x24, 0x24, 0x00, 0xff, 0xff, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x10, 0x27,
                                0x00, 0x00, 0x05, 0x00, 0xfa, 0x00, 0xfa, 0x00, 0x64, 0x00, 0x2c, 0x01, 0x00, 0x3c, 0x00, 0x00,
                                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x0b, 0xb5, 0x62, 0x06, 0x24,
                                0x00, 0x00, 0x2a, 0x84
                               };
const static char PROGMEM hnr[] = {0xB5, 0x62, 0x06, 0x5C, 0x04, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6B, 0xE0}; // high nav rate to 5Hz
const static char PROGMEM rate[] = {0xB5, 0x62, 0x06, 0x08, 0x06, 0x00, 0xC8, 0x00, 0x01, 0x00, 0x01, 0x00, 0xDE, 0x6A}; // output at 5 Hz
const static char PROGMEM pvt[] = {0xb5, 0x62, 0x06, 0x01, 0x03, 0x00, 0x01, 0x07, 0x01, 0x13, 0x51}; // activate PVT sentence


#define GPS_INFO_BUFFER_SIZE 100 // enough for the strings (PVT is 100 long)
byte GPS_info_buffer[GPS_INFO_BUFFER_SIZE];
byte string_length = 98;  //PVT is 100 Initialize with longest string.
unsigned int received_char;
int i = 0; // counter
bool message_started = false;

long velN;
long velE;
long velD;
unsigned long velocity_3d; // speed in centimeter / second
unsigned long spd_kts; //speed in knots
long longitude ;//longitude
long latitude ;//latitude
long height_above_sea_level;//height above main sea level
unsigned long ground_speed ;
unsigned long heading;

//CHECKSUM CALCULATION VARIABLE
unsigned char CK_A = 0;
unsigned char CK_B = 0;

byte sendlat = 0; // toggle to send either latitude or longitude in same field
byte fixok = 0; // flag to indicate a valid GPS fix was received.
byte fixcount = 0; // count how many OK GPS fixes we have in a row.

void setup() {

  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite (LED_BUILTIN, HIGH); // signal led on, to test

  delay(2000); // wait for GPS to boot.

  Serial.begin(9600);
  delay(100);
  // turn off all NMEA sentences first
  Serial.println(F("$PUBX,40,RMC,0,0,0,0*47")); //RMC OFF
  delay(100);
  Serial.println(F("$PUBX,40,VTG,0,0,0,0*5E")); //VTG OFF
  delay(100);
  Serial.println(F("$PUBX,40,GGA,0,0,0,0*5A")); //GGA OFF
  delay(100);
  Serial.println(F("$PUBX,40,GSA,0,0,0,0*4E")); //GSA OFF
  delay(100);
  Serial.println(F("$PUBX,40,GSV,0,0,0,0*59")); //GSV OFF
  delay(100);
  Serial.println(F("$PUBX,40,GLL,0,0,0,0*5C")); //GLL OFF
  delay(100);

  Serial.write(airborne, sizeof(airborne)); //set GPS mode to airborne < 4g
  delay(100);
  Serial.write(hnr, sizeof(hnr)); //set GPS update rate to 4Hz (1st string)
  delay(100);
  Serial.write(rate, sizeof(rate)); //set GPS update rate to 4Hz (2nd string)
  delay(100);
  Serial.write(pvt, sizeof(pvt)); // PVT Navigation Position Velocity Time Solution message ON
  delay(100);
  digitalWrite (13, LOW); // signal led off, end setup
  

} // end setup

still getting errors from this code

ccOihRhL.ltrans0.o:(.text.startup+0x24c): undefined reference to `loop'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

The loop-function is missing.

Try adding this:

void loop()
{
}

at the end of the line?

Have you tried?

Just like this:

:
:
} // end setup

void loop()
{
}

have to check it out

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.