Make that two users errors. I have the same Flytron module (defaults are 9600 and 1 Hz, changed defaults cannot be stored - chip limitation). Only way to change would be to find firmware 115200/10 Hz that fits. Not a road I would want to go really.
The module connects and works just fine in type=0 AND type=2 but ONLY at 9600 baud.
I certainly believe your pre-configured oharap works as type=0, as the code will not need to sent init strings ...
Code: Select all
#if defined(GPS_SERIAL)
#if defined(INIT_MTK_GPS) || defined(UBLOX)
uint32_t init_speed[5] = {9600,19200,38400,57600,115200};
void SerialGpsPrint(prog_char* str) {
char b;
while(b = pgm_read_byte(str)) {
SerialWrite(GPS_SERIAL, b);
#if defined(UBLOX)
delay(4);
#endif
str++;
}
}
#endif
#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, 0xC8, 0x00, 0x01, 0x00, 0x01, 0x00, 0xDE, 0x6A //set rate to 5Hz
};
#endif
void GPS_SerialInit() {
SerialOpen(GPS_SERIAL,GPS_BAUD);
delay(1000);
#if defined(UBLOX)
for(uint8_t i=0;i<=5;i++){
SerialOpen(GPS_SERIAL,init_speed[i]); // switch UART speed for sending SET BAUDRATE command (NMEA mode)
#if (GPS_BAUD==19200)
SerialGpsPrint(PSTR("$PUBX,41,1,0003,0001,19200,0*23\r\n")); // 19200 baud - minimal speed for 5Hz update rate
#endif
#if (GPS_BAUD==38400)
SerialGpsPrint(PSTR("$PUBX,41,1,0003,0001,38400,0*26\r\n")); // 38400 baud
#endif
#if (GPS_BAUD==57600)
SerialGpsPrint(PSTR("$PUBX,41,1,0003,0001,57600,0*2D\r\n")); // 57600 baud
#endif
#if (GPS_BAUD==115200)
SerialGpsPrint(PSTR("$PUBX,41,1,0003,0001,115200,0*1E\r\n")); // 115200 baud
#endif
delay(10);
}
SerialOpen(GPS_SERIAL,GPS_BAUD);
for(uint8_t i=0; i<sizeof(UBLOX_INIT); i++) { // send configuration data in UBX protocol
SerialWrite(GPS_SERIAL, pgm_read_byte(UBLOX_INIT+i));
delay(4); //simulating a 38400baud pace (or less), otherwise commands are not accepted by the device.
}
#elif defined(INIT_MTK_GPS) // MTK GPS setup
for(uint8_t i=0;i<=5;i++){
SerialOpen(GPS_SERIAL,init_speed[i]); // switch UART speed for sending SET BAUDRATE command
#if (GPS_BAUD==19200)
SerialGpsPrint(PSTR("$PMTK251,19200*22\r\n")); // 19200 baud - minimal speed for 5Hz update rate
#endif
#if (GPS_BAUD==38400)
SerialGpsPrint(PSTR("$PMTK251,38400*27\r\n")); // 38400 baud
#endif
#if (GPS_BAUD==57600)
SerialGpsPrint(PSTR("$PMTK251,57600*2C\r\n")); // 57600 baud
#endif
#if (GPS_BAUD==115200)
SerialGpsPrint(PSTR("$PMTK251,115200*1F\r\n")); // 115200 baud
#endif
delay(10);
}
// at this point we have GPS working at selected (via #define GPS_BAUD) baudrate
SerialOpen(GPS_SERIAL,GPS_BAUD);
SerialGpsPrint(PSTR("$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n")); // only GGA and RMC sentence
SerialGpsPrint(PSTR("$PMTK220,200*2C\r\n")); // 5 Hz update rate
#endif
}
#endif