LPC11u14 USB Function

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC11u14 USB Function

1,563 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by yanyc on Sat Feb 04 19:09:46 MST 2012
Hi all,

I would like to use nxpUSBlib to build an USB device application-HID generic type on device 11uxx. In the example project on HID generic type(in path Demos\Device\ClassDriver\GenericHID\GenericHID.c), I only see a couple of code and there is no description or example that shows me how:
1. To enable PC detect my device
2. To enable data sending/receiving between PC and the device(11uxx)

Kindly give me some guidance on the above.

In addition, I would like to know can I use nxpUSBlib to connect my device and appear to PC as virtual serial comm? Any example on this?

Best regards,
Yan
标签 (1)
0 项奖励
回复
5 回复数

1,345 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tuong on Mon Mar 26 20:53:00 MST 2012
Dear Ticup,

For HID application, the PC host keep polling for device reports through interrupt pipe and perform SET/GET through control pipe. So for your purpose, you need to:
   - Look into the HIDDeiviceClass.c, function void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo), check if there is a request fit your need, if not, add it in.
   - Create a CALLBACK_HID_Device_xxxxxx function in your application layer, ex. Mouse.c or Keyboard.c, to implement your design task like turn on/off LEDs.
   - Call this CALLBACK function in your request under HID_Device_ProcessControlRequest().

With best regards,
Tuong Nguyen
0 项奖励
回复

1,345 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ticup on Thu Mar 01 09:55:07 MST 2012
Dear, nxpUSBlib team, thanks a lot, for the help....I downloaded and configured nxpUSBLib for my particular platform LPC11U14/201.
I run Example_KeyboardDevice and Example_MouseDevice. I can see in Device Manager in and out the HID USB. I need to go one step further and send some mouse coordinates or keyboard strokes .....to my PC. I can see everything goes on in the main as follow:

int main(void)
{
SetupHardware();

LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();

for (;;)
{
HID_Device_USBTask(&Keyboard_HID_Interface);
USB_USBTask();
}
}

So I try to figure out maybe Keyboard_HID_Interface buffer ??? Maybe there are documents that explain all this...or do you have any other idea how to go ahead and send receive from USB. My project will need to send and receive data thru USB. Thanks in anticipation of your help....

0 项奖励
回复

1,345 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nxpUSBlib team on Wed Feb 29 15:43:12 MST 2012
The current release can be found here: http://lpcware.com/content/project/nxpusblib
0 项奖励
回复

1,345 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ticup on Wed Feb 29 10:21:47 MST 2012
Just reading your post, I am in the same position to build an app using the USB HID. I am new at this subject....could you please help me where to find the "Demos\Device\ClassDriver\GenericHID\GenericHID.c" I think I will need the same nxpUSBlib

Could you please let me know how you end up having this nxpUSBlib??? thanks with anticipation....
0 项奖励
回复

1,345 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nxpUSBlib team on Mon Feb 13 10:31:57 MST 2012
The next release of nxpUSBlib will include more comprehensive build and run documentation for all of our examples. I will append this documentation for the GenericHID example at the end of this response so you don't have to wait. This should answer your first question.

To answer your second question I suggest you reference our mouse or keyboard examples. They are both working HID class examples that show data moving from the device to the host. Our KeyboardHost example shows data moving the other way.

As for the virtual serial comm example, this is going to be in our next release which we are hoping to get out in a couple of weeks.

Here's the new docs for the GenericHID example:

===============================
==                           ==
== GenericHIDDevice example ==
==                           ==
===============================

This example implements a generic HID device. It contains no funtionality other
than enumerating as a HID device on the PC.

===================================
==                               ==
== Compiler build configurations ==
==                               ==
===================================

The software that makes up this example is designed to run on many different
development boards. Therefore the compiler must be configured to build an image
that is targeted to the development board you are using. This section explains
how to set these build configurations for each of the supported compilers.

LPCXpresso IDE
--------------

Configure projects:

  Right click on the BSP project in the project explorer window click
  Build Configurations->Set Active->(see configuration in table below)
  repeat these steps for all the below projects as well.
 
  CDL
  nxpUSBlib
  Example_GenericHIDDevice

Configure MCU:

  Right click on the Example_GenericHIDDevice project in the project explorer
  window then click Properties->C/C++ Build->MCU settings->(see configuration in
  table below).

Configure the indexer:
   Click Window->Preferences->C/C++->Indexer->Use active build configuration

                                  BSP                  CDL           nxpUSBlib    Example_GenericHIDDevice    MCU
                        =======================  ===============  ==============  =========================  ========
LPC11U14 / LPCXpresso   LPC11Uxx_LPCXpressoRevB     LPC11Uxx      LPC11Uxx_Device          LPC11Uxx          LPC11U14
LPC1768  / MCB1700      LPC1768_MCB1700             LPC17xx       LPC17xx_Device           LPC17xx           LPC1768
LPC1768  / LPCXpresso   LPC17xx_LPCXpressoRevB      LPC17xx       LPC17xx_Device           LPC17xx           LPC1768
LPC1850  / Hitex        LPC18xx_HITEX               LPC18xx       LPC18xx_Device           LPC18xx           LPC1850
LPC1850  / EA1800       LPC18xx_EA                  LPC18xx       LPC18xx_Device           LPC18xx           LPC1850

Keil uVision 4 IDE
------------------
Open Project: To open this project go to Project-> Open Project... Go to the BSP
directory on click on the BSP.uvproj

Configure a Batch Build:
  Click on Project->Batch Build... expand the BSP project to display a list of
  project targets select the project target by checking the appropriate checkbox
(see target list in table below) repeat these steps with the

  CDL
  nxpUSBlib_Device
  Example_GenericHIDDevice

                       BSP       CDL    nxpUSBlib_Device GenericHIDDevice
                   ========== ========= ================ =======================
LPC1768  / MCB1700  MCB1700    LPC17xx   LPC17xx_Device          MCB1700
LPC1850  / Hitex    HITEX1800  LPC18xx   LPC18xx_Device          HITEX1800

==========================================
==                                      ==
== Board connections and configurations ==
==                                      ==
==========================================

LPC11Uxx_LPCXpressoRevB (LPCXpresso LPC11Uxx on the LPCXpresso Rev B base board)
--------------------------------------------------------------------------------
schematic: ./BSP/schematics/lpcxpresso.lpc11u14.schematic.pdf

Running this example on the LPCXpresso LPC11U14 can be done one of two ways:

1. LPCXpresso LPC11U14 stand-alone
  Connect the type-B end of a USB cable to the mini receptacle on the
    LPCXpresso board labeled J8 and the type-A end to the USB receptacle on a PC

2. LPCXpresso LPC11U14 plugged into the LPCXpresso base board Rev B
  Plug the LPCXpresso LPC11U14 board into the connector labeled J4 on a
    LPCXpresso base board Rev B
  Configure the base board according to the user's guide from Embedded Artists
  Connect the mini type-B end of a USB cable to the receptacle on the base board
    labeled X1 and the type-A end to the USB receptacle on a PC
  Once the USB cable is connected to the board the following LEDs should be
    illuminated:
      LED25  (vbus)
     LED26  (3.3v rail)

For both configurations the JTAG debugger is connected to the mini USB receptacle labeled J3 on the LPCXpresso LPC11U14 board


LPC1768_MCB1700 (Keil MCB1700 development board)
------------------------------------------------
schematic: ./BSP/schematics/mcb1700-schematics.pdf

Jumpers:
  E/U    = 1-2  (Ethernet/USB)
  UMODE  = 1-2  (USB Device Mode)
  D-     = Device
  D+     = Device
  VBUS   = 1-2
  VDDIO  = 1-2
  VDDREG = 1-2
 
Connect the JTAG debugger to the 20 pin JTAG or 10 pin Cortex Debug connector.
Connect the type-B end of a USB cable to the type-B recepticle labeled 'Device'
and the type-A end of the cable to the USB receptacle on a PC. Once the USB
cable is connected to the board the following LEDs should be illuminated:
    Power
    100MHz
    USC (LED indicates a USB soft connect from P2.9)

LPC17xx_LPCXpressoRevB (LPCXpresso LPC17xx on the LPCXpresso Rev B base board)
------------------------------------------------------------------------------
schematic: ./BSP/schematics/LPCXpressoLPC1769revB.pdf

Running this example on the LPCXpresso LPC1769 can be done one of two ways:

1. LPCXpresso LPC1769 stand-alone. Solder a type-B USB receptacle onto the board
   and wire it up. See included schematics for details. Connect the type-B end
   of a USB cable to the receptacle on the LPCXpresso board and the type-A end
   to the USB receptacle on a PC

2. LPCXpresso LPC1769 plugged into the LPCXpresso base board Rev B. Plug the
   LPCXpresso LPC1769 board into the connector labeled J4 on a LPCXpresso base
   board Rev B. Configure the base board according to the users guide from
   Embedded Artists. Connect the mini type-B end of a USB cable to the
   receptacle on the base board labeled X1 and the type-A end to the USB
   receptacle on a PC.
  
   Once the USB cable is connected to the board the following LEDs should be
   illuminated:
      LED25  (vbus)
      LED26  (3.3v rail)

   For both configurations the JTAG debugger is connected to the mini USB
   receptacle labeled J3 on the LPCXpresso LPC1769 board.

======================
==                  ==
== PC configuration ==
==                  ==
======================

Use a PC running Windows XP, Vista or 7 connect the type-A end of the USB cable
that is connected to the board into one of the USB receptacles on the PC.

=================================
==                             ==
== Build and debug the example ==
==                             ==
=================================

LPCXpresso IDE
--------------

In the project explorer window of the IDE right click on the
Example_GenericHIDDevice project and select Build. Once the project has
completed building then right click on Example_GenericHIDDevice project and
select Debug As->C/C++ MCU Application. In the main window of the IDE click
Run->Resume to start running the application

================================================
==                                            ==
== How this example runs and what to look for ==
==                                            ==
================================================

When the example is run and the board is connected to a PC with a USB cable it
will enumerate on the PC as a generic HID device. You should see the device
appear in the "Device Manager" under the "Human Interface Device" section as the
last entry in the list. If you right click on USB Input Device->Properties
a window will appear called "USB Input Device Properties". If you
select the "Details" tab you will see a "Properties" drop down, click on it and
select "Hardware Ids". You should see the below entries for Vendor Id and
Product Id.

USB\VID_1FC9&PID_0007&REV_0100
USB\VID_1FC9&PID_0007

This information should match the data in the "Device Descriptor Sturcture"
in the "Descriptors.c" file in the Example_GenericHIDDevice project directory.
0 项奖励
回复