diff --git a/ad9361_sim.slx b/ad9361_sim.slx deleted file mode 100644 index eed2305..0000000 Binary files a/ad9361_sim.slx and /dev/null differ diff --git a/ad9361.cfg b/fmcomms2_3/ad9361.cfg similarity index 80% rename from ad9361.cfg rename to fmcomms2_3/ad9361.cfg index 7e4b5bc..87d0bc7 100644 --- a/ad9361.cfg +++ b/fmcomms2_3/ad9361.cfg @@ -7,6 +7,9 @@ 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, diff --git a/fmcomms2_3/ad9361_sim.slx b/fmcomms2_3/ad9361_sim.slx new file mode 100644 index 0000000..c95b3d7 Binary files /dev/null and b/fmcomms2_3/ad9361_sim.slx differ diff --git a/fmcomms4/ad9364.cfg b/fmcomms4/ad9364.cfg new file mode 100644 index 0000000..ae4a027 --- /dev/null +++ b/fmcomms4/ad9364.cfg @@ -0,0 +1,12 @@ +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 = RX_GAIN_MODE,IN,in_voltage0_gain_control_mode, +channel = RX_GAIN,IN,in_voltage0_hardwaregain, +channel = RX_RSSI,OUT,in_voltage0_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, diff --git a/fmcomms4/ad9364_sim.slx b/fmcomms4/ad9364_sim.slx new file mode 100644 index 0000000..6996281 Binary files /dev/null and b/fmcomms4/ad9364_sim.slx differ diff --git a/fmcomms5/ad9361-1.cfg b/fmcomms5/ad9361-1.cfg new file mode 100644 index 0000000..0c98d7d --- /dev/null +++ b/fmcomms5/ad9361-1.cfg @@ -0,0 +1,15 @@ +data_in_device = cf-ad9361-dds-core-lpc +data_out_device = cf-ad9361-A +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, diff --git a/fmcomms5/ad9361-2.cfg b/fmcomms5/ad9361-2.cfg new file mode 100644 index 0000000..fc44b0c --- /dev/null +++ b/fmcomms5/ad9361-2.cfg @@ -0,0 +1,14 @@ +data_in_device = cf-ad9361-dds-core-B +ctrl_device = ad9361-phy-B +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, diff --git a/fmcomms5/fmcomms5.slx b/fmcomms5/fmcomms5.slx new file mode 100644 index 0000000..fb01a4a Binary files /dev/null and b/fmcomms5/fmcomms5.slx differ diff --git a/libiio_if.m b/libiio_if.m index d6343f5..f22b439 100644 --- a/libiio_if.m +++ b/libiio_if.m @@ -221,12 +221,22 @@ classdef libiio_if < handle % Check if the number of channels in the device % is greater or equal to the system object % input channels - if(obj.iio_scan_elm_no < ch_no) + if(obj.iio_scan_elm_no < ch_no) obj.iio_channel = {}; err_msg = 'The selected device does not have enough output channels!'; return; - end - + end + + % Enable the DAC buffer output + obj.if_initialized = 1; + ret = writeAttributeString(obj, 'out_altvoltage0_TX1_I_F1_raw', '0'); + obj.if_initialized = 0; + if(ret < 0) + obj.iio_channel = {}; + err_msg = 'Could not enable the DAC buffer output!'; + return; + end + % Create the IIO buffer used to write data obj.iio_buf_size = obj.data_ch_size * obj.iio_scan_elm_no; obj.iio_buffer = calllib(obj.libname, 'iio_device_create_buffer', obj.iio_dev,... @@ -457,7 +467,24 @@ classdef libiio_if < handle % Check if the device type is input if(~strcmp(obj.dev_type, 'OUT')) return; - end + end + + % Destroy the buffer + calllib(obj.libname, 'iio_buffer_destroy', obj.iio_buffer); + obj.iio_buffer = {}; + + % Enable the DAC buffer output + ret = writeAttributeString(obj, 'out_altvoltage0_TX1_I_F1_raw', '0'); + if(ret < 0) + obj.iio_channel = {}; + err_msg = 'Could not enable the DAC buffer output!'; + return; + end + + % Create the IIO buffer used to write data + obj.iio_buf_size = obj.data_ch_size * obj.iio_scan_elm_no; + obj.iio_buffer = calllib(obj.libname, 'iio_device_create_buffer', obj.iio_dev,... + obj.data_ch_size, 1); % Transmit the data buffer = calllib(obj.libname, 'iio_buffer_start', obj.iio_buffer);