Currently libiio_if.m does not catch errors when writing to channel and device attributes. Enabling these error checks can actually catch errors that the Filter Wizard does not detect unless you examine kernel messages using dmesg.
Example:
% Write the attribute
if(ret > 0)
status = calllib(obj.libname, 'iio_channel_attr_write', ch, attr, str);
if status<0
err_msg = sprintf('Could not write attribute: %s \n', attr);
error(err_msg);
end
clear ch;
clear attr;
else
status = calllib(obj.libname, 'iio_device_attr_write', obj.iio_dev, attr_name, str);
if status<0
err_msg = sprintf('Could not write attribute %s with value %s \n', attr_name, str);
error(err_msg);
end
end
end
With the above modifications, try designing a filter with a sample-rate lower than 2.4 MHz. In my example I tried 540 Khz (0.54 in the text field). An error will appear both in the MATLAB prompt about not being able to write filter settings. In dmesg:
This happens on a fresh boot. However, if you change to a higher frequency such as 2.4 MHz it works fine, then after that, try 540 KHz again, and it will accept that sample-rate. It seems on a fresh-boot if you try to immediately set a "lower" sample-rate we run into this error.
Currently libiio_if.m does not catch errors when writing to channel and device attributes. Enabling these error checks can actually catch errors that the Filter Wizard does not detect unless you examine kernel messages using dmesg.
Example:
With the above modifications, try designing a filter with a sample-rate lower than 2.4 MHz. In my example I tried 540 Khz (0.54 in the text field). An error will appear both in the MATLAB prompt about not being able to write filter settings. In dmesg:
This happens on a fresh boot. However, if you change to a higher frequency such as 2.4 MHz it works fine, then after that, try 540 KHz again, and it will accept that sample-rate. It seems on a fresh-boot if you try to immediately set a "lower" sample-rate we run into this error.