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

EK-STM32F Keil example using endpoint2

Hi,

if tested the KEIL USB-HID example for the EK-STM32F. It is working!

But when I change the endpoint IN from 1 to 2 -> it seems that the device will never get any interrupts which should call the void USB_EndPoint2 (U32 event) function.

Do someone know which additional changes I have to do? I've only add the endpoint2 interrupt to USB_EP_EVENT.

best regards
Jeeremie

  • Check that endpoint supports Interrupt transfer using your User manual. HID must support atleast one Interrupt endpoint.

    Regards,
    D.

  • you mean, not every endpoint from the processor won't understand an interrupt endpoint type encoding?

    According to the user manual, you are able to set the endpoint type encoding for every endpoint as you like. It seems that there is no restriction!

  • >>you mean, not every endpoint from the processor won't >>understand an interrupt endpoint type encoding?

    It is based on what controller you are choosing. For example LPC23xx USB Device controller have some fixed endpoint configuration. (Pls refer UM10211_2.pdf, page number 318). you can download it from LPC site.

    >> It seems that there is no restriction!

    what you mean by restriction in endpoint type decoding?
    Most of the usb controllers, internally hard-coded (chip) the configuration value (i.e., endpoint type) and they mentioned it in spec, which endpoint is routed to usb transfer type.

    In your case, check for this kind of settings. If they did not mention anything in spec, you can configure your endpoint for your transfer.

    Regards,
    D.

  • There are no fixed endpoint configurations by the STM32F103 processor; therefore there must be some other important changes to enable endpoint2 as working endpoint!

    Maybe someone could give me some hints!

  • Hello Jeremie Quolage,

    in uVision open file usbcfg.h. Change to Configuration Wizard View (see tab at the bottom of the file).
    Check if Endpoint 2 events are checked under USB Event Handlers - Endpoint Events.

    Best Regards,
    Martin Guenther

  • yes enpoint2 events are already checked - as well as I increased the number of endpoints to 3.

  • Hello Jeremie Quolage,

    did you change in file hiduser.h the define HID_EP_IN from 0x81 to 0x82?

    Best Regards, Martin

  • Hi Martin,

    I found the mistake - but I'm very appreciate if you could tell me the reason for this behaviour.

    In the c-file usbuser.c there's a function installed called "USB_Configure_Event". What is the reason for this function?

    Per default - there's an dummy call of USB_WriteEP() - I don't know why... And the strange thing about it is, if I delete this function call USB_WriteEP() then there will be no communication with the endpoint2. That means the function USB_EndPoint2() will be never called.

    But if there's the function call in USB_Configure_Event - everything is running.

    void USB_Configure_Event (void)
    {
    if (USB_Configuration) {      /* Check if USB is configured */
        GetInReport();
        USB_WriteEP(0x82, &InReport, sizeof(InReport));
      }
    }
    

    I hope you could tell me reason for this behaviour.

    Thanks in advance!

  • Hi Jeremie Quolage,

    Please see this thread:

    http://www.keil.com/forum/docs/thread15613.asp

    Author: Tsuneo Chinzei
    Posted: 24-Sep-2009 17:48 GMT
    Toolset: ARM

    USB_Configure_Event() is called when Set_Configuration request comes from host on enumeration. In this routine, an input report is loaded to the EP1 IN buffer using USB_WriteEP(). This report is the first one. When host starts to repeat IN transactions just after enumeration, this report is sent to the host. And then, USB interrupt occurs at the IN EP1.

    On this interrupt, USB_EndPoint1() is called.
    This routine fills the endpoint buffer with a report using USB_WriteEP().
    This report is sent to host at the next IN transaction after the specified interval (bInterval).
    Another endpoint interrupt occurs, and USB_EndPoint1() is called again.

    In this way, USB_EndPoint1() is called repeatedly, at bInterval.

    If you put nothing to the endpoint buffer in USB_EndPoint1(), what happens?
    No report is sent to the host, and no endpoint interrupt occurs.
    The sequence stops, USB_EndPoint1() is never called any more,
    until you fill the endpoint buffer with USB_WriteEP().

    I suppose this is your story, isn't it?