I am attempting to transmit internally generated signal via the AD9361. Software runs on target (Adalm-pluto).
The samples are generated for 20mS transmission. The time is measured
and takes about 8mS (7869498ns - 8049387ns)
To minimize process time I am using the buffer created by iio_device_create_buffer() to store the
generated samples.
There is always '1' in Status register iio_device_reg_read(tx, 0x80000088, &val);
The same code is running on host computer without any problems.
What I'm doing wrong?
Thanks.
while(!Stop)
{
...
initialization
....
tx_buffer = iio_device_create_buffer(tx, iq_buff_size, false);
if (!tx_buffer) {
perror("Could not create TX buffer");
stop();
}
char *ptx_buffer = (char *)iio_buffer_start(tx_buffer);
mybuff = (const uint16_t**)ptx_buffer;
....
printf ("iio_buffer_set_blocking_mode = %d\n",iio_buffer_set_blocking_mode(tx_buffer, true));
.......
clock_gettime(CLOCK_MONOTONIC_RAW, &tpStart);
......
sample generation code
......
clock_gettime(CLOCK_MONOTONIC_RAW, &tpEnd);
timeDelta = tpEnd.tv_nsec - tpStart.tv_nsec;
if(timeDelta < 0)
{
timeDelta += 1000000000;
}
bytesTramsmitted = iio_buffer_push(tx_buffer);
iio_device_reg_read(tx, 0x80000088, &val);
if(val == 1)
{
// printf("Sratus register %d Time delta = %ld\n",val, timeDelta);
}
if(val)
{
iio_device_reg_write(tx, 0x80000088, val);
}
}