AnsweredAssumed Answered

Problem of libiio-matlab-master

Question asked by hgli on Sep 2, 2015
Latest reply on Sep 22, 2015 by hgli

Hi,

 

I download the libiio-matlab-master from ADI GitHub, and use it in Matlab.

I design a new matlab file test_libiio_if.m.

My hardware is ZedBoard+AD-FMCOMMS1, and the software in SD card is from ADI 2014_R2-2015_04_24.img.

I find that writeAttributeDouble() and readAttributeDouble() are invalidate for the frequency attribution of adf4351-rx-lpc.

If I modify the frequency attribution of adf4351-rx-lpc by writeAttributeDouble() or by external IIO Oscilloscope, readAttributeDouble()  always return 10000.0.

Other interface functions can work successfully.

 

My test_libiio_if.m is listed as following:

 

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

%clear
clear all;
close all;
clc;

 

%obj
obj1 = libiio_if;

 

%init
[ret, err_msg, msg_log] = init(obj1, '192.168.10.105', 'cf-ad9643-core-lpc', 'IN', 2, 1024);
sprintf('\ninit() -->\nreturn: %d\nerr_msg: %s\nmsg_log:\n%s\n', ret, err_msg, msg_log)

 

%readAttributeDouble
[ret, val] = readAttributeDouble(obj1, 'sampling_frequency');
sprintf('\nreadAttributeDouble() --> sampling_frequency\nreturn: %d\nval: %f\n', ret, val)

 

%readData
[ret, data] = readData(obj1);
sprintf('\nreadData() -->\nreturn: %d\n', ret)
%figure, plot(data{1});
%figure, plot(data{2});
figure, plot(1:1024,data{1},1:1024,data{2});

 

%obj
obj2 = libiio_if;

 

%init
[ret, err_msg, msg_log] = init(obj2, '192.168.10.105', 'adf4351-rx-lpc', '', 2, 1024);
sprintf('\ninit() -->\nreturn: %d\nerr_msg: %s\nmsg_log:\n%s\n', ret, err_msg, msg_log)

 

%writeAttributeDouble

ret = writeAttributeDouble(obj2, 'frequency', 1200000000.0);

sprintf('\nwriteAttributeDouble() --> frequency\nreturn: %d\n', ret)

 

%readAttributeDouble
[ret, val] = readAttributeDouble(obj2, 'frequency');
sprintf('\nreadAttributeDouble() --> frequency\nreturn: %d\nval: %f\n', ret, val)

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

In the following sentence:

 

[ret, err_msg, msg_log] = init(obj2, '192.168.10.105', 'adf4351-rx-lpc', '', 2, 1024);

 

The third parameter of init() is "dev_type", but I don't know how to fill it.

I fill it with a empty character.

I still don't know how to fill the fourth and fifth parameters.

The prototype of init() is defined as following:

 

function [ret, err_msg, msg_log] = init(obj, ip_address, ...

                                                dev_name, dev_type, ...

                                                data_ch_no, data_ch_size)

 

Honggui

Outcomes