Hello everyone, I am using USRP2 with XCVR2450 daughter card with Windows XP and MATLAB R2011a in 2.4GHz ISM band.
I am trying to implement a simple spectrum analyzer (based on energy detection) with MATLAB's SDRu package (NOT Simulink!!!). I started with a demo provided with the SDRu package (sdruFRSGMRSReceiver.m) and changed it to implement a simple fftplot. I am using fftplot.m given on following link: http://gnuradio.org/redmine/projects/gnuradio/repository/revisions/master/show/gnuradio-core/src/utils Here is my code: ---------USRP2 parameters--------------- USRP_SAMPLE_RATE = 100e6; params.USRPDecimationFactor = 4; params.USRPGain = 5; params.FrontEndSampleRate = USRP_SAMPLE_RATE/params.USRPDecimationFactor; params.USRPFrameLength = 1024; ------------SDRu initilization------------- if strcmp(findsdru, 'No devices found') hSDRu = comm.SDRuReceiver( ... 'CenterFrequencySource', 'Input port', ... 'Gain', frsRx.USRPGain, ... 'DecimationFactor', frsRx.USRPDecimationFactor, ... 'SampleRate', frsRx.FrontEndSampleRate, ... 'FrameLength', frsRx.USRPFrameLength, ... 'OutputDataType', 'single') usrpAvailable = false; else hSDRu = comm.SDRuReceiver('192.168.10.2', ... 'CenterFrequencySource', 'Input port', ... 'Gain', frsRx.USRPGain, ... 'DecimationFactor', frsRx.USRPDecimationFactor, ... 'SampleRate', frsRx.FrontEndSampleRate, ... 'FrameLength', frsRx.USRPFrameLength, ... 'OutputDataType', 'single') usrpAvailable = true; end % Get the carrier frequency for the selected channel fc = convertChan2Freq(channel); ------------main loop of my program----------------- % Loop until it reaches the target stop time. timeCounter = 0; StopTime = 10 while timeCounter < StopTime [data, len] = step(hSDRu, fc); figure plotfft (data, frsRx.FrontEndSampleRate) timeCounter = timeCounter + 1; end ------------------------------------------------------- ------------------------------------------------------- Using this code, I never see any signals in my plots, which are actually there as I can see from a spectrum analyzer which I have at my desk. In my plot I see only one peak at center frequency. My USRP2/MATLAB setup, SD card, UHD etc are all properly configured and working fine since I have tested with MATLAB's demos. My first question, is it correct way to configure the USRP2 using MATLAB. I mean I am only setting gain, decimation, samplerate, and frame length- Is anything else is required. Otherwise, should I do something between reading data from USRP2 (i.e.[data, len] = step(hSDRu, fc); ) and fftplot(). I mean I am directly computing FFT using data read from USRP2, Is it correct OR should something else be done to prepare this data??? In [data, len] = step(hSDRu, fc), 'len' is always 0 even though I am getting some complex numbers in 'data', can you please comment why this is so. Best Regards -- View this message in context: http://old.nabble.com/USRP2-MATLAB-tp33298912p33298912.html Sent from the GnuRadio mailing list archive at Nabble.com. _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio