Streaming a custom waveform


Would it be possible for someone to provide me a little more information on this LMS API function:

API_EXPORT int CALL_CONV LMS_UploadWFM ( lms_device_t * device, const void ** samples, uint8_t chCount, size_t sample_count, int format ) ?

In particular, what exactly is the channel count and the format? Or maybe, help me understand what I am doing wrong, right now.

I’m using Mathematica to generate a vector with 5000 samples ([I1,Q1,…,I5000,Q5000]) of a simple wave at 800MHz. Then I create 2 buffers: TxBuffer and RxBuffer. I write the created samples to TxBuffer and use the LMS API function LMS_SendStream to send the streams. I have a cable connecting Tx1_1 to Rx1_L (optimized for 800 MHz) and I receive the samples to the RxBuffer wit the LMS API function LMS_RecStream. Here is the important bit of the code:

    LMS_SendStream(&tx_stream, Txbuffer, sampleCnt, NULL, 1000);
    int samplesread;
    samplesread=LMS_RecvStream(&rx_stream, Rxbuffer, sampleCnt, NULL, 1000);
    cout << "Samples read: " << samplesread << endl;

    for (int j = 0; j < samplesread; ++j)
        Ifile << Rxbuffer[2*j] << endl;
        Qfile << Rxbuffer[2*j+1] << endl;

The Ifile and the Qfile are just arbitrary files that save the Qdata and the Idata which I then read back with Mathematica and perform the FFT of the data. The problem is that this script only works sometimes, i.e, sometimes I have good data output and sometimes I get random data with no peaks on the FFT. I just want to make sure that probably the error is within the LMS7002M configuration and not the sending and the receiving of the 5000 samples (only send and read once).

I’m not sure if the correct use of those two functions should use the Txbuffer and Rxbuffer parameters or the &Txbuffer and &Rxbuffer parameters (anyone?), since Txbuffer and Rxbuffer, right now, are int16_t buffers. Or if the code I wrote make sense.

I know that probably Octave is better than Mathematica for these applications, but I think that since what I need is to transmit an arbitrary sample list, both should be fine. My problem is the correct use of the receiving and transmitting functions of the LMS API to stream without the use of LimeSuiteGUI.

If this doesn’t make sense, then I return to my original question and maybe someone can shed me a little more light on the correct use of LMS_UploadWFM.


P.S: I’m having a lot of questions about the LMS_API functions and I think I found some errors on the schematic of the board and on the calibration manual of the LMS7002M. To whom should I speak?