# Streaming a custom waveform

**URL:** https://discourse.myriadrf.org/t/streaming-a-custom-waveform/1985
**Category:** Lime Suite
**Created:** [9 November 2017 10:10 UTC](https://discourse.myriadrf.org/t/streaming-a-custom-waveform/1985 "2017-11-09T10:10:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Franco](https://avatars.discourse-cdn.com/v4/letter/f/e19b73/32.png) [@Franco](https://discourse.myriadrf.org/u/Franco)
#### Post date: [9 November 2017 10:10 UTC](https://discourse.myriadrf.org/t/streaming-a-custom-waveform/1985/1 "2017-11-09T10:10:56Z")

</div>

Hello.

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.

Thanks,  
Franco

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?
