2) Connect the 1PPS receiver output to port 2 of the device.
3) Connect the RS232 receiver output to your PC.
4) Determine the COM port number and baud rate of the data transfer over RS232 to your PC.
5) Open the device via bbOpenDevice
6) Ensure the RS232 connection is not open.
7) Use bbSyncCPUtoGPS to synchronize the API timing with the current GPS time. This function
will release the connection when finished.
8) Configure the device for I/Q streaming.
9) Before initiating the device, use bbConfigureIO and configure port 2 for an incoming rising edge
trigger via BB_PORT2_IN_TRIGGER_RISING_EDGE.
10) Call bbInitiate(id, BB_STREAMING, BB_TIME_STAMP). The BB_TIME_STAMP argument will tell
the API to look for the 1PPS input trigger for timing.
11) If initiated successfully you can now fetch data via bbFetchRaw. Calling the function
bbQueryTimestamp will return the time of the first sample in the array of data collected from
the last bbFetchRaw.
12) From the time retrieved, you can estimate the time of any sample knowing the difference in
time between two samples is typically 12.5ns * decimation.
Code Example
Here we see a sample program following the steps mentioned above for setting up and retrieving time
stamps for data.
// Open the device as usual
int handle;
bbOpenDevice(&handle);
// Configure an I/Q data stream as usual
bbConfigureCenterSpan(handle, 2400.0e6, 20.0e6);
bbConfigureLevel(handle, -20.0 BB_AUTO_ATTEN);
bbConfigureGain(handle, BB_AUTO_GAIN);
bbConfigureIQ(handle, 4, 6.0e6);
// Configure the device to accept input triggers on port 2
// The 1 PPS trigger will be connected to port 2
bbConfigureIO(handle, 0, BB_PORT2_IN_TRIGGER_RISING_EDGE);
// At this point the GPS receiver must be operational
// The RS232 connection cannot be open, and the COM port
// and the baud rate must be known
// Ensure the receiver is locked
bbSyncCPUtoGPS(3, 38400);
// If syncCPUtoGPS returned successfully the device can now be initialized
// and the RS232 connection should now be closed.
// Note: BB_TIME_STAMP is required so the device treats input triggers as the
// GPS 1 PPS
bbInitiate(handle, BB_STREAMING, BB_STREAM_IQ | BB_TIME_STAMP);
// Allocate an array large enough for the I/Q stream configured
int buffer_len;
bbQueryStreamInfo(handle, &buffer_len, 0, 0);
float *iq_buffer;
iq_buffer = new float[buffer_len * 2];