This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Expanding In/Out Reports on Keil USB HID example code

I'm implementing an HID class device and have based my program on the HID USB program supplied by Keil. I'm new to USB but am a fairly experienced programmer otherwise.

I have got a basic program working fine bit with single byte input and output reports. I've tested the functionality using a client called SimpleHIDWrite.exe

I need to expand both in and out reports to 8 bytes each to communicate with the host. Has anybody successfully modified this example program or does anyone have any advice on how to do it properly?

My guess is that I need to edit the report descriptor and also set up the inreport and outreport as arrays. Is there anything I need to watch out for?

My target is the LPC2141.

Any advice or information would be much appreciated!

Thanks,
Gareth.

Parents
  • Gareth,

    what compiler for PC are you using?
    I can send you my bare HID testprogram built with VC6

    basically, after device detection and FileOpen it is just a matter of WriteFile/ReadFile, nothing else.

    In case you want it, just send me a message via my contact form in order to transfer your mail address. you can find the form if you just take my last name and add .de

    regards
    Ulrich

Reply
  • Gareth,

    what compiler for PC are you using?
    I can send you my bare HID testprogram built with VC6

    basically, after device detection and FileOpen it is just a matter of WriteFile/ReadFile, nothing else.

    In case you want it, just send me a message via my contact form in order to transfer your mail address. you can find the form if you just take my last name and add .de

    regards
    Ulrich

Children
  • Hi Tsuneo (and Ulrich)

    Thank you for both taking the trouble to read this thread!
    As you can probably tell - I am a little new to programming for USB and just knowing someone is out there watching is a great comfort!!!

    I am delighted to say that I've worked through everything again (and again ...) and I seem to have solved my problems (for now).

    a) I was not using the array pointer properly when filling IN EP1 (cut and paste error - doh!!)
    b) also I may have been using the 'Set Report' command rather then 'Write' command in SimpleHIDWrite program ...

    Anyway the main problem was the line of code which sent the copied InReport to the EP.

    So I now have looping reports working properly with only one IN report send to the PC on receipt of an OUT report from the PC!!

    HOORAY! It's a good step as I now have full control of when IN reports are sent. I now just have to fit the exact functionality required for my project.

    I will keep you posted as to how I'm getting on!

    MANY THANKS ONCE AGAIN!
    Best regards,
    Gareth.

  • Hi Tsuneo,

    Following my success earlier today I have sorted out the information requests from the host - everything seems to be working very nicely!

    I'm about to start work on sending reports when information changes ...
    In your example snippet you show a dedicated task. I assume that it is okay to place this task pretty much anywhere?

    I was going to create a task (which repeats, say every 50ms) for monitoring variable changes and place this in the main part of the application program separate from the USB parts. I assume it's okay to do this? It looks like the use of the semaphore which is set every IN request allows for 'remote' processing of the EP1.

    I plan to implement this tomorrow.
    Any comments you might have would be very welcome!

    Thanks,
    Gareth.

  • Congratulation!!
    I'm glad you got good start of your USB life ;-)

    > I assume that it is okay to place this task pretty much anywhere?

    It's right.

    Tsuneo