Question about making USB host program.
Company  
ST Home | Microcontrollers

Index  »  USB  »  Question about making USB host program.
     
   Question about making USB host program.
 Moderated by :   »  aNt  -  AnisAS  -  AnisAS

Author
beginning argument    ( No reply )
zhangzq71   Posted 28-10-2008 at 16:38   



Registered on :
10-09-2009

Messages : 3

 OFF-Line

Hi,

I modified the Custom_HID USB demo program(STM32) to make it keep sending the data in 'main' function,

int main(void)
{
int i;
unsigned short b;
#ifdef DEBUG
debug();
#endif

Set_System();

USB_Interrupts_Config();

Set_USBClock();

USB_Init();

while (1)
{
for (i = 0; i < 1000000; i++);

b++;
UserToPMABufferCopy((u8 *)&b, GetEPTxAddr(ENDP1), 2);
SetEPTxCount(ENDP1, 2);
SetEPTxValid(ENDP1);
}
}

This firmware works well and the BUSHOUND can get that USB data. I want to make my host program to get that data, I tried to make that program in both Windows and Linux. In Windows, I call SetupDiGetDeviceInterfaceDetail to get the device path of that Custom_HID device, then call CreateFile to open that devicepath. I can properly to get the VID & PID by calling HidD_GetAttributes, but I don't know how to read the data send from Custom_HID device, I tried both HidD_GetFeature, and ReadFile, but failed.

In Linux I used the libusb, after correctly opened that Custom_HID device, I still can not read that data by calling both usb_bulk_read & usb_interrupt_read.

Who can make a sample program to read that data?


Regards,
ZhangZQ




 Profile   Quote  
On Top

Search in the forums
 
Jump To