The brand-new PN400 Phase Noise Test System is available for purchase! →

jgauthier

Forum Replies Created

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • in reply to: BB60C matlab bbgetiq.m example code #237580
    jgauthier
    Participant

    Yes – purge is set to true.

    The VSG waveform for now is short – it’s the simple CW waveform (iq = complex(1, 0) ) from the MATLAB examples in the SDK. The elapsed time from the start of transmitting the waveform from the VSG to returning from the GetIQData function (calling bbGetIQUnpacked and converting the returned array to complex) is < 0.20 seconds, so I’d think I wouldn’t need a separate thread just yet… But I’ll investigate doing it if I have to.

    I’ve made the attached script just about as simple as I can get it. I’ve allowed for up to 4 triggers when grabbing I/Q data.

    • This reply was modified 6 years ago by jgauthier.
    Attachments:
    You must be logged in to view attached files.
    in reply to: BB60C matlab bbgetiq.m example code #237578
    jgauthier
    Participant

    The PC is a Dell laptop with an i7-5600U CPU @ 2.6GHz with 8GB RAM running Windows 10 Enterprise 1809…

    The drive is a SanDisk X300 256GB MSATA SSD. According to UserBench SpeedTest, here’s the performance #’s:

    1. Avg. Sustained Write Speed 203MB/s
    2. Avg. Sequential Mixed IO Speed 242MB/s

    Borderline, I guess?

    JonG

    in reply to: BB60C matlab bbgetiq.m example code #237574
    jgauthier
    Participant

    I should add that:

    *I’m collecting at the highest resolution: decimation = 1 and bandwidth = 27MHz.
    *The VSG60’s signal output is connected directly to the BB60 signal input (with a physical cable and 10dB attenuator).

    I’ve tried varying iqlen from 4096 [2^12] to 1048576 [2^20] with no real difference – I don’t see a trigger event. I’ve checked to make sure I have the VSG port2 (trigger out) connected to BB60 port 2, and the BB60 is set to trigger on the pulse leading edge…

    I have the trigger length set to the default of 10 usec.

    I’ll have to check and see if the PC’s SSD can sustain writes of 250MB/sec…

    JonG

    • This reply was modified 6 years ago by jgauthier.
    • This reply was modified 6 years ago by jgauthier.
    in reply to: BB60C matlab bbgetiq.m example code #237573
    jgauthier
    Participant

    Andrew,

    Still not seeing triggers. Could it be the order I’m executing things?

  • bbConfigureIO(int32(0), int32(64))
  • bbConfigureIQCenter(CenterFreq)
  • bbConfigureIQ(downsample, bandwidth)
  • vsgSetFrequency(CenterFreq)
  • bbConfigureIQCenter(CenterFreq)
  • bbInitiate(uint32(4), uint32(0))
  • vsgSubmitTrigger()
  • vsgSubmitIQ(iqPtr, count)
  • vsgFlushAndWait()
  • GetIQData(iqCount, purge)
  • I tried switching the order of vsgFlushAndWait and GetIQData, but it makes no difference.

    In GetIQData, I have:

    function [status, iqArray] = GetIQData(handle, iqCount, purge)
        nullPtr = int32(0); 
        purgeArg = int32(purge);
    
        iqArrayPtr = libpointer('singlePtr', zeros(iqCount*2, 1));
        iqCountInt = int32(iqCount);
    
        triggerPtr = libpointer('int32Ptr', ones(4,1)); % pointer to array of 32-bit integers
        triggerCount = int32(4); % size of the trigger array (32-bit int)
    
        status = calllib('bb_api','bbGetIQUnpacked',handle,...
                iqArrayPtr,iqCountInt,triggerPtr,triggerCount,...
                purgeArg,nullPtr,nullPtr,nullPtr,nullPtr);
        calllib('vsg_api', 'vsgFlushAndWait', handle);
        fprintf('Triggers:\n');
        triggers = triggerPtr.Value;
        disp(triggers);
        % Convert results to complex numbers
        iqArray = reshape(iqArrayPtr.Value, 2, iqCount);
        iqArray = iqArray(1,:) + 1i * iqArray(2,:);
        iqArray = transpose(iqArray);
    end % of GetIQData

    And I still find no triggers – disp(triggers) shows:

    Triggers:
       0
       0
       0
       0

    Any hints?

    Thanks,
    JonG

in reply to: BB60C matlab bbgetiq.m example code #237533
jgauthier
Participant

Still having a few problems…

If I’ve done the following:

    vsgSubmitTrigger
    vsgSubmitIQ
    vsg.transmit(waveform, mode) which calls vsgOutputWaveform or vsgRepeatWaveform
    then later call vsg.stop (which does a vsgAbort)

If I call vsg.transmit again, will it still output a trigger, or do I have to submit trigger again?

Thanks,
JonG

in reply to: BB60C matlab bbgetiq.m example code #237494
jgauthier
Participant

MATLAB didn’t seem to like the type int32ptr passed in libpointer, but it seems to be case sensitive in my version – int32Ptr worked fine…

in reply to: BB60C matlab bbgetiq.m example code #237485
jgauthier
Participant

Thanks, Andrew!

Yes – I was configuring the BB60 to capture on rising edge of trigger in bbconfigureiq.m…

I’ll try your code examples and get back to you

in reply to: BB60C matlab bbgetiq.m example code #237478
jgauthier
Participant

Back at it after a week’s vacation…

I realized I was calling libpointer with the wrong parameters, so I changed it to:

triggerCount = int32(70); % size of the trigger array (32-bit int)
                                  % from SDK example "iq_external_trigger.cpp"
        triggerArray = 0:0:triggerCount; % array where we'll store trigger events...
        triggers = libpointer('int32', triggerArray); % pointer to array of 32-bit ints
...
status = calllib('bb_api','bbGetIQUnpacked',handle,iqarrayptr,iqcountint,triggers,triggerCount,purgearg,nullptr,nullptr,nullptr,nullptr);

I still get an error, but it’s

Parameter must be scalar.

Error in libpointer (line 21)
 ptr=lib.pointer(varargin{:});

Error in bbgetiq (line 67)
        triggers = libpointer('int32', triggerArray); % pointer to array of 32-bit ints

Are there any working examples of calling that C-library function from MATLAB? I’m stumped.

in reply to: BB60C matlab bbgetiq.m example code #237442
jgauthier
Participant

I’m getting there, but having problems with MATLAB.

I started with the bbgetiq.m in the SDK, and modified it by trying to redefine the array triggers and the size of it triggerCount as specified in the API manual for bbGetIQUnpacked.

I tried:


triggerCount = int32(70);
triggers = libpointer('int32', triggerCount);
 calllib('bb_api','bbGetIQUnpacked',handle,iqarrayptr,iqcountint,...
triggers,triggerCount,purgearg,nullptr,nullptr,nullptr,nullptr);

but MATALAB complains:


Error using calllib
Array must be numeric or logical or a pointer to one

I can’t figure out how to properly define an array of integers ‘triggerCount’ long…

in reply to: BB60C matlab bbgetiq.m example code #237437
jgauthier
Participant

Thanks, Andrew

I guess I wasn’t specific enough. I want the step the VSG60 output of a simple CW waveform, stepping from a begin frequency to an ending frequency, and to output a trigger to the BB60 so it can grab IQ samples at each step when it sees the trigger input…

I hadn’t seen the iq_external_trigger.cpp example – that certainly helps!

in reply to: BB60C matlab bbgetiq.m example code #237433
jgauthier
Participant

Thanks! Is there any example MATLAB code to collect IQ data upon a trigger input from the VSG60 to the BB60? Going through the SDK, all I find on triggers is in the API, not any of the sample code. I.e, do I have to add to VSG60.m to get trigger output status, or should I write a dedicated function for that?

Viewing 11 posts - 1 through 11 (of 11 total)