03-23-2018 03:47 AM
Hi All,
I'm currently working on the device side function driver development for TMC gadgets.
Based on my experience and reference from USBTMC Specification as well as a couple of example code from Google, I have developed this driver.
Now I have one weird problem with my above USB TMC function driver, It works fine under Linux host but not in case of Windows host.
Case-1: Linux as host.
1) On embedded board load the g_tmc driver and it creates /dev/g_tmc0 device node.
2) Make a connection between Linux host and embedded Linux board.
3) On the Host side(Ubuntu 16.04), usbtmc class driver load automatically and /dev/usbtmc0 is also created well.
4) Command string also I can send from Linux host side like
echo *IDN? > /dev/usbtmc0
5) on the device side /dev/g_tmc0 device file also give me a perfect output.
I have attached snap for the same as tmc_read.png
Case-2: Windows 7/10 as Host
1) On embedded board load the g_tmc driver and it create /dev/g_tmc0 device node.
2) Make a connection between Windows 7/10 host and embedded Linux board.
3) NI-VISA / IVI Shared component successfully detect my tmc gadget and I can see the device in my DEVICE MANAGER under Test & Measurement Class category.
4) Now If I run an example from Users/Public/Documents/National Instruments/NI-VISA/Examples/C/USB path of NI-VISA then viOpen and viFindRsrc function failed to open and find my device.
Questions:-
Why is behaviour not same under the two different host?
Why Windows 7/10 can detect my tmc gadget but NI-VISA fail to make a connection?
What is the different between usbtmc class driver of vanilla Linux and NI VISA usbtmc driver?
03-23-2018 08:16 AM
May install the wireshark for usb packet analysis the differences.
03-26-2018 08:06 AM
Hi yytseng
I have looked the USB packets in the USB analyzer software called FreeDeviceMonitorStudio.
As part of gadget driver response comparison on the same board, I have started g_serial service before goto debug g_tmc. And that ACM serial connection works perfectly. At startup Windows 7 can able to send "CLASS CONTROL REQUEST" and gadget device can answer it perfectly.
Now in case of g_tmc function driver,
After insertion of g_tmc module, windows can detect it and T&M(IVI) entry I can see in device manager. Now If I starting NI MAX and immediately watch in the USB analyzer software, I can see a couple of entry. I have debug that entry and say that Windows 7 send "STANARD REQUEST" instead of "CLASS CONTROL REQUEST".
Why Windows Can send "STANARD REQUEST"?
Underneath VISA using ausbtmc.sys. Is something are wrong behind my NI-VISA?