Skip to content

Commit 53103b6

Browse files
committed
STM32: USB: allow more endpoints for OTG_HS ports
1 parent 98f3963 commit 53103b6

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

targets/TARGET_STM/USBPhy_STM32.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
#define NUM_ENDPOINTS 6
3535
#define MAX_PACKET_SIZE_NON_ISO 512
36-
#define MAX_PACKET_SIZE_ISO 1023 // Spec can go up to 1023, only ram for this though
36+
#define MAX_PACKET_SIZE_ISO 1023
3737

3838
#else
3939

@@ -47,6 +47,10 @@ static const uint32_t tx_ep_sizes[NUM_ENDPOINTS] = {
4747
MAX_PACKET_SIZE_NON_ISO,
4848
MAX_PACKET_SIZE_NON_ISO,
4949
MAX_PACKET_SIZE_NON_ISO,
50+
#if (MBED_CONF_TARGET_USB_SPEED == USE_USB_OTG_HS)
51+
MAX_PACKET_SIZE_NON_ISO,
52+
MAX_PACKET_SIZE_NON_ISO,
53+
#endif
5054
MAX_PACKET_SIZE_ISO
5155
};
5256

@@ -408,11 +412,18 @@ void USBPhyHw::remote_wakeup()
408412
const usb_ep_table_t *USBPhyHw::endpoint_table()
409413
{
410414
static const usb_ep_table_t table = {
415+
#if (MBED_CONF_TARGET_USB_SPEED != USE_USB_OTG_HS)
411416
1280, // 1.25K for endpoint buffers but space is allocated up front
417+
#else
418+
4096,
419+
#endif
412420
{
413421
{USB_EP_ATTR_ALLOW_CTRL | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
414422
{USB_EP_ATTR_ALLOW_BULK | USB_EP_ATTR_ALLOW_INT | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0}, // NON ISO
415423
{USB_EP_ATTR_ALLOW_BULK | USB_EP_ATTR_ALLOW_INT | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0}, // NON ISO
424+
#if (MBED_CONF_TARGET_USB_SPEED == USE_USB_OTG_HS)
425+
{USB_EP_ATTR_ALLOW_ALL | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
426+
#endif
416427
{USB_EP_ATTR_ALLOW_ALL | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
417428
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
418429
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
@@ -425,7 +436,9 @@ const usb_ep_table_t *USBPhyHw::endpoint_table()
425436
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
426437
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
427438
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
439+
#if (MBED_CONF_TARGET_USB_SPEED != USE_USB_OTG_HS)
428440
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0}
441+
#endif
429442
}
430443
};
431444
return &table;

0 commit comments

Comments
 (0)