AnsweredAssumed Answered

Problem generating IQ waves on M8190 using c++ (visa.h)

Question asked by AELP on Nov 29, 2016
Latest reply on Nov 22, 2017 by thysell

I'm trying to generate I and Q data by running a C++ code I wrote extending the example found in the documentation. If I only try to generate a sine wave using channel 1 the code runs flawlessly. But if I try transmitting the same on channel 2, nothing comes out. Reasonably, if I use the soft panel I can manage to output waveforms on Ch1, Ch2, or Ch1 (I) and Ch2 (Q), so I don't think it's a hardware issue. 

Below is an extract from the code I'm using:

/* Configure AWG Parameters */
/*Select Reference Oscillator AXI*/
init_error = viPrintf(*vi, ":ROSC:SOUR AXI\n");
/*Set the sample rate to 10GHz*/
init_error = viPrintf(*vi, ":FREQuency:RASTer 10.0E+09\n");
/*Set the Amplitude of Channel 1*/
init_error = viPrintf(*vi, ":DAC:VOLTage:AMPL 0.6500\n");
/*Set the Amplitude of Channel 2*/
init_error = viPrintf(*vi, ":DAC2:VOLTage:AMPL 0.6500\n");
//Set the Offset of Channel 1 and 2
init_error = viPrintf(*vi, ":DAC:VOLTage:OFFSet 0\n");
init_error = viPrintf(*vi, ":DAC2:VOLTage:OFFSet 0\n");
//Select Output Path Channel 1
init_error = viPrintf(*vi, ":OUTPut1:ROUTe DAC\n");
//Select Output Path Channel 2
init_error = viPrintf(*vi, ":OUTPut2:ROUTe DAC\n");

/* Set up waveform and transmit: */
error = viPrintf(vi, ":TRACe1:DELete:ALL\n");
error = viPrintf(vi, ":TRACe2:DELete:ALL\n");
error = viPrintf(vi, ":TRACe1:DEFine 1,%d,0,1\n", SampCount);
error = viPrintf(vi, ":TRACe2:DEFine 1,%d,0,1\n", SampCount);
error = viWrite(vi, &outSig[0], (ViUInt32)outSig.size(), wrCount);
error = viFlush(vi, VI_WRITE_BUF);
error = viPrintf(vi, ":OUTPut1 on\n");
error = viPrintf(vi, ":OUTPut2 on\n");
error = viPrintf(vi, ":TRAC1:SELect 1\n");
error = viPrintf(vi, ":TRAC2:SELect 1\n");
error = viPrintf(vi, ":INITiate:IMM1\n");
error = viPrintf(vi, ":INITiate:IMM2\n");

After executing the previous I get a sinewave (outSig) coming out of ch1 but nothing from ch2. (I know "I" should be cos(x) and "Q" should be sin(x), but just for the sake of this test I'm transmitting the same signal through both channels.)
Now, I've tried defining a new segment and selecting it for TRAC2, this does not work, I get: "Device-specific error; CH2: Segment id X is invalid", Followed by: "Device-specific error; CH2: Segment id X is not defined" where X is a decimal number to reference the new segment.
Is there a restriction in where to define a segment in the memory depending on the channel? The same segment can't be used twice?

Any ideas?