PC usb driver for M5222X and M5221X

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PC usb driver for M5222X and M5221X

2,861 Views
efk
Contributor I
Hello,

I read several posts in this forum, but i do not have the answer.

For those who have already some experience of communication between the PC and this processor, what usb driver would you suggest to use ?

PS:
I checked "CMXUSB_LITE" and i found some interesting code in this folder: C:\CMXUSB_LITE\usb-peripheral\pc-side\hid-led-demo . But i did not find the corresponding INF and SYS files !

Anyway, this code looks a bit "generic". I guess there must be some more specific tools ?

Labels (1)
0 Kudos
Reply
6 Replies

1,136 Views
RichTestardi
Senior Contributor II
Hi,
 
What kind of communication do you want to do between the PC and the 522[12]x?  I assume you want a Windows PC since you're talking about INF files.
 
I've used libusb to easily talk directly to the USB endpoints of my target device:
 
 
And there is also winusb from Microsoft:
 
 
One page implies it isn't available for XP and one does -- I haven't tried it though.
 
However, if you're creating (or emulating) a "standard" USB device, you might not need to write a driver at all.
 
I actually emulate an existing device and use its driver instead...  (I emulate an FTDI serial port, since I want to communicate with a terminal emulator, but now I find myself wondering if I could emulate a real USB Communications Class device instead...)
 
-- Rich
 
0 Kudos
Reply

1,136 Views
efk
Contributor I
Thank you for your answers.

The solution "WinUSB" looks nice for my requirement.
The source code in the demo program "C:\CMXUSB_LITE\usb-peripheral\pc-side\hid-led-demo" seems to be clear.
The DOC file "WinUsb_HowTo.docx" is clear as well.

I am actually downloading the "WDK" (WDK_6001_18001.iso) from Microsoft web site.
I still have to wait for a couple of hours before end of downloading.

Afterwards i could make more tests.

0 Kudos
Reply

1,136 Views
JimDon
Senior Contributor III
If you are going to use the Generic Hid, you will have no need for WinUSB or libusb.

I know for a fact that WinUSB will require that you install the device driver on XP (if it is not already there - I have tons on USB stuff on my XP box, and it was not on my box), and although it is a microsoft driver, they seem unwilling to sign it so you will have to either have your user accept "Unsigned Driver"  or sign it yourself (at least as best I could figure it).

Also, there are bugs in that document. It did not work and I finally figured out that it was missing a blank [ClassInstall32] section, but it took me quite a while to figure this out. I happened to have the sample device, it was not my own device - after I got the install to work, I left it at that. I did not go any further, as I need to install on XP boxs ( still 90% of all boxes are XP), and did not what to design the msi (at this time) to do this.

I will give you another hint - don't bother looking for winusb.sys, as it is contained in on of the coinstaller dlls and gets spit out during the install. I had supposed "experts" tell me it was right in there in the WDK.

Also, if you do this you will not need anything from the WDK for generic hid:

Code:
// Pointer to functions for exporting//BOOLEAN ( __stdcall *_HidD_FreePreparsedData)(      IN    PHIDP_PREPARSED_DATA PreparsedData      );BOOLEAN (__stdcall* _HidD_GetAttributes) (     IN  HANDLE              HidDeviceObject,     OUT PHIDD_ATTRIBUTES    Attributes     );void (__stdcall* _HidD_GetHidGuid) (     OUT   LPGUID   HidGuid     );BOOLEAN (__stdcall* _HidD_GetPreparsedData) (        IN    HANDLE                  HidDeviceObject,        OUT   PHIDP_PREPARSED_DATA  * PreparsedData        );NTSTATUS (__stdcall* _HidP_GetCaps) (     IN      PHIDP_PREPARSED_DATA      PreparsedData,     OUT     PHIDP_CAPS                Capabilities     );BOOLEAN  (__stdcall* _HidD_GetProductString) (        IN    HANDLE   HidDeviceObject,        OUT   PVOID    Buffer,        IN    ULONG    BufferLength        );BOOLEAN (__stdcall* _HidD_GetIndexedString) (        IN    HANDLE   HidDeviceObject,        IN    ULONG    StringIndex,        OUT   PVOID    Buffer,        IN    ULONG    BufferLength        );BOOLEAN (__stdcall* _HidD_GetSerialNumberString) (       IN    HANDLE   HidDeviceObject,       OUT   PVOID    Buffer,       IN    ULONG    BufferLength       );BOOLEAN (__stdcall* _HidD_GetManufacturerString) (       IN    HANDLE   HidDeviceObject,       OUT   PVOID    Buffer,       IN    ULONG    BufferLength       );Then in your initialization code: HMODULE hMod =::LoadLibrary(_T("hid.dll")); // get the functions we need. *((FARPROC*)&_HidD_FreePreparsedData) = ::GetProcAddress(hMod, "HidD_FreePreparsedData"); *((FARPROC*)&_HidD_GetAttributes) = ::GetProcAddress(hMod, "HidD_GetAttributes"); *((FARPROC*)&_HidD_GetHidGuid) = ::GetProcAddress(hMod, "HidD_GetHidGuid"); *((FARPROC*)&_HidD_GetPreparsedData) = ::GetProcAddress(hMod, "HidD_GetPreparsedData"); *((FARPROC*)&_HidP_GetCaps) = ::GetProcAddress(hMod, "HidP_GetCaps"); *((FARPROC*)&_HidD_GetManufacturerString) = ::GetProcAddress(hMod, "HidD_GetManufacturerString"); *((FARPROC*)&_HidD_GetSerialNumberString) = ::GetProcAddress(hMod, "HidD_GetSerialNumberString"); *((FARPROC*)&_HidD_GetProductString) = ::GetProcAddress(hMod, "HidD_GetProductString"); *((FARPROC*)&_HidD_GetIndexedString) = ::GetProcAddress(hMod, "HidD_GetIndexedString");}

 To use the function pointers:

    _HidD_FreePreparsedData(hpd);

 









0 Kudos
Reply

1,136 Views
JimDon
Senior Contributor III
Freeshas some new USB stuff for Felxis that will serve to show how to install and use the WinUSB code.with a GUI, There is a DLL that we need to get the API for,

The also and app note the show how to use the sample bulk driver  code that comes  with WDK - AN3530.
This runs on mfc222x - the zip file with code has gone missing by I have a service request in to get it.
It will talk to the bulkdriver which is in the src/usb/bulkdriver  folder of the WDK, And the board and app code to talk to it.
This is the real deal - you will be abel to get very fast transfers with this - like 600K BYTES /second.

Down load the WDK from the microsoft connect sit e - just need a "passport" to log in. It is a 650M iso image of the CD.



0 Kudos
Reply

1,136 Views
efk
Contributor I
Thank you for all these tips.
I have downloaded and installed everything.
So now i have around 1Gbytes of infos to analyze.
For now, i am a bit lost.

In the other side, i ordered the M52211EVB kit.
I will wait to receive it, in order to analyze the cd-rom which is supplied within the kit (we usually find a lot of useful things in these kinds of CD-Rom).
I guess i will find a SYS file + an INF file for this kit ?
And may be there is some c++ code to communicate with the SYS file ?


0 Kudos
Reply

1,136 Views
JimDon
Senior Contributor III
If you use generic hid you do not need an inf or sys file . It is built in to windows. There should also be a pc side directory that has a sample VS studio project that talks to the card.

0 Kudos
Reply