Author Topic: USB to serial  (Read 14750 times)

awtroutn

  • Member
  • ***
  • Posts: 2
USB to serial
« on: June 14, 2010, 10:20:52 am »
Hello All,

I am a complete novice in this area and hope someone can tell me if this is even possible. I have a USB device that spits out some information when an action occurs. I would like to be able to capture the raw data directly into excel or VB. Is it possible to connect the usb device to a serial port and capture the raw data? (I know I can use MSComm to capture the raw data)There is a lot of information about using serial devices and connecting to usb but not so much in the other direction. I have just purchased USB Complete and Serial Port Programming for VB, but I am sure it will take some time to digest the information. If anyone can send me in the right direction, I would greatly appreciate it.

Thanks

Andrew

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USB to serial
« Reply #1 on: June 14, 2010, 10:42:58 am »
If your USB device appears in the OS as a COM port then yes, you can use MSComm or similar to access the device. If it doesn't appear as a COM port, you need to find out what driver the OS has assigned and access the device via that driver. Also see my USB Developer's FAQ, first questions, at

http://www.janaxelson.com/usbfaq.htm

Jan

« Last Edit: June 29, 2015, 10:29:08 am by Jan Axelson »

awtroutn

  • Member
  • ***
  • Posts: 2
Re: USB to serial
« Reply #2 on: June 17, 2010, 12:49:17 pm »
Jan

Thanks for the quick response. Unfortunately the device does not appear as a com port. I have been trying to use you WinUSB demo for VS2008 but as of yet it is not able to find the device. I updated the GUID in the code but no luck. Can you tell by looking at the inf file if it should work or not?  Below is the inf file for the device. If you have anything else I could try, please let me know.

Thanks

Andrew

;===============================================================================
;
;  OnChip Technologies India Pvt. Ltd.
;
;  Hyderabad
;
;  India
;
;  INF File for NGLM USB MSC Device
;
;===============================================================================

[Version]
Signature   = "$Windows NT$"
Class       = Sample
ClassGuid   = {78A1C341-4539-11d3-B88D-00C04FAD5171}
Provider    = %MSFTUMDF%
DriverVer=02/15/2010,6.0.6001.16549
CatalogFile = wudf.cat

[Manufacturer]
%MSFTUMDF%=Microsoft,NTx86

[Microsoft.NTx86]
%NGLMUsbDeviceName% = NGLMUsb_Install, USB\VID_FFFF&PID_FFFF

[ClassInstall32]
AddReg=SampleClass_RegistryAdd

[SampleClass_RegistryAdd]
HKR,,,,%ClassName%
HKR,,Icon,,"-20"

[SourceDisksFiles]
WUDFNGLMUsbBulk.dll     = 1
WudfUpdate_01009.dll    = 1
WdfCoInstaller01009.dll = 1
WinUsbCoinstaller2.dll   = 1

[SourceDisksNames]
1 = %MediaDescription%

;===============================================================================
;                           UMDF NGLM usb MSC Device
;===============================================================================

[NGLMUsb_Install.NT]
CopyFiles = UMDriverCopy
Include   = WINUSB.INF
Needs     = WINUSB.NT   ; Run the CopyFiles & AddReg directives for WinUsb.INF

[NGLMUsb_Install.NT.hw]
AddReg=NGLMUsb_Device_AddReg

[NGLMUsb_Install.NT.Services]
AddService=WUDFRd,0x000001fa,WUDFRD_ServiceInstall  ; service for the device
AddService=WinUsb,0x000001f8,WinUsb_ServiceInstall  ; this service is installed because its a filter.

[NGLMUsb_Install.NT.Wdf]
KmdfService      = WINUSB, WinUsb_Install
UmdfDispatcher   = WinUsb
UmdfService      = WUDFNGLMUsb, WUDFNGLMUsb_Install
UmdfServiceOrder = WUDFNGLMUsb

[NGLMUsb_Install.NT.CoInstallers]
AddReg    = CoInstallers_AddReg
CopyFiles = CoInstallers_CopyFiles

[WinUsb_Install]
KmdfLibraryVersion = 1.9

[WUDFNGLMUsb_Install]
UmdfLibraryVersion = 1.9.0
DriverCLSID        = "{0865b2b0-6b73-428f-a3ea-2172832d6bfc}"
ServiceBinary      = "%12%\UMDF\WUDFNGLMUsbBulk.dll"

[NGLMUsb_Device_AddReg]
HKR,,"LowerFilters",0x00010008,"WinUsb" ; FLG_ADDREG_TYPE_MULTI_SZ | FLG_ADDREG_APPEND

[WUDFRD_ServiceInstall]
DisplayName    = %WudfRdDisplayName%
ServiceType    = 1
StartType      = 3
ErrorControl   = 1
ServiceBinary  = %12%\WUDFRd.sys
LoadOrderGroup = Base

[WinUsb_ServiceInstall]
DisplayName    = %WinUsb_SvcDesc%
ServiceType    = 1
StartType      = 3
ErrorControl   = 1
ServiceBinary  = %12%\WinUSB.sys

[CoInstallers_AddReg]
HKR,,CoInstallers32,0x00010000,"WudfUpdate_01009.dll", "WinUsbCoinstaller2.dll", "WdfCoInstaller01009.dll,WdfCoInstaller"

[CoInstallers_CopyFiles]
WudfUpdate_01009.dll
WdfCoInstaller01009.dll
WinUsbCoinstaller2.dll

[DestinationDirs]
UMDriverCopy           = 12,UMDF ; copy to drivers UMDF
CoInstallers_CopyFiles = 11

[UMDriverCopy]
WUDFNGLMUsbBulk.dll

;===============================================================================
;                                    Generic
;===============================================================================

[Strings]
MSFTUMDF          = "OnChip Technologies India Pvt. Ltd."
MediaDescription  = "NGLM USB Bulk User Mode Driver"
ClassName         = "NGLM MSC USB Class"
WudfRdDisplayName = "User-mode Driver Framework Reflector"
NGLMUsbDeviceName = "NGLM MSC Interface Device"
WinUsb_SvcDesc    = "WinUSB Driver"

;===============================================================================
;                                    END
;===============================================================================

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USB to serial
« Reply #3 on: June 17, 2010, 06:15:04 pm »
It looks like the device is using WinUSB with a vendor-specific user-mode DLL(WUDFNGLMUsbBulk.dll) rather than winusb.dll. You will likely need documentation from the vendor about how to access the device.

Jan