09-21-2023 02:01 PM
Hello,
I am trying to follow the instructions laid out in the webpage Configuring GPS Synchronization with the NI PXI-668x Timing and Synchronization Module - NI.
Specifically the portion about Synchronizing PXI_Clk10 to the GPS Time Reference.I am looking at Single-Board Disciplining with the PXI-6683H. I have a PXI-6683H in the 6th hybrid slot of the PXIe-1082 Chassis with a PXIe-8840 Quad-Core Embedded Controller.
I have connected the PXI-6683H's CLK OUT to the chassis' 10 MHz Ref In. In the NI MAX program, under the PXI-6683H drop down menu, and in the routing tab, I am unable to locate the Oscillator, ClkOut, PXI_Clk10, or BoardClk. I do, however, see these in the settings tab showing the routing of possible sources and destinations
Why am I unable to route these signals like it requests in the tutorial, but they are know to the system by representation of the settings tab?
Driver versions:
NI SYNC 21.8.0
NI MAX 21.5.0
Attached display the settings tab for the PXI-6683H and all the available routing options for the PXI-6683H in the routing tab.
09-21-2023 02:25 PM
Another thing to add, I was able to run the the NI-SYNC C API for the example routing the clocks with no errors. Here is an example code for testing the functionality of the PXI-6683H as well as for testing the routing. on line 97 and 98.
//*************************************************************
//** Name: NI-SYNC Route Triggers.c **
//*************************************************************
//Description:
//This code can route triggers from an external line to the
//backplane, or from the backplane to an external line.
//Specifically, this code will route the triggers from the
//"Source Terminal" inputs to their respective
//"Destination Terminal" location.
//HW Requirements:
//PXI-6651
//PXI-6652
//PXI-6653
//PXIe-6672
//PXIe-6674T
//PXI-6682(H)
//PXI-6683(H)
//Connections:
//Possible connection made to one or more PFI lines, depending
//on the routes.
//****************************** INCLUDES *********************
#include "niSync.h"
#include "visa.h"
#include "NIDAQmx.h"
#include <string.h>
#include <math.h>
#include <time.h>
#include <stdio.h>
#include <iostream>
//******************* ERROR_CHECK ***************
#ifndef ERROR_CHECK
#define ERROR_CHECK(fCall) if (status = (fCall), status < 0) \
{goto Error;} else
#endif
//THE FOLLOWING BLOCK OF DECLARATIONS CONTAINS PARAMETERS THAT YOU MAY NEED TO
//CHANGE FOR YOUR PARTICUALR SYSTEM. PLEASE MODIFY THEM APPROPRIATELY.
static ViRsrc instDesc66xx = "PXI13::14::INSTR";
//static ViRsrc instDesc66xx = "PXI-6683H"; //instrument descriptor for 66xx this is PXI-6683H found in NI MAX
//THE FOLLOWING BLOCK OF VARIBALES ARE USED INTERNALLY BY THE PROGRAM.
//THERE SHOULD NOT BE ANY NEED TO MODIFY THEIR INITIAL VALUES.
static ViSession session66xx;
static ViInt32 status;
static ViChar errStr[512];
static ViChar refName[512];
static uInt16 year;
static char *monthStr[]={"<invalid>","January","February","March","April","May","June","July","August","September","October","November","December"};
void GetTimeFromGPSSeconds(ViUInt32 secondsSinceJan1, float64 *seconds, uInt8 *minutes, uInt8 *hours, uInt8 *date, uInt8 *month);
//****************************** MAIN *************************
int main (int argc, char *argv[])
{
ViUInt32 timestampSeconds (0), timestampNanoseconds (0), gpsSeconds (0), gpsNanoseconds (0);
ViUInt16 timestampFractionalNanoseconds (0), gpsFractionalNanoseconds (0);
ViUInt32 timeSeconds (0), timeNanoseconds (0);
ViUInt16 timeFractionalNanoseconds (0);
ViReal64 latitude (0), longitude (0), altitude (0);
ViInt16 selfTestResult (0);
ViChar selfTestMessage[256];
ViConstString terminal = "/PXI-4461/PXI_Trig0";
ViBoolean gpsMobileMode = VI_FALSE;
ViBoolean gpsAntennaConnected;
ViInt32 gpsStatus;
ViInt32 numberOfSatellites = 0;
uInt8 month,day,hours,minutes;
float64 seconds;
time_t calTime;
struct tm *locTime;
//Open Session to timing module
ERROR_CHECK (niSync_init (instDesc66xx, VI_TRUE, VI_FALSE, &session66xx));
ERROR_CHECK (niSync_GetTimeReferenceNames(session66xx, 512, refName));
std::cout << "Time References " << refName << std::endl;
ERROR_CHECK (niSync_SetTimeReferenceGPS (session66xx));
ERROR_CHECK (niSync_EnableGPSTimestamping (session66xx));
ERROR_CHECK (niSync_ReadLastGPSTimestamp(session66xx, ×tampSeconds, ×tampNanoseconds,
×tampFractionalNanoseconds, &gpsSeconds, &gpsNanoseconds, &gpsFractionalNanoseconds));
ERROR_CHECK (niSync_GetTime (session66xx, &timeSeconds, &timeNanoseconds, &timeFractionalNanoseconds));
ERROR_CHECK (niSync_SetAttributeViBoolean(session66xx, "", NISYNC_ATTR_GPS_MOBILE_MODE, gpsMobileMode));
std::cout << "GPS mobile mode " << gpsMobileMode << std::endl;
ERROR_CHECK (niSync_GetAttributeViInt32(session66xx, "", NISYNC_ATTR_GPS_SATELLITES_AVAILABLE, &numberOfSatellites));
std::cout << "GPS number of Satellites " << numberOfSatellites << std::endl;
ERROR_CHECK (niSync_GetAttributeViBoolean(session66xx, "", NISYNC_ATTR_GPS_ANTENNA_CONNECTED, &gpsAntennaConnected));
std::cout << "GPS Antenna connected " << gpsAntennaConnected << std::endl;
ERROR_CHECK (niSync_GetAttributeViInt32(session66xx, "", NISYNC_ATTR_GPS_STATUS, &gpsStatus));
std::cout << "GPS valid state " << gpsStatus << std::endl;
ERROR_CHECK (niSync_GetLocation (session66xx, &latitude, &longitude, &altitude));
ERROR_CHECK (niSync_ConnectClkTerminals(session66xx, NISYNC_VAL_OSCILLATOR, NISYNC_VAL_CLKOUT));
ERROR_CHECK (niSync_ConnectClkTerminals(session66xx, NISYNC_VAL_CLK10, NISYNC_VAL_BOARD_CLK));
//niSync_CreateFutureTimeEvent (session66xx, ViConstString terminal, ViInt32 outputLevel, ViUInt32 timeSeconds, ViUInt32 timeNanoseconds, ViUInt16 timeFractionalNanoseconds)
std::cout << "timestamp Seconds " << timestampSeconds << std::endl;
std::cout << "timestamp Nanoseconds " << timestampNanoseconds << std::endl;
std::cout << "timestamp fractional Nanoseconds " << timestampFractionalNanoseconds << std::endl;
std::cout << "gps Seconds " << gpsSeconds << std::endl;
std::cout << "gps Nanoseconds " << gpsNanoseconds << std::endl;
std::cout << "gps fractional Nanoseconds " << gpsFractionalNanoseconds << std::endl;
std::cout << "time Seconds " << timeSeconds << std::endl;
std::cout << "time Nanoseconds " << timeNanoseconds << std::endl;
std::cout << "time fractional Nanoseconds " << timeFractionalNanoseconds << std::endl;
std::cout << "Latitude " << latitude << std::endl;
std::cout << "Longitude " << longitude << std::endl;
std::cout << "Altitude " << altitude << std::endl;
GetTimeFromGPSSeconds(gpsSeconds,&seconds,&minutes,&hours,&day,&month);
printf("The time is %2u:%02u:%05.2f %s %u, %u\n",hours,minutes,seconds,monthStr[month],day+1,year);
return 0;
Error:
if (session66xx)
niSync_close (session66xx);
niSync_error_message (VI_NULL, status, errStr);
printf("Error %d occurred: %s ",status, errStr);
fflush(stdin);
getchar();
return status;
}
void GetTimeFromGPSSeconds(ViUInt32 secondsSinceJan1, float64 *seconds, uInt8 *minutes, uInt8 *hours, uInt8 *date, uInt8 *month)
{
float64 fminutes,fhours,fdays,febDays;
// Convert seconds to raw days
fdays = secondsSinceJan1/86400.0;
// Account for leap year
febDays = year%4==0 && (year%100!=0 || year%400==0) ? 29.0 : 28.0;
*month = 0;
// Get month from days
if( fdays<=31.0 ) *month = 1;
else if( fdays<=31.0+febDays ) { *month = 2; fdays -= 31.0; }
else if( fdays<=62.0+febDays ) { *month = 3; fdays -= (31.0 + febDays); }
else if( fdays<=92.0+febDays) { *month = 4; fdays -= 62.0+febDays; }
else if( fdays<=123.0+febDays ) { *month = 5; fdays -= 92.0+febDays; }
else if( fdays<=153.0+febDays ) { *month = 6; fdays -= 123.0+febDays; }
else if( fdays<=184.0+febDays ) { *month = 7; fdays -= 153.0+febDays; }
else if( fdays<=215.0+febDays ) { *month = 8; fdays -= 184.0+febDays; }
else if( fdays<=245.0+febDays ) { *month = 9; fdays -= 215.0+febDays; }
else if( fdays<=276.0+febDays ) { *month = 10; fdays -= 245.0+febDays; }
else if( fdays<=306.0+febDays ) { *month = 11; fdays -= 276.0+febDays; }
else { *month = 12; fdays -= 306.0+febDays; }
// Get hours from remainder of days
fhours = 24.0 * modf(fdays,&fdays);
*date = (uInt8)fdays + 1; // Date begins count from 1, not 0
// Get minutes from remainder of hours
fminutes = 60.0 * modf(fhours,&fhours);
*hours = (uInt8)fhours;
// Get seconds from remainder of minutes
*minutes = (uInt8)fminutes;
*seconds = 60.0 * modf(fminutes,&fminutes);
}