0

I'm using AD9361 on FMCOMMS-3 board to control some optical setup. To do so I need to send one signal to the first device (x-axis acousto-optical deflector) and another signal to the second device (y-axis AOD). It is crucial, that the signals for x and y are synced (sent simultaneously).

I operate with the chip via libiio. I've filled the buffers corresponding to both axes with the desired data (there are 2 buffers corresponding to 2 devices).

In theory, now I have to call iio_buffer_push() on both buffers, but AFAIK this function is synchronous - it will return only after all the data is sent by the device. How can I push buffers to two devices, so that the transmitted signals will be sent simultaneously?

totikom
  • 181
  • 8
  • You need to modify this example library to make this function call not blocking – 0___________ Feb 08 '23 at 13:13
  • Aside: _synced_ is an ambiguous way to describe when each signal is to arrive to its respective target sensor, with respect to each other. It implies that each signal will be sent according to a precise clock tick, but nothing about the order in which the signal arrives. Does one arrive following the other at a precise time (sequentially), or should they arrive precisely at the same time? (simultaneously?) eg _"so that the transmitted signals will be simultaneous?"_ – ryyker Feb 08 '23 at 13:49
  • The post should also provide the code you have created already with explicit notes to explain exactly where in the code you believe the problem is that you are attempting to change. It should be a [mcve]. – ryyker Feb 08 '23 at 13:51

1 Answers1

1

You can use iio_buffer_set_blocking_mode() to set an iio_buffer to non-blocking mode. That way, iio_buffer_push() will not block, and will return immediately. e.g. see this documentation.

e.g.

    iio_buffer_set_blocking_mode(somebuff, false); // Set non-blocking mode
    iio_buffer_push(somebuff); // Returns immediately
    iio_buffer_push(otherbuff);
pmacfarlane
  • 3,057
  • 1
  • 7
  • 24