Issue with mexNI845x Not Finding Resource Names Properly
6 views (last 30 days)
Show older comments
I am attempting to utilize a NI-8452 to be a SPI master that will communicate with a test board. Matlab code eventually makes use of NI845xSPILib.m
Tracing through the issue, I found that the problem lies with mexNI845x('findDevices') not returning the proper resource name. On my system it simply returns 'ni845x'. On my coworkers system, it returns USB0::0x3923::0x7514::01BE1159::RAW. Code that exists in the Utility.m file, attempt to parse this resource name and split it based on '::' however, the string being based to it does not contain any '::' and therefore it causes failures.
On my coworkers system, everything runs as expected with no problems he is using (Matlab 2017b) On my system, running a command like instrhwinfo('spi') causes it to hit the line of code mentioned earlier and crash. (I am using Matlab 2018a)
0 Comments
Answers (1)
Han Du
on 4 May 2018
Make sure the support package is installed. The NI-USB-8452 is supported via a support package, per: https://www.mathworks.com/hardware-support/spi-interface.html
See at the bottom of the page for the support package link.
Here's an example of using the support package:
Unfortunately it doesn't look like the device can be simulated in NI MAX so I cannot try to reproduce the issue in R2018a. I wouldn't expecting running instrhwinfo('spi') to check for devices. It only returns the supported vendors and installed vendors:
>> i2cInfo = instrhwinfo ('spi')
i2cInfo =
HardwareInfo with properties:
SupportedVendors: {'aardvark' 'ni845x'}
InstalledVendors: {'ni845x'}
I would expect instrhwinfo('spi', 'ni845x') to check for devices:
>> i2cInfo = instrhwinfo ('spi', 'ni845x')
i2cInfo =
HardwareInfo with properties:
VendorName: 'ni845x'
VendorDescription: 'National Instruments'
VendorLibraryName: 'Ni845x.dll'
InstalledBoardIds: {1×0 cell}
BoardSerialNumbers: {1×0 cell}
ObjectConstructors: {1×0 cell}
2 Comments
Han Du
on 4 May 2018
From the code, it seems that the function is not doing much other than calling the underlying ni845x.h provided by National Instruments to get the resource names for each device. What is the resource name showing in your NI MAX?
See Also
Categories
Find more on Instrument Control Toolbox Supported Hardware in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!