AnsweredAssumed Answered

Using Simulink and Libiio to control DCXO on AD9361

Question asked by Arne_2 on Jun 9, 2015
Latest reply on Jun 10, 2015 by Arne_2

Hello,

I tried to control the DCXO on the AD9361 via Simulink and the Libiio interface block.

For this purpose, I added the DCXO course and fine tune driver to the "ad9361.cfg" file:

 

 

data_in_device = cf-ad9361-dds-core-lpc

data_out_device = cf-ad9361-lpc

ctrl_device = ad9361-phy

channel = RX_LO_FREQ,IN,out_altvoltage0_RX_LO_frequency,

channel = RX_SAMPLING_FREQ,IN,in_voltage_sampling_frequency,

channel = RX_RF_BANDWIDTH,IN,in_voltage_rf_bandwidth,

channel = RX1_GAIN_MODE,IN,in_voltage0_gain_control_mode,

channel = RX1_GAIN,IN,in_voltage0_hardwaregain,

channel = RX1_RSSI,OUT,in_voltage0_rssi,

channel = RX2_GAIN_MODE,IN,in_voltage1_gain_control_mode,

channel = RX2_GAIN,IN,in_voltage1_hardwaregain,

channel = RX2_RSSI,OUT,in_voltage1_rssi,

channel = TX_LO_FREQ,IN,out_altvoltage1_TX_LO_frequency,

channel = TX_SAMPLING_FREQ,IN,out_voltage_sampling_frequency,

channel = TX_RF_BANDWIDTH,IN,out_voltage_rf_bandwidth,

channel = DCXO_Course,IN,dcxo_tune_course,

channel = DXCO_Fine,IN,dcxo_tune_fine,

 

But when I run this with a modified version of the example file "ad9361_sim.slx", I get the following error message:

 

An error occurred while running the simulation and the simulation was terminated

MATLAB System block 'ad9361_sim_mod/AD9361/MATLAB System' error occurred when invoking 'stepImpl' method of 'iio_sys_obj'. The error was thrown from '

'D:\Simulink\libiio\hil_models\fmcomms2_3_data_stream\libiio_if.m' at line 651

'D:\Simulink\libiio\hil_models\fmcomms2_3_data_stream\iio_sys_obj.m' at line 263'.

Output argument "ch" (and maybe others) not assigned during call to "libiio_if/findAttribute".

 

Apparently, DCXO course and fine tune is not available via Libiio.

I did a quick spin over all channels and attributes that are available via function "findAttribute":

 

Ch#      Attr#       Attr-Name          Attr-Filename

0   0  input                              in_temp0_input    

1   0  fastlock_store               out_altvoltage1_TX_LO_fastlock_store    

1   1  frequency               out_altvoltage1_TX_LO_frequency    

1   2  fastlock_recall               out_altvoltage1_TX_LO_fastlock_recall    

1   3  fastlock_load               out_altvoltage1_TX_LO_fastlock_load    

1   4  fastlock_save               out_altvoltage1_TX_LO_fastlock_save    

2   0  raw               out_voltage2_raw    

2   1  scale               out_voltage2_scale    

2   2  rf_bandwidth               out_voltage_rf_bandwidth    

2   3  rf_port_select_available               out_voltage_rf_port_select_available    

2   4  filter_fir_en               out_voltage_filter_fir_en    

2   5  sampling_frequency               out_voltage_sampling_frequency    

0   0  input               in_temp0_input    

1   0  fastlock_store               out_altvoltage1_TX_LO_fastlock_store    

1   1  frequency               out_altvoltage1_TX_LO_frequency    

1   2  fastlock_recall               out_altvoltage1_TX_LO_fastlock_recall    

1   3  fastlock_load               out_altvoltage1_TX_LO_fastlock_load    

1   4  fastlock_save               out_altvoltage1_TX_LO_fastlock_save    

2   0  raw               out_voltage2_raw    

2   1  scale               out_voltage2_scale    

2   2  rf_bandwidth               out_voltage_rf_bandwidth    

0   0  input               in_temp0_input    

1   0  fastlock_store               out_altvoltage1_TX_LO_fastlock_store    

1   1  frequency               out_altvoltage1_TX_LO_frequency    

1   2  fastlock_recall               out_altvoltage1_TX_LO_fastlock_recall    

1   3  fastlock_load               out_altvoltage1_TX_LO_fastlock_load    

1   4  fastlock_save               out_altvoltage1_TX_LO_fastlock_save    

2   0  raw               out_voltage2_raw    

2   1  scale               out_voltage2_scale    

2   2  rf_bandwidth               out_voltage_rf_bandwidth    

2   3  rf_port_select_available               out_voltage_rf_port_select_available    

2   4  filter_fir_en               out_voltage_filter_fir_en    

2   5  sampling_frequency               out_voltage_sampling_frequency    

3   0  raw               out_voltage3_raw    

3   1  scale               out_voltage3_scale    

3   2  rf_bandwidth               out_voltage_rf_bandwidth    

3   3  rf_port_select_available               out_voltage_rf_port_select_available    

3   4  filter_fir_en               out_voltage_filter_fir_en    

3   5  sampling_frequency               out_voltage_sampling_frequency    

4   0  raw               in_voltage2_raw    

4   1  offset               in_voltage2_offset    

4   2  scale               in_voltage2_scale    

4   3  gain_control_mode_available               in_voltage_gain_control_mode_available    

4   4  sampling_frequency               in_voltage_sampling_frequency    

4   5  rf_port_select_available               in_voltage_rf_port_select_available    

4   6  bb_dc_offset_tracking_en               in_voltage_bb_dc_offset_tracking_en    

4   7  rf_bandwidth               in_voltage_rf_bandwidth    

4   8  rf_dc_offset_tracking_en               in_voltage_rf_dc_offset_tracking_en    

4   9  quadrature_tracking_en               in_voltage_quadrature_tracking_en    

4   10  filter_fir_en               in_voltage_filter_fir_en    

5   0  rf_port_select               in_voltage1_rf_port_select    

5   1  rssi               in_voltage1_rssi    

5   2  hardwaregain               in_voltage1_hardwaregain    

5   3  gain_control_mode               in_voltage1_gain_control_mode    

5   4  gain_control_mode_available               in_voltage_gain_control_mode_available    

5   5  sampling_frequency               in_voltage_sampling_frequency    

5   6  rf_port_select_available               in_voltage_rf_port_select_available    

5   7  bb_dc_offset_tracking_en               in_voltage_bb_dc_offset_tracking_en    

5   8  rf_bandwidth               in_voltage_rf_bandwidth    

5   9  rf_dc_offset_tracking_en               in_voltage_rf_dc_offset_tracking_en    

5   10  quadrature_tracking_en               in_voltage_quadrature_tracking_en    

5   11  filter_fir_en               in_voltage_filter_fir_en    

6   0  fastlock_recall               out_altvoltage0_RX_LO_fastlock_recall    

6   1  fastlock_store               out_altvoltage0_RX_LO_fastlock_store    

6   2  frequency               out_altvoltage0_RX_LO_frequency    

6   3  fastlock_load               out_altvoltage0_RX_LO_fastlock_load    

6   4  fastlock_save               out_altvoltage0_RX_LO_fastlock_save    

7   0  gain_control_mode               in_voltage0_gain_control_mode    

7   1  rssi               in_voltage0_rssi    

7   2  rf_port_select               in_voltage0_rf_port_select    

7   3  hardwaregain               in_voltage0_hardwaregain    

7   4  gain_control_mode_available               in_voltage_gain_control_mode_available    

7   5  sampling_frequency               in_voltage_sampling_frequency    

7   6  rf_port_select_available               in_voltage_rf_port_select_available    

7   7  bb_dc_offset_tracking_en               in_voltage_bb_dc_offset_tracking_en    

7   8  rf_bandwidth               in_voltage_rf_bandwidth    

7   9  rf_dc_offset_tracking_en               in_voltage_rf_dc_offset_tracking_en    

7   10  quadrature_tracking_en               in_voltage_quadrature_tracking_en    

7   11  filter_fir_en               in_voltage_filter_fir_en    

8   0  rf_port_select               out_voltage1_rf_port_select    

8   1  hardwaregain               out_voltage1_hardwaregain    

8   2  rssi               out_voltage1_rssi    

8   3  rf_bandwidth               out_voltage_rf_bandwidth    

8   4  rf_port_select_available               out_voltage_rf_port_select_available    

8   5  filter_fir_en               out_voltage_filter_fir_en    

8   6  sampling_frequency               out_voltage_sampling_frequency    

9   0  rssi               out_voltage0_rssi    

9   1  rf_port_select               out_voltage0_rf_port_select    

9   2  hardwaregain               out_voltage0_hardwaregain    

9   3  rf_bandwidth               out_voltage_rf_bandwidth    

9   4  rf_port_select_available               out_voltage_rf_port_select_available    

9   5  filter_fir_en               out_voltage_filter_fir_en    

9   6  sampling_frequency               out_voltage_sampling_frequency    

 

Is there any information available which channels/attributes are accessible via Simulink/Libiio?

Is there anything that I have to change in my Linux setup to make this work?

 

Regards and thanks in advance,

Arne

Outcomes