Jump to content
lawrence_jeff

Launchpad USB example and documentation additions/labs

Recommended Posts

For those of you attempting to build USB devices I put together some Launchpad examples as well as a lab type walkthrough of how to create custom devices (mainly HID)

 

Included

 

1) Examples ported to the Launchpad  - Mouse, Keyboard, Composite

2) Updated HID header file with additional device and usage types

3) A new device type called usbdhidcustom - This allows you to make new devices with minimal code changes

4) A complete document in lab type format where you build a volume control device, a gamepad and a keyboard + mouse

5) Completed projects to go with the labs

 

 

 

 

 

StellarisWare.zip

Share this post


Link to post
Share on other sites

For those of you attempting to build USB devices I put together some Launchpad examples as well as a lab type walkthrough of how to create custom devices (mainly HID)

 

Included

 

1) Examples ported to the Launchpad  - Mouse, Keyboard, Composite

2) Updated HID header file with additional device and usage types

3) A new device type called usbdhidcustom - This allows you to make new devices with minimal code changes

4) A complete document in lab type format where you build a volume control device, a gamepad and a keyboard + mouse

5) Completed projects to go with the labs

Thanks!

Share this post


Link to post
Share on other sites

For those of you attempting to build USB devices I put together some Launchpad examples as well as a lab type walkthrough of how to create custom devices (mainly HID)

 

Included

 

1) Examples ported to the Launchpad  - Mouse, Keyboard, Composite

2) Updated HID header file with additional device and usage types

3) A new device type called usbdhidcustom - This allows you to make new devices with minimal code changes

4) A complete document in lab type format where you build a volume control device, a gamepad and a keyboard + mouse

5) Completed projects to go with the labs

Hi Jeff,

I had a question about hid. I wish to transfer 64 bytes of data back and forth between the PC and Stellaris. In such a case what Usage Page/Usage would allow this? I'm still trying to get a grasp of USB HID. It seems interesting.

Share this post


Link to post
Share on other sites

Check out these links

 

http://www.waitingforfriday.com/index.php/USB_Generic_HID_Open_Source_Framework_for_Atmel_AVR_and_Windows

http://www.waitingforfriday.com/index.php/Open_Source_Framework_for_USB_Generic_HID_devices_based_on_the_PIC18F_and_Windows

 

Once you have an OS side applicaton it should be a matter of just using my examples with a customized descriptor (You can dig through the PIC code above to find the descriptor those examples use). If I get a chance I can try to update my examples to include one of these (I think it would be similair to the volume control example except you would make it a generic device and you would have to write the OS side code to send/recieve instead of relying on the HID volume driver included in the OS)

 

Jeff

Share this post


Link to post
Share on other sites

Check out these links

 

http://www.waitingforfriday.com/index.php/USB_Generic_HID_Open_Source_Framework_for_Atmel_AVR_and_Windows

http://www.waitingforfriday.com/index.php/Open_Source_Framework_for_USB_Generic_HID_devices_based_on_the_PIC18F_and_Windows

 

Once you have an OS side applicaton it should be a matter of just using my examples with a customized descriptor (You can dig through the PIC code above to find the descriptor those examples use). If I get a chance I can try to update my examples to include one of these (I think it would be similair to the volume control example except you would make it a generic device and you would have to write the OS side code to send/recieve instead of relying on the HID volume driver included in the OS)

 

Jeff

Hell.. that is perfect! Thanks a ton for the quick response. I just did the volume example and it was a no-brainer. 

Share this post


Link to post
Share on other sites

I am getting 75 errors when I try to build the USB libraries (Step 10 in your writeup).  Most are coming from usbhidcustom.c, and are all along the lines of -

#20 identifier "bool" is undefined usbdhidcustom.c /usblib/device line 385, external location: C:\ti\TivaWare_C_Series-1.0\driverlib\usb.h C/C++ Problem

 

When I look at the referenced lines in the code, the majority of them are on comment lines, which makes no sense to me.  I'm building this for the Tiva, not the Stellaris, don't know if that might be the problem.

 

Also, I'm getting an error that appears to be due to a bug in CCS v5.4.  The example projects you include were configured for V4.9.5 of the ARM compiler.  CCS will not allow you to build them because there isn't a compatible version of the compiler installed (I have 5.0.4 and 5.0.6 available).  The problem is, if you change the compiler version, CCS throws a builder error and it is not possible to fix without having CCS v5.3 or older installed from what I found here - http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/226067.aspx

 

Any ideas??
 

Share this post


Link to post
Share on other sites

The fact that your error references C:\ti\Tivaware indicates you are using the wrong software

 

These were developed before Tivaware so you need to use Stellarisware (per the requirements section in the PDF in my zip)

 

So download and install stellarisware to C:\Stellarisware - first option on this page http://www.ti.com/tool/sw-lm3s (make sure you get the one that mentions LM4f)

Update the files in that directory with the version in the zip

Follow the instructions in the PDF - I just went through them with 5.4 and I didn't change the compiler options from 4.9.5 and they still built fine.

 

In general you shouldn't have to change anything from the PDF - except for my note above that for a TIVA in the code you need to force Device mode

Share this post


Link to post
Share on other sites

Yes, that would likely work.  However, I'm not attempting to just follow your examples, I am attempting to update them for Tivaware.  I do not have, nor do I intend to purchase a Stellaris.  I realize that the Tiva is essentially a re-branded Stellaris and that code compiled for the Stellaris will work, with a few exceptions, on the Tiva.  However, since I am just starting out with the TI products myself I would prefer not to even begin with a deprecated product or codebase.  I think I have most of the necessary changes worked out, and I plan on following the advice from the TI forum on using CCS 5.3 to fix the compiler error as soon as I have a free moment to do so, and then pulling the project back into CCS 5.4.  Hopefully that will fix the compiler error and I can move on to the error messages when attempting to compile the libraries.  I think the handful of errors I am getting in host/usbhidkeyboard might have to do with one or more of the modified files included in your package.  I have not tried compiling the stock library to see if it generates the same errors.  I'll compare your files to the Tivaware and Stellarisware originals, and see if I can correct the issues.

 

What has me particularly confused though is that 90% of the line numbers that are throwing errors in usbdhidcustom.c when attempting to compile the libraries are on lines that contain nothing but a comment???  If I'm not mistaken, the compiler should ignore any line that begins with a "//", so what could possibly cause it to generate an "identifier ******** undefined" error on those lines?

 

I'll keep digging and hopefully figure it out through trial and error and google.  The more I hammer away at this problem, the more I'll start to pick up on the code style in general.  I learn much faster that way than trying to read and absorb from the manuals, datasheets, and books.  Once (if??) I get everything functional, I'll drop you an update.  If you have any suggestions on what might be causing the errors on the comment lines, that would be helpful.

 

Thanks!

Share this post


Link to post
Share on other sites

I would still recommend installing stellarisware and using the instructions to get familiar with the process of using CCS and compiling the library there are lots of little gotchas that can burn lots of time (it would also let you see how it behaves when it works as expected) stellarisware is just a directory tree so you can have it installed in parallel with Tivaware and just delete it when you get comfortable and are ready to tackle Tivaware (which is almost exactly the same except they changed all the variable types)

 

Either way if you do port any of the stuff over please drop me a copy if you don't mind..

Share this post


Link to post
Share on other sites

Ok, working on reconciling your custom usbhid.h and usb-ids.h with the Tivaware ones.  usbhid.h was easy, but I have a question on usb-ids.h.  0x000D is assigned to USB_PID_CUSTOM in your usb-ids.h file.  It wasn't used in the original Stellarisware package.  However, in Tivaware, it is assigned to USB_PID_COMP_HID_HID.

 

Any ideas how to handle the conflict?  I haven't looked to see what USB_PID_COMP_HID_HID is used by in the Tivaware package yet, but I would hazard a guess I probably shouldn't reassign it to USB_PID_CUSTOM or it will end up breaking something.  Can I assign USB_PID_CUSTOM to 0x000E without breaking your code, or will I need to make other modifications as well?  0x000C isn't assigned in the Tivaware usb-ids.h file, so the USB_PID_GAMEPAD entry should be fine.

 

Once I get that taken care of, I'll move on to trying to get your example code working with Tivaware.

Share this post


Link to post
Share on other sites

One of the main reasons I created my framework was to support the lack of composite HID support in the framework, I'm guessing that is what USB_PID_COMP_HID_HID stands for. Just feel free to either use that value instead of USB_PID_CUSTOM or if you want just assign PID_CUSTOM to an unused value.

 

Product IDs really don't matter they just need to be unique per device you create (and across any examples you install) since the OS caches it and can get confused if the same PID is used for multiple devices.

 

Also I did manage to port my files over to Tivaware this weekend - I can try to post the new files to github tonight.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...