The documentation is available on the Github Pages.
Using the radio through USB.
using AdalmPluto; # Opening the radio with 100MHz carrier frequency, 3MHz sampling rate, and 64dB gain. radio = openPluto(Int(100e6), Int(3e6), 64; bandwidth=Int(20e6)); # Receive the samples sig = zeros(ComplexF32, 1024*1024) # 1 MiS buffer recv!(sig, radio); # Do some treatment # ... # ... # Close the radio close(radio);
Running the examples
This example records a few seconds of FM radio as WAV to
.../AdalmPluto.jl/examples/samples/fm.wav. The duration and station selection have to be modified by editing
To launch the example (from the root folder of the project) :
julia --startup-file=no --project=./examples ./examples/fm.jl.
The actual sampling rate has been measured using the file
benchmark.jl. The full results of the last run is available in
The functions timed are :
C_iio_buffer_refillalone, which queries samples from the hardware.
C_iio_channel_readfor the IQ channels. The read function demultiplexes and converts to host format the data.
AdalmPluto.refillJuliaBufferRXwhich is the same thing as before with
reinterpretadded to convert the samples to
recv!which calls the previous function and reads from the Julia buffer into the target array.
With julia lauched from the example folder :
julia> include("benchmark.jl"); julia> plot, results = bench_all(); julia> plot # to display a (very) basic unicode plot
This takes quite a while as each results are timed separately and the radio saturates quite quickly.
Functions that should be used :
iio_channel_convert_inverseto convert data to the hardware format (endianess and bit alignement).
iio_channel_get_data_formatto get the data format if you want to do the convertion manually.
iio_buffer_[first|start|step|end]to get the pointers and distance between samples.
iio_buffer_pushto send the data to the hardware.
The artifact used for the proof of concept is hosted here.
It has been compiled using the following options :
git clone https://github.com/analogdevicesinc/libiio.git cd libiio mkdir build cd build cmake ../ -DCMAKE_BUILD_TYPE=Release -DWITH_LOCAL_CONFIG=OFF -DINSTALL_UDEV_RULE=OFF -DWITH_USB_BACKEND=YES -DWITH_NETWORK_BACKEND=YES -DWITH_LOCAL_BACKEND=YES -DWITH_XML_BACKEND=YES -DWITH_SERIAL_BACKEND=NO -DWITH_EXAMPLES=YES make -j$(nproc) tar cvzf libiio-0.21-custom.tar.gz libiio.so* tests/iio_* iiod/iiod .version
In order to work properly, the artifact needs a udev rule to access the USB peripherals. It is written in a volatile folder, hence the need the input the sudo password after each reboot.
The password prompt does not come from Julia and no information about the password goes through julia. See the
.../AdalmPluto.jl/src/libIIO/libIIO.jl for more details.