LPC1343 - USB HID ROM Keyboard implementation

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

LPC1343 - USB HID ROM Keyboard implementation

336 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mark_t3 on Sun May 15 09:12:51 MST 2011
[SIZE=2]Hi all
I need to use the LPC1343 USB Rom driver to implement a simple Keyboard HID device.

Going through the usbhidrom example and documentation I can't seem to determine how to modify the Interface descriptor. 

It's defined in usb.h but I can't seem to find anywhere in the example code where it is created.

I have to assume that it is either hardcoded by the USBrom and/or it exists within the USBrom reserved ram space.
[/SIZE][FONT=Courier New][SIZE=2][COLOR=#3f7f5f][FONT=Courier New][SIZE=2][COLOR=#3f7f5f][FONT=Courier New][SIZE=2][COLOR=#3f7f5f]
/* USB Standard Interface Descriptor */
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][B][FONT=Courier New][SIZE=2][COLOR=#7f0055][FONT=Courier New][SIZE=2][COLOR=#7f0055][FONT=Courier New][SIZE=2][COLOR=#7f0055]typedef[/B][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] PACKED_PRE [/SIZE][/FONT][/SIZE][/FONT][B][FONT=Courier New][SIZE=2][COLOR=#7f0055][FONT=Courier New][SIZE=2][COLOR=#7f0055][FONT=Courier New][SIZE=2][COLOR=#7f0055]struct[/B][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] _USB_INTERFACE_DESCRIPTOR {
[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032]uint8_t[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0]bLength[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];
[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032]uint8_t[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0]bDescriptorType[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];
[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032]uint8_t[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0]bInterfaceNumber[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];
[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032]uint8_t[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0]bAlternateSetting[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];
[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032]uint8_t[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0]bNumEndpoints[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];
[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032]uint8_t[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0]bInterfaceClass[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];
[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032]uint8_t[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0]bInterfaceSubClass[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];
[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032]uint8_t[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0]bInterfaceProtocol[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];
[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032]uint8_t[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0]iInterface[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];
} PACKED_POST [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032][FONT=Courier New][SIZE=2][COLOR=#005032]USB_INTERFACE_DESCRIPTOR[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];[/SIZE][/FONT][/SIZE][/FONT]
[FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]
[/SIZE][/FONT][/SIZE][/FONT][SIZE=2]The problem is that I need to set the [/SIZE][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0]bInterfaceProtocol[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0] to keyboard(1). [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
[FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0]
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][SIZE=2]Also I can't seem to get the Forums search to work, so Im running a bit blind.

I have found some example of Keyboard code fragment on the forum but they are based on a different example code base I don't have.


Thanks
Mark Thompson
[/SIZE]
0 Kudos
3 Replies

292 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ktownsend on Sun May 15 13:14:48 MST 2011

Quote: mark_t3
I have read Chap 10, and looking at table 184 it indicates that most of the fields are hardcoded.
I would have expected some sort of structure pointer assigment for replacing sub sections of the HID descriptor.


Thanks
Mark



While I love the 1343 and the ROM-based USB, there are definate limitations to it.  With HID you're limited to a single in and out report, for example, and if you need a bit more flexbility you may end up having to use a full USB stack (NXP also provides examples based on the Keil stack).  The ROM-based USB HID is great for simple I/O like sending and receiving bytes and chunks of data, but there are situations where it's more appropriate to do it yourself.
0 Kudos

292 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mark_t3 on Sun May 15 11:40:33 MST 2011
I have read Chap 10, and looking at table 184 it indicates that most of the fields are hardcoded.
I would have expected some sort of structure pointer assigment for replacing sub sections of the HID descriptor.


Thanks
Mark
0 Kudos

292 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jharwood on Sun May 15 11:28:01 MST 2011

Quote: mark_t3
[SIZE=2][/SIZE][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0][FONT=Courier New][SIZE=2][COLOR=#0000c0]
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][SIZE=2]Also I can't seem to get the Forums search to work, so Im running a bit blind.

[/SIZE]



The forum search function is limited to using key words larger than three characters.
Try using google to search the forum:

Quote:

site:knowledgebase.nxp.com hid rom



Have you looked at Chapter 10 of the user manual - UM10375
0 Kudos