In this post we will discuss the issue of changing the frequency or gain of the Adalm-Pluto SDR in real time in a GNU Radio application. Indeed, the Pluto is disturbed for a small second at each change of one of its parameters. In the waterfall below, we update the frequency of the local oscillator every 5s. This results in the output of Pluto by beautiful horizontal bars.
This is a phenomenon that we observe with the Pluto but not with an RTL-SDR or a HackRF One.
The PlutoSDR Source block at each change of frequency would, according to my research, reset all the parameters which results in a disturbance of the processing in progress very annoying.
The solution lies in the use of the ‘IIO Attribute Sink’ and ‘IIO Attribute Updater’ blocks which allow only the selected parameter to be touched without disturbing the processing in progress.
Programming is tricky because you have to find:
- the device: ad9361-phy
- the direction: input or output
- the channel: alvoltage0 or voltage0
- the attribute: frequency or harwaregain
in a very small online documentation.
By connecting to the pluto it is possible to extract information.
In terminal mode enter: iio_info -u ip:192.168.2.1
iio:device1: ad9361-phy 9 channels found: altvoltage0: RX_LO (output) 8 channel-specific attributes found: attr 0: external value: 0 attr 1: fastlock_load value: 0 ...... attr 5: frequency value: 144999998 attr 6: frequency_available value: [70000000 1 6000000000] attr 7: powerdown value: 0 altvoltage1: TX_LO (output) 8 channel-specific attributes found: attr 0: external value: 0 ...... attr 5: frequency value: 144941178 attr 6: frequency_available value: [46875001 1 6000000000] ..... voltage0: (output) 10 channel-specific attributes found: attr 0: filter_fir_en value: 1 attr 1: hardwaregain value: 0.000000 dB attr 2: hardwaregain_available value: [-89.750000 0.250000 0.000000] ..... voltage0: (input) 15 channel-specific attributes found: attr 0: bb_dc_offset_tracking_en value: 1 ...... attr 4: hardwaregain value: 36.000000 dB attr 5: hardwaregain_available value: [-1 1 73]
To facilitate programming I have grouped these blocks together in a small GNU Radio Companion application which uses sliders to modify the reception frequency and the gain of Adalm-Pluto.
We find the same difficulties on the transmitter channel. Note that when changing a parameter in the transmission chain, if you act directly on the PlutoSDR Sink block, the reception chain is disturbed.
In the example proposed to solve this difficulty, the sampling frequency is at 1.2 MHz. It is necessary in practice to use the same one as in the chain of reception if it works. We modify for the ad9361-phi device:
- the frequency
- channel: altvoltage1
- attribut: frequency
- the attenuation
- channel: voltage 0
Attention for the attenuation / harwaregain the values are negative between 0 and -89 in steps of 0.25. Unlike the PlutoSDR sink block where we speak of attenuation by putting positive values.
Likewise for the transmission chain, I have grouped these blocks in a small GNU Radio Companion application which uses sliders to modify the transmission frequency and the attenuation of Adalm-Pluto.