A UBlox GPS Module Primer for beginners

Executing Poll_CFG_TP5 does only Poll current settings-Time Pulse Parameters for Time Pulse 0, after about 0.5sec the GPS will respond with CFG-TP5 Time Pulse Parameters message-32 Length (Bytes).
Then the message gets loaded from Teensy HWserial buffer to _gpsPayload[_payloadSize] array buffer, while its loading it gets indentified and sets boolean _UBX_CFG_ID = true;
And then it goes through this in ccp:
Code:
    if (_UBX_CFG_ID == true) {
      uint16_t MSGpayload = (_gpsPayload[3] << 8) | _gpsPayload[2]; // Combining two uint8_t as uint16_t
      uint32_t DCL0 = 0;
      float DCL1 = 0;

      switch (_gpsPayload[1]) {  // UBX-CFG (0x06) Class
        case 0x00: // UBX-CFG-PRT (0x06 0x00) Port Configuration for UART
          switch (MSGpayload) { // 16Bit-Length Field, Decide what to do based on payload size, length in decimal format
            case 1:  // UBX-CFG-PRT 0x06 0x00 Poll Request Polls the configuration for one I/O Port , len[1]
              Serial.print("Poll Request Polls the configuration for one I/O Port:"), Serial.println(_gpsPayload[4]), Serial.println(); // USB debug print
              break;
            case 20: // UBX-CFG-PRT 0x06 0x00 Get/Set Port Configuration for UART-USB-SPI-DDC(I²C) Port, len[20]
              // Decide what to do based on _gpsPayload:[4] Payload Content-I/O portID: 0=DDC(I2C), 1=UART1, 2=UART2, 3=USB, 4=SPI, 5=reserved
              if (_gpsPayload[4] == 1) { // 1=UART1
                GpsUart1Baud.b[0] = _gpsPayload[12];
                GpsUart1Baud.b[1] = _gpsPayload[13];
                GpsUart1Baud.b[2] = _gpsPayload[14];
                GpsUart1Baud.b[3] = _gpsPayload[15];
                gpsData_ptr->GpsUart1Baud = GpsUart1Baud.val;
                // need this for ACK_ACK print
                _GpsUartBaud = (((_gpsPayload[15] << 24) | (_gpsPayload[14] << 16)) | (_gpsPayload[13] << 8)) | _gpsPayload[12]; // Combining
              } else {
                Serial.print("I/O portID: 0=DDC(I2C), 2=UART2, 3=USB, 4=SPI, 5=reserved "), Serial.print(_gpsPayload[4]), Serial.println(" Not implemented"), Serial.println();
              }
              break;
            default:
              // Not Supported
              Serial.print("Unknown CFG PRT Length Field:"), Serial.println((_MSGpayloadSize) - 4, DEC), Serial.println();
              break;
          } //end UBX-CFG-PRT (0x06 0x00)
          break;
       [COLOR="#FF0000"] case 0x31: // UBX-CFG-TP5 (0x06 0x31) Time Pulse Parameters[/COLOR]
          gpsData_ptr->antCableDelay   = (_gpsPayload[9] << 8) | _gpsPayload[8]; // 0~32767, default 50ns
          gpsData_ptr->freqPeriodL = (((_gpsPayload[19] << 24) | (_gpsPayload[18] << 16)) | (_gpsPayload[17] << 8)) | _gpsPayload[16]; // 24000000Hz ~ 1Hz
          DCL0 = (((_gpsPayload[27] << 24) | (_gpsPayload[26] << 16)) | (_gpsPayload[25] << 8)) | _gpsPayload[24]; // (100%=4294967295)
          // re map duty cycle locked %
          // arduino "map" function and large numbers won't fit in a long integer, math overflow
          // rolling my own "map" function
          DCL1 = modifiedMap(DCL0, 0, 4294967295, -0.125, 99.875);
          gpsData_ptr->dutycycleL = DCL1;
          break;
        default:
          // Not Supported
          Serial.print("Unknown CFG Class:0x"), Serial.println((_gpsPayload[1]), HEX), Serial.println();
          break;
      }
      _UBX_CFG_ID = false;
      // return false even though its packets are successfully being received, not a NAV packet
      return false;
    }

After all that the parameters are saved in:
antCableDelay; ///< [ns], Antenna cable delay
freqPeriodL; ///< [Hz], Frequency time when locked to GPS time
dutycycleL; ///< [%], duty cycle locked %
 
Support configuration command for uBlox Library added, will release it soon needs clean up.
gps.SetCFG_TP5(15, 50.000000, 50, true); // UBX-CFG-TP5 (0x06 0x31) - Set Time Pulse 0 Parameters.
// Possible Configurations:
// SetCFG_TP5(FreqLocked- 1Hz ~ 24000000Hz, DutyLocked- 0.000000% ~ 100.000000%, antCableDelay- 0~32767ns, print usb ACK- true or false);

Time to get my hands dirty and either rip this GPS led out or hand-solder to the one side of the SMD resistor ;).

Code:
Setting CFG-PRT (0x06 0x00) GPS UART baud rate:1500000
Setting CFG-RATE (0x06 0x08) Navigation/Measurement Rate 200ms 5.00Hz
Setting CFG-NAV5 (0x06 0x24) Dynamic platform model 3: pedestrian
Setting Dis_NAV_PVT
Setting Dis_NAV_ATT
Setting Dis_NAV_POSLLH
Setting Dis_MON_IO (0x0A 0x02) I/O Subsystem Status
 Poll_MON_IO, I/O Subsystem Status
 Poll_MON_VER, Receiver/Software Version
[COLOR="#FF0000"]Setting CFG-TP5 (0x06 0x31) Time Pulse 0 Parameters	(FreqLocked) 15Hz  (DutyLocked) 50.000000% map(2147483648)  (antCableDelay) 50[/COLOR]
UBX_ACK_ACK: Message Acknowledged - CFG-PRT (0x06 0x00) Set GPS UART baud
UBX_ACK_ACK: Message Acknowledged - CFG-RATE 0x06 0x08 Get/Set Navigation/Measurement Rate Settings
UBX_ACK_ACK: Message Acknowledged - Dis_NAV_ATT -Disable periodic auto update
UBX_ACK_ACK: Message Acknowledged - Dis_NAV_PVT -Disable periodic auto update
UBX_ACK_ACK: Message Acknowledged - Dis_NAV_POSLLH -Disable periodic auto update
UBX_ACK_ACK: Message Acknowledged - Dis_MON_IO -Disable periodic auto update
UBX_ACK_ACK: Message Acknowledged - CFG-NAV5 0x06 0x24 Get/Set Navigation Engine Settings
UBX_ACK_NAK: Message Not-Acknowledged - Dis_NAV_ATT, ATT Supported only on protocol v. 19 (only with ADR or UDR products)
[COLOR="#FF0000"]UBX_ACK_ACK: Message Acknowledged - CFG-TP5 0x06 0x31[/COLOR]


 MON_IO- RX Bytes: 0	 TX Bytes: 0	 Overrun Errs: 0
 MON_VER- SW Version: 1.00	 Rev# 59842	 HW Version u-blox: 7	 Protocol: 14.00

 Poll_MON_IO, I/O Subsystem Status
 Poll_MON_VER, Receiver/Software Version

 MON_IO- RX Bytes: 6534	 TX Bytes: 2160	 Overrun Errs: 0
 MON_VER- SW Version: 1.00	 Rev# 59842	 HW Version u-blox: 7	 Protocol: 14.00

 Poll_MON_IO, I/O Subsystem Status
 Poll_MON_VER, Receiver/Software Version

 MON_IO- RX Bytes: 6558	 TX Bytes: 2432	 Overrun Errs: 0
 MON_VER- SW Version: 1.00	 Rev# 59842	 HW Version u-blox: 7	 Protocol: 14.00

 Poll_MON_IO, I/O Subsystem Status
 Poll_MON_VER, Receiver/Software Version

 MON_IO- RX Bytes: 6582	 TX Bytes: 2704	 Overrun Errs: 0
 MON_VER- SW Version: 1.00	 Rev# 59842	 HW Version u-blox: 7	 Protocol: 14.00

 Poll_MON_IO, I/O Subsystem Status
 Poll_MON_VER, Receiver/Software Version

 MON_IO- RX Bytes: 6606	 TX Bytes: 2976	 Overrun Errs: 0
 MON_VER- SW Version: 1.00	 Rev# 59842	 HW Version u-blox: 7	 Protocol: 14.00

 Poll_MON_IO, I/O Subsystem Status
 Poll_MON_VER, Receiver/Software Version

 MON_IO- RX Bytes: 6630	 TX Bytes: 3248	 Overrun Errs: 0
 MON_VER- SW Version: 1.00	 Rev# 59842	 HW Version u-blox: 7	 Protocol: 14.00

So I am currently working with the MAX M8C-0 kit from https://v3.airspy.us/product/upu-ublox-m8-pico/ I am pretty sure all models use the same messages. I am curious as how to obtain the PPS data at a period of ~5us? I am not seeing how to tell the receiver to send the time, but I have found and set the settings for the timepulse.
Thanks to those in advance!
 
Back
Top