The code implementation didn't work for my Crius CN-06 gps and Crius nav-board, neither. It fell always back to 9600 baud, 1Hz.
That means, switching to other baud rates via NMEA commands didn't work.
My solution was to use Ublox binary commands in i2c_gps_nav.ino as follows in order to set it to GPS_SERIAL_SPEED=57600 baud and 2 hz:
(other variations can be observed by the relevant message of the ublox u-center software)
uint32_t init_speed[5] = {9600,19200,38400,57600,115200};
#if defined(UBLOX)
prog_char UBLOX_INIT[] PROGMEM = { // PROGMEM array must be outside any function !!!
0xB5,0x62,0x06,0x01,0x03,0x00,0xF0,0x05,0x00,0xFF,0x19, //disable all default NMEA messages
0xB5,0x62,0x06,0x01,0x03,0x00,0xF0,0x03,0x00,0xFD,0x15,
0xB5,0x62,0x06,0x01,0x03,0x00,0xF0,0x01,0x00,0xFB,0x11,
0xB5,0x62,0x06,0x01,0x03,0x00,0xF0,0x00,0x00,0xFA,0x0F,
0xB5,0x62,0x06,0x01,0x03,0x00,0xF0,0x02,0x00,0xFC,0x13,
0xB5,0x62,0x06,0x01,0x03,0x00,0xF0,0x04,0x00,0xFE,0x17,
0xB5,0x62,0x06,0x01,0x03,0x00,0x01,0x02,0x01,0x0E,0x47, //set POSLLH MSG rate
0xB5,0x62,0x06,0x01,0x03,0x00,0x01,0x03,0x01,0x0F,0x49, //set STATUS MSG rate
0xB5,0x62,0x06,0x01,0x03,0x00,0x01,0x06,0x01,0x12,0x4F, //set SOL MSG rate
0xB5,0x62,0x06,0x01,0x03,0x00,0x01,0x12,0x01,0x1E,0x67, //set VELNED MSG rate
0xB5,0x62,0x06,0x16,0x08,0x00,0x03,0x07,0x03,0x00,0x51,0x08,0x00,0x00,0x8A,0x41, //set WAAS to EGNOS
0xB5, 0x62, 0x06, 0x08, 0x06, 0x00, 0xF4, 0x01, 0x01, 0x00, 0x01, 0x00, 0x0B, 0x77 //set rate to 2Hz
};
prog_char UBLOX_SPEED[] PROGMEM = {
0xB5, 0x62, 0x06, 0x00, 0x14, 0x00, 0x01,
0x00, 0x00, 0x00, 0xD0, 0x08, 0x00, 0x00,
0x00, 0xE1, 0x00, 0x00, 0x07, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0xBD, //set speed to 57600
};
#endif
void GPS_SerialInit() {
#if not defined(UBLOX) && not defined(INIT_MTK_GPS) // start directly with the supposed baud rate
Serial.begin(GPS_SERIAL_SPEED);
delay(1000);
#endif
#if defined(UBLOX) // try to start with 9600 baud
//Set speed to 9600
Serial.begin(9600);
delay(1000);
for(uint8_t i=0; i<sizeof(UBLOX_SPEED); i++) { // send baud rate configuration data as UBX protocol
Serial.write(pgm_read_byte(UBLOX_SPEED+i));
delay(5); //simulating a 38400baud pace (or less), otherwise commands are not accepted by the device.
}
Serial.end();
delay(1000);
Serial.begin(GPS_SERIAL_SPEED);
delay(1000);
for(uint8_t i=0; i<sizeof(UBLOX_INIT); i++) { // send Ublox messages configuration data as UBX protocol
Serial.write(pgm_read_byte(UBLOX_INIT+i));
delay(5); //simulating a 38400baud pace (or less), otherwise commands are not accepted by the device.
}
#elif defined(INIT_MTK_GPS) // MTK GPS setup
...