AnsweredAssumed Answered

ad9361-iiostream on Adalm Pluto

Question asked by mitreffahcs on Jun 18, 2018
Latest reply on Jun 18, 2018 by mitreffahcs

I'm trying to get a TX example working on the Adalm Pluto using the ad9361-iiostream example, but it will not transmit continuously. It seems like regardless of what I set the sample rate to it transmits at a 50% duty cycle. I didn't paste the entire example for brevity's sake, but tried to include the important bits. I used the cross-compiling instructions that were included in the Adalm Pluto FOSDEM 2018 presentation, and I'm running this code on the Pluto itself. The sinewave code I got from AD9361 libiio sine wave transmission problem 

 

Cheers

-Tim

 

With the sample rate set to 2.5MS

2.5MS sample rate

With the sample rate set to ~250KS

250KS


// TX stream config
txcfg.bw_hz = MHZ(1); // 1 MHz rf bandwidth
txcfg.fs_hz = MHZ(2.5); // 2.5 MS/s tx sample rate
txcfg.lo_hz = MHZ(350); // 350 MHz rf frequency
txcfg.rfport = "A"; // port A (select for rf freq.)

 

printf("* Creating non-cyclic IIO buffers with 2.5 MiS\n");
txbuf = iio_device_create_buffer(tx, 2500000, false);
if (!txbuf) {
   perror("Could not create TX buffer");
   shutdown();
}

float freq = 2.0 * M_PI * 100000;
double ampl = 32767;

printf("* Starting IO streaming (press CTRL+C to cancel)\n");
while (!stop)
{
   ssize_t nbytes_tx;
   char *p_dat, *p_end;
   ptrdiff_t p_inc;

 

   // Schedule TX buffer
   nbytes_tx = iio_buffer_push(txbuf);
   if (nbytes_tx < 0) { printf("Error pushing buf %d\n", (int) nbytes_tx); shutdown(); }

 

   double i = 0.0;

 

   // WRITE: Get pointers to TX buf and write IQ to TX buf port 0
   p_inc = iio_buffer_step(txbuf);
   p_end = iio_buffer_end(txbuf);

 

   for (p_dat = (char *)iio_buffer_first(txbuf, tx0_i); p_dat < p_end; p_dat += p_inc) {
      short ipart = ampl * sin(freq * i);
      short qpart = ampl * cos(freq * i);

      ((int16_t*)p_dat)[0] = ipart; // Real (I)
      ((int16_t*)p_dat)[1] = qpart; // Imag (Q)

      i = i + (1.0 / txcfg.fs_hz);
   }

}

shutdown();

Outcomes