cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32f103vet6 usb bulk multi enpoint.

tduon.14
Associate

Hello everybody !

I am working with usb bulk use libusbwin32 and hardware stm32f103vet6. I use multi endpoint EP1_IN, EP1_OUT, EP2_IN, EP2_OUT, EP3_IN, EP3_OUT, EP4_IN, EP4_OUT. But EP4_IN and EP4_OUT do not work, other endpoint working ok. Please help me. Here is my usb description and PMA endpoint address.

---------------------------------------------------------------------------------------------------------------------------------------

/* USB Configuration Descriptor */

/*  All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */

const uint8_t CustomHID_ConfigDescriptor[CUSTOMHID_SIZ_CONFIG_DESC] =

 {

  0x09, /* bLength: Configuration Descriptor size */

  USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */

  CUSTOMHID_SIZ_CONFIG_DESC,

  /* wTotalLength: Bytes returned */

  0x00,

  0x01,     /* bNumInterfaces: 1 interface */

  0x01,     /* bConfigurationValue: Configuration value */

  0x00,     /* iConfiguration: Index of string descriptor describing

                 the configuration*/

  0xC0,     /* bmAttributes: Self powered */

  0x32,     /* MaxPower 100 mA: this current is used for detecting Vbus */

  /************** Descriptor of Custom HID interface ****************/

  /* 09 */

  0x09,     /* bLength: Interface Descriptor size */

  USB_INTERFACE_DESCRIPTOR_TYPE,/* bDescriptorType: Interface descriptor type */

  0x00,     /* bInterfaceNumber: Number of Interface */

  0x00,     /* bAlternateSetting: Alternate setting */

  0x08,     /* bNumEndpoints */

  0xff,     /* bInterfaceClass: HID */

  0xff,     /* bInterfaceSubClass : 1=BOOT, 0=no boot */

  0xff,     /* nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse */

  0,      /* iInterface: Index of string descriptor */

  /******************** Descriptor of Custom HID HID ********************/

  /* 18 */

  0x07,     /* bLength: Endpoint Descriptor size */

  USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: */

  0x81,     /* bEndpointAddress: Endpoint Address (IN) */

  0x02,     /* bmAttributes: Interrupt endpoint */

  0x20,     /* wMaxPacketSize: 2 Bytes max */

  0x00,

  0x01,     /* bInterval: Polling Interval (32 ms) */

  /* 25 */

  

  0x07, /* bLength: Endpoint Descriptor size */

  USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: */

/* Endpoint descriptor type */

  0x01, /* bEndpointAddress: */

/* Endpoint Address (OUT) */

  0x02, /* bmAttributes: Interrupt endpoint */

  0x20, /* wMaxPacketSize: 2 Bytes max */

  0x00,

  0x01, /* bInterval: Polling Interval (20 ms) */

  /* 32 */

0x07,     /* bLength: Endpoint Descriptor size */

  USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: */

  0x82,     /* bEndpointAddress: Endpoint Address (IN) */

  0x02,     /* bmAttributes: Interrupt endpoint */

  0x20,     /* wMaxPacketSize: 2 Bytes max */

  0x00,

  0x01,     /* bInterval: Polling Interval (32 ms) */

  /* 39 */

  

  0x07, /* bLength: Endpoint Descriptor size */

  USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: */

/* Endpoint descriptor type */

  0x02, /* bEndpointAddress: */

/* Endpoint Address (OUT) */

  0x02, /* bmAttributes: Interrupt endpoint */

  0x20, /* wMaxPacketSize: 2 Bytes max */

  0x00,

  0x01, /* bInterval: Polling Interval (20 ms) */

  /* 46 */

0x07,     /* bLength: Endpoint Descriptor size */

  USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: */

  0x83,     /* bEndpointAddress: Endpoint Address (IN) */

  0x02,     /* bmAttributes: Interrupt endpoint */

  0x20,     /* wMaxPacketSize: 2 Bytes max */

  0x00,

  0x01,     /* bInterval: Polling Interval (32 ms) */

  /* 53 */

  

  0x07, /* bLength: Endpoint Descriptor size */

  USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: */

/* Endpoint descriptor type */

  0x03, /* bEndpointAddress: */

/* Endpoint Address (OUT) */

  0x02, /* bmAttributes: Interrupt endpoint */

  0x20, /* wMaxPacketSize: 2 Bytes max */

  0x00,

  0x01, /* bInterval: Polling Interval (20 ms) */

  /* 60 */

0x07,     /* bLength: Endpoint Descriptor size */

  USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: */

  0x84,     /* bEndpointAddress: Endpoint Address (IN) */

  0x02,     /* bmAttributes: Interrupt endpoint */

  0x20,     /* wMaxPacketSize: 2 Bytes max */

  0x00,

  0x01,     /* bInterval: Polling Interval (32 ms) */

  /* 67 */

  

  0x07, /* bLength: Endpoint Descriptor size */

  USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: */

/* Endpoint descriptor type */

  0x04, /* bEndpointAddress: */

/* Endpoint Address (OUT) */

  0x02, /* bmAttributes: Interrupt endpoint */

  0x20, /* wMaxPacketSize: 2 Bytes max */

  0x00,

  0x01, /* bInterval: Polling Interval (20 ms) */

  /* 74 */

 }

 ;

-PMA--------------------------------------------------------------------------------------------------------------------------------

/* buffer table base address */

#define BTABLE_ADDRESS   (0x00)

/* EP0 */

/* tx/rx buffer base address */

#define ENDP0_TXADDR    (0x40)

#define ENDP0_RXADDR    (0x80)

/* EP1 */

/* tx/rx buffer base address */

#define ENDP1_TXADDR    (0xC0)

#define ENDP1_RXADDR    (0xE0)

/* EP2 */

/* tx/rx buffer base address */

#define ENDP2_TXADDR    (0x100)

#define ENDP2_RXADDR    (0x120)

/* EP3 */

/* tx/rx buffer base address */

#define ENDP3_TXADDR    (0x140)

#define ENDP3_RXADDR    (0x160)

/* EP4 */

/* tx/rx buffer base address */

#define ENDP4_TXADDR    (0x180)

#define ENDP4_RXADDR    (0x1A0)

2 REPLIES 2
Ben K
Senior III

Did you try how it works if you increase the bInterval of all endpoints? Maybe the problem is that the host won't perform all interrupt transfers in one frame.

tduon.14
Associate

I use "Test Bulk" software on PC for libUsbWin32 to test endpoint work. It can be transmit or receive data with EP1_IN,EP1_OUT, EP2_IN,EP2_OUT, EP3_IN,EP3_OUT but with EP4_IN, EP4_OUT it can't. 0690X000006DlaGQAS.jpg