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

USB with RL-USB

Hy, i'm starting to program on stm32f407 and I have some problem using USB.

I manage to make simple application with wizard.
But now, i want to make for example an HID Application with more than one endpoint.
For example, i want ARM to send data to PC as a keyboard and mouse.

How can i make multiple endpoint and more complex HID report descriptor.

I use keil 4.54 and rl-arm library.

Thanks for your help.
I found help and manual not clear on this point.

Parents
  • Ah, thanks.
    I wasn't aware that usb_config.c includes usb_lib.c

    As of override of standard/class request handlers, maybe these routines are callbacks for this purpose.

    \Keil\ARM\RV31\INC\usb_lib.c
    
    #if    (USBD_HID_ENABLE)
      ...
    #else
      BOOL USBD_ReqGetDescriptor_HID          (U8 **pD, U32 *len) { return (__FALSE); }
      BOOL USBD_EndPoint0_Setup_HID_ReqToIF   (void)              { return (__FALSE); }
      BOOL USBD_EndPoint0_Out_HID_ReqToIF     (void)              { return (__FALSE); }
    #endif  /* (USBD_HID_ENABLE) */
    

    To write custom handlers using these callbacks, this SETUP data should be required.

    \Keil\ARM\RL\USB\INC\usb_def.h
    
    /* USB Default Control Pipe Setup Packet */
    typedef __packed struct _USB_SETUP_PACKET {
      REQUEST_TYPE bmRequestType;           /* bmRequestType */
      U8  bRequest;                         /* bRequest */
      __packed union {
        U16        wValue;                  /* wValue */
        __packed struct {
          U8         wValueL;
          U8         wValueH;
        };
      };
      __packed union {
        U16        wIndex;                  /* wIndex */
        __packed struct {
          U8         wIndexL;
          U8         wIndexH;
        };
      };
      U16          wLength;                 /* wLength */
    } USB_SETUP_PACKET;
    
    \Keil\ARM\RL\USB\INC\usbd_core.h
    
    extern USB_SETUP_PACKET USBD_SetupPacket;
    

    Tsuneo

Reply
  • Ah, thanks.
    I wasn't aware that usb_config.c includes usb_lib.c

    As of override of standard/class request handlers, maybe these routines are callbacks for this purpose.

    \Keil\ARM\RV31\INC\usb_lib.c
    
    #if    (USBD_HID_ENABLE)
      ...
    #else
      BOOL USBD_ReqGetDescriptor_HID          (U8 **pD, U32 *len) { return (__FALSE); }
      BOOL USBD_EndPoint0_Setup_HID_ReqToIF   (void)              { return (__FALSE); }
      BOOL USBD_EndPoint0_Out_HID_ReqToIF     (void)              { return (__FALSE); }
    #endif  /* (USBD_HID_ENABLE) */
    

    To write custom handlers using these callbacks, this SETUP data should be required.

    \Keil\ARM\RL\USB\INC\usb_def.h
    
    /* USB Default Control Pipe Setup Packet */
    typedef __packed struct _USB_SETUP_PACKET {
      REQUEST_TYPE bmRequestType;           /* bmRequestType */
      U8  bRequest;                         /* bRequest */
      __packed union {
        U16        wValue;                  /* wValue */
        __packed struct {
          U8         wValueL;
          U8         wValueH;
        };
      };
      __packed union {
        U16        wIndex;                  /* wIndex */
        __packed struct {
          U8         wIndexL;
          U8         wIndexH;
        };
      };
      U16          wLength;                 /* wLength */
    } USB_SETUP_PACKET;
    
    \Keil\ARM\RL\USB\INC\usbd_core.h
    
    extern USB_SETUP_PACKET USBD_SetupPacket;
    

    Tsuneo

Children
No data