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

Questions about USB on LPC2368

Hello guys,

I am a first timer with USB and like many others, VERY CONFUSED.

To start with, i have downloaded the example code for USBHID for LPC2368 and it is not working, leading to more confusion but most of them are conceptual and here are a few of them :

1. How will the code call the functions usbcore.c ?

2. How will the code initialize the descriptors and endpoints ?

Any help will be greatly appreciated.

Thanks.
Nitin

  • Are you the same one who posted this topic to LPC2000 ?

    USB Enumeration in LPC2368
    tech.groups.yahoo.com/.../44509

    Then, I've already answered to you.

    > 1. How will the code call the functions usbcore.c ?

    Are you talking about this KEIL example?

    LPC2368 / LPC2378 USB HID (Human Interface Device) Example
    http://www.keil.com/download/files/lpc2368_usbhid.zip

    - USB_ResetCore() - called from USB_ISR() (usbhw.c) on bus reset
    - USB_EndPoint0 - called from USB_ISR() through USB_P_EP[] function pointer table, when the default endpoint receives a transaction.

    These Control transfer handlers are called from USB_EndPoint0() or request handlers under USB_EndPoint0(), when the default endpoint receives SETUP, IN or OUT transaction. They corresponds to the stages of control transfer, SETUP, DATA, STATUS.
    - USB_SetupStage(),
    - USB_DataInStage(), USB_StatusOutStage(),
    - USB_DataOutStage(), USB_StatusInStage()

    These handlers for standard device requests are called from USB_EndPoint0, when the device receives SETUP transaction on the default endpoint.
    - USB_GetStatus(), USB_GetDescriptor(),
    - USB_SetClrFeature(), USB_SetConfiguration(), USB_SetInterface(),

    > 2. How will the code initialize the descriptors and endpoints ?

    USB firmware doesn't initialize descriptors, because they are provided as code constants, in most cases. When the firmware receives Get_Descriptor request from host, it reads out descriptor(s) specified by the request from the code space, and sends it back.

    Initialization of the default endpoint is done when the device gets bus reset from host. For other endpoints, initialization is done when the device receives Set_Configuration request. If interface has alternate one, initialization of endpoints is also done in Set_Interface request.

    Tsuneo