how to reinitialize usb device

7 ビュー (過去 30 日間)
Randy Gatewood
Randy Gatewood 2016 年 2 月 26 日
コメント済み: Star Strider 2016 年 2 月 26 日
Is there a way to reinitialize or re-instantiate a usb device in matlab? I am using a Total Phase Aardvark spi controller and if I try to run the script a 2nd time I always get a "Error communicating with Hardware" error for the Aardvark. I do a disconnect at the end of the script and clear the comport variable.

採用された回答

Star Strider
Star Strider 2016 年 2 月 26 日
We would need to see your code.
You will likely have to use the delete function to completely clear the serial object first.
  2 件のコメント
Randy Gatewood
Randy Gatewood 2016 年 2 月 26 日
編集済み: Star Strider 2016 年 2 月 26 日
% connect to aardvark
spi0 = spi('aardvark', 0, 0);
spi0.BitRate = 8000000;
pause(.2);
connect(spi0);
... pgm here ...
disconnect(spi0);
clear spi0;
Star Strider
Star Strider 2016 年 2 月 26 日
I didn’t realise you were using the Instrument Control Toolbox. I just added it as a Product Tag to your post.
I don’t have it, so I have no experience with it. (It’s not required to connect to serial devices with USB, and while I’ve used USB devices, I’ve always just used the serial capabilities in core MATLAB, or the Hardware Support Packages for Arduino and Raspberry Pi.)
The only thing I can do is to direct you to the resources you’ve likely already surfed: SPI Communication for the Instrument Control Toolbox, and to Contact Tech Support if none of the documentation options work.

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by