Author Topic: Interrupt Input Report And Generic Hid (generic_hid_cs_50) problem  (Read 27570 times)

homelesswarrior

  • Member
  • ***
  • Posts: 8
 Hi All !

I have built USB communication between STM32 and Soft sample of Jan Axelson (generic_hid_cs_50).
I also use Report Descriptor that Mr.Jan support in Pic sample code.
And every thing is ok: receive/send data via control transfer with feature report or in/out report.
But when i use in/out report with interrupt transfer ,the host can't catch anything from my device (STM32),it announs Time Out  ???.
Host can send data to my device,and my device also send data to host correctly (i use Data center with Beagle tool to catch the packets.But if i use Advanced USB Port Monitor,it can't get anything).I can't make it clear.

So i guess that's something wrong with AsyncCallback(GetInputReportData) to receive InputReport in code  ??? :
Code: [Select]
fileStreamDeviceData.BeginRead(inputReportBuffer, 0, inputReportBuffer.Length, new AsyncCallback(GetInputReportData), inputReportBuffer); Because when i debug,i found everything is ok.But this line didn't work right.inputReportBuffer had no data,it received nothing.

I also change buffer size from 32 to 64 (fix with data size from device) but it doesn't work  ::).

I stuck with this issue for many hours.Any ideas? :'( :'(
Please check and help me  .

Thanks and Best Regards

Ps:here's report:
Code: [Select]
0x06, 0xA0, 0xFF,  // Usage page (vendor defined)
   0x09, 0x01,        // Usage ID (vendor defined)
   0xA1, 0x01,        // Collection (application)
    
 // The Input report
    0x09, 0x03,       // Usage ID - vendor defined
    0x15, 0x00,       // Logical Minimum (0)
    0x26, 0xFF, 0x00, // Logical Maximum (255)
    0x75, 0x08,       // Report Size (8 bits)
    0x95,0x3F,        //63+1 byte report_count
    0x81, 0x02,       // Input (Data, Variable, Absolute)
    
 // The Output report
    0x09, 0x04,       // Usage ID - vendor defined
    0x15, 0x00,       // Logical Minimum (o)
    0x26, 0xFF, 0x00, // Logical Maximum (255)
    0x75, 0x08,       // Report Size (8 bits)
    0x95,0x3F,        //63+1 byte report_count
    0x91, 0x02,       // Output (Data, Variable, Absolute)
    
 // The Feature report
    0x09, 0x05,       // Usage ID - vendor defined
    0x15, 0x00,       // Logical Minimum (o)
    0x26, 0xFF, 0x00, // Logical Maximum (255)
    0x75, 0x08,       // Report Size (8 bits)
    0x95,0x3F,        //63+1 byte report_count
    0xB1, 0x02,       // Feature (Data, Variable, Absolute)
    
   0xC0
« Last Edit: August 23, 2012, 06:55:02 am by homelesswarrior »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Interrupt Input Report And Generic Hid (generic_hid_cs_50) problem
« Reply #1 on: August 23, 2012, 12:38:38 pm »
If you're seeing the received data on an analyzer but not in the application, be sure that the device is sending the same number of bytes that the report descriptor specifies. In your case, that would be 63 bytes (not 63 + 1). The buffer in the host application must have at least 64 bytes because the first byte is the report ID, but the device sends 63 (unless using multiple report IDs).

homelesswarrior

  • Member
  • ***
  • Posts: 8
Re: Interrupt Input Report And Generic Hid (generic_hid_cs_50) problem
« Reply #2 on: August 23, 2012, 10:09:58 pm »
Oh my words!
Thanks for your help.I'm very appreciate it.
Thanks alot again. ;D :D :D

But now i want to transfer a large data.Can i build Bulk transfer for HID firmware and with your sample soft generic_hid_cs_50?
I can transfer large data in internal flash to host via control transfer but the soft get nothing( Transferred Bulk data is fine,and i catch packets by Data center with Beagle tool).
Is it able to build the bulk transfer for HID interface?
Thanks in advance.
« Last Edit: August 24, 2012, 12:39:34 am by homelesswarrior »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Interrupt Input Report And Generic Hid (generic_hid_cs_50) problem
« Reply #3 on: August 27, 2012, 03:25:03 pm »
The HID class supports control and interrupt transfers only. Interrupt transfers can transfer large amounts of data, but bulk is usually faster.

homelesswarrior

  • Member
  • ***
  • Posts: 8
Re: Interrupt Input Report And Generic Hid (generic_hid_cs_50) problem
« Reply #4 on: August 27, 2012, 09:56:16 pm »
Thanks for your support.i'm very appreciate it.
I also find more document about bulk transfer.But i'm infinitely disappointed.
So could you please show me the hint to make a bulk transfer communication between my STM32 and Gate's Widows Seven 32bit?
Should i use CDC class or what class?

Thanks for your time and best regards.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Interrupt Input Report And Generic Hid (generic_hid_cs_50) problem
« Reply #5 on: August 27, 2012, 10:30:14 pm »
CDC is one option. See:

General-purpose device controller with CDC firmware

here:

http://www.lvr.com/serport.htm#usb_virtual_com_ports

Even if you have different hardware, you can look at the descriptors and other code.

Mass storage also uses bulk transfers.

homelesswarrior

  • Member
  • ***
  • Posts: 8
Re: Interrupt Input Report And Generic Hid (generic_hid_cs_50) problem
« Reply #6 on: August 28, 2012, 12:14:52 am »
Thanks for your response.

I found your very helpful post here:

  About WinUSB: http://www.lvr.com/winusb.htm
  And CDC: http://www.lvr.com/serport.htm#usb_virtual_com_ports

I will try it to build my HID bulk transfer.
Many thanks for your support.
 
« Last Edit: August 28, 2012, 12:18:07 am by homelesswarrior »

homelesswarrior

  • Member
  • ***
  • Posts: 8
Re: Interrupt Input Report And Generic Hid (generic_hid_cs_50) problem
« Reply #7 on: August 30, 2012, 12:03:40 am »
i'd like to express my special thanks to Jan's support.
I've finished my Bulk transfer device with Winusb.
Many thanks and best Regards.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Interrupt Input Report And Generic Hid (generic_hid_cs_50) problem
« Reply #8 on: August 30, 2012, 03:23:28 pm »
Glad you got it working!

homelesswarrior

  • Member
  • ***
  • Posts: 8
Re: Interrupt Input Report And Generic Hid (generic_hid_cs_50) problem
« Reply #9 on: September 24, 2012, 02:57:43 am »
Dear Jan!
The first thing i want to express my appriciate for your support about Winusb bulk transfer.
I'd made my bulk usb work right but now i've a problem i can't solve it even i try many times to debug.
your soft winusb can transfer data (send and receive) data with my STM32,but it happens once.
When i press button "send",soft send and receive data correctly.i wait to finish data transfer.
And then,i press send again,and the soft can't send or receive anything.
The one thing i can solve this problem is "unplug" the usb cab and plug again.
Please help me clear it.
Thanks for your time and best regards.
 

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Interrupt Input Report And Generic Hid (generic_hid_cs_50) problem
« Reply #10 on: September 24, 2012, 10:51:55 am »
To isolate the problem, find the point in the host software where the program fails and examine any error message you get. Use breakpoints, single-stepping.

If the host application sends data but the device doesn't accept it, examine your device firmware to be sure the endpoint is configured to accept new data.

If the device sends data successfully but doesn't receive data back, examine your device firmware to be sure the firmware prepares to send data on receiving it.

A USB protocol analyzer will help, as will a monitor program that allows you to control and view what is happening when the device firmware runs.

homelesswarrior

  • Member
  • ***
  • Posts: 8
Re: Interrupt Input Report And Generic Hid (generic_hid_cs_50) problem
« Reply #11 on: September 24, 2012, 10:11:21 pm »
thanks for your reply,i'll try to fix it.

Best regards.

homelesswarrior

  • Member
  • ***
  • Posts: 8
Re: Interrupt Input Report And Generic Hid (generic_hid_cs_50) problem
« Reply #12 on: September 25, 2012, 12:19:19 am »
Thanks for your support Jan.
I have solved my problem and everything is perfect now,thanks again.
Best regards.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Interrupt Input Report And Generic Hid (generic_hid_cs_50) problem
« Reply #13 on: September 25, 2012, 11:08:43 am »
Good to hear it!