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:
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 %
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 %