analogdevicesinc / TransceiverToolbox

MATLAB toolbox for ADI transceiver products
https://analogdevicesinc.github.io/TransceiverToolbox/master
Other
56 stars 31 forks source link

TransceiverToolbox/+adi/+AD9371/ORx.m crashes MATLAB R2020b in Windows 10 #95

Closed Shaun-Cummins closed 2 years ago

Shaun-Cummins commented 2 years ago

https://github.com/analogdevicesinc/TransceiverToolbox/blob/master/%2Badi/%2BAD9371/ORx.m When adjusting manual mode ORx gain after initialisation, function set.Gain(obj, value) calls obj.setAttributeLongLong('voltage2','hardwaregain',value,false);

However, when Attribute.m's function call to setAttributeLongLong(obj,id,attr,value,isOutput,tol,phydev) to checks the value back after it has been written using: [status, rValue] = iio_channel_attr_read_longlong(obj,chanPtr,attr);, the following cstatus(obj,status,['Attribute ' attr ' return value ' num2str(rValue) ', expected ' num2str(value)]); is thrown.

The next time the observation receive object is called, MATLAB does a complete crash with dump.

However, within ORx.m, it appears that the call to obj.setAttributeRAW('voltage2','rf_port_select','OFF',false); within immediately before obj.setAttributeLongLong('voltage2','hardwaregain',value,false); causes the ZC706 to ignore the write and return -229 dB. This was confirmed using the iio_info command via the terminal where the voltage2/hardwaregain does change from the default of 18.0 dB to -220 dB when the RF Port is changed to OFF.

By removing the call to obj.setAttributeRAW('voltage2','rf_port_select' before and after the gain setting does appear to alleviate throwing the cstatus and avoiding the subsequent MATLAB crashing.

Another workaround is to detect if ConnectedToDevice for the ORx object just prior to calling another observation.

I don't think that MATLAB should not crash if a cstatus is legitimately thrown from time to time.

tfcollins commented 2 years ago

I pushed a fix here for the state: https://github.com/analogdevicesinc/TransceiverToolbox/pull/96

However, I could not make MATLAB crash

Shaun-Cummins commented 2 years ago

Travis, I'm not sure about this message that's been added to ORx.m "error('Cannot set gain when in manual mode or if RFPort in OFF/INTERNALCALS')" Should it be "error('Cannot set gain when in NOT manual mode or if RFPort in OFF/INTERNALCALS')"? Thanks for your assistance Regards Shaun Cummins

From: Travis F. Collins @.> Sent: 09 December 2021 19:56 To: analogdevicesinc/TransceiverToolbox @.> Cc: Shaun Cummins @.>; Author @.> Subject: Re: [analogdevicesinc/TransceiverToolbox] TransceiverToolbox/+adi/+AD9371/ORx.m crashes MATLAB R2020b in Windows 10 (Issue #95)

I pushed a fix here for the state: #96https://gbr01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fanalogdevicesinc%2FTransceiverToolbox%2Fpull%2F96&data=04%7C01%7Cshaun.cummins%40forefrontrf.com%7C637f17d40f6e4c9e5a5808d9bb4de751%7Cfc8b6642e3a14fc293e7ed365bac13a2%7C0%7C0%7C637746765529534446%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=%2BUyo2qXbtfhcet3%2F7D%2FpV4VSIdBNM41wGisSkwIP3vY%3D&reserved=0

However, I could not make MATLAB crash

- You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://gbr01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fanalogdevicesinc%2FTransceiverToolbox%2Fissues%2F95%23issuecomment-990194137&data=04%7C01%7Cshaun.cummins%40forefrontrf.com%7C637f17d40f6e4c9e5a5808d9bb4de751%7Cfc8b6642e3a14fc293e7ed365bac13a2%7C0%7C0%7C637746765529534446%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=VD95zHvqoiIr01Bxeb9oVNSG8xGNhY0cTJkNyzbFuwI%3D&reserved=0, or unsubscribehttps://gbr01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAWSRYSKHBBVIWUVC376S5JDUQECUNANCNFSM5JXEP76Q&data=04%7C01%7Cshaun.cummins%40forefrontrf.com%7C637f17d40f6e4c9e5a5808d9bb4de751%7Cfc8b6642e3a14fc293e7ed365bac13a2%7C0%7C0%7C637746765529534446%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=JvPiZTIIgup7IApWUjlsYdSUyxdWc%2FFRJivJwdgzPGc%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://gbr01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Cshaun.cummins%40forefrontrf.com%7C637f17d40f6e4c9e5a5808d9bb4de751%7Cfc8b6642e3a14fc293e7ed365bac13a2%7C0%7C0%7C637746765529534446%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=NLeRPc5pkKm3vgeouM8AMs5wnQoc3cH7ZGFPUEWaAgc%3D&reserved=0 or Androidhttps://gbr01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Cshaun.cummins%40forefrontrf.com%7C637f17d40f6e4c9e5a5808d9bb4de751%7Cfc8b6642e3a14fc293e7ed365bac13a2%7C0%7C0%7C637746765529534446%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=5%2BHQ19YeE1ie61HQ22kwuA7b4FRN6DDfYNFyp7OPaY8%3D&reserved=0.