From aa9a7e882c8eb0f5fb46be5cd84ffd98cb3cfb9c Mon Sep 17 00:00:00 2001 From: "William D. Jones" Date: Wed, 23 Jan 2019 00:55:45 -0500 Subject: [PATCH] stm32f4: Properly set control endpoint max packet size. --- src/portable/stm/stm32f4/dcd_stm32f4.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/portable/stm/stm32f4/dcd_stm32f4.c b/src/portable/stm/stm32f4/dcd_stm32f4.c index 4adb52a7..53e0868a 100644 --- a/src/portable/stm/stm32f4/dcd_stm32f4.c +++ b/src/portable/stm/stm32f4/dcd_stm32f4.c @@ -104,7 +104,13 @@ static void end_of_reset(void) { // Maximum packet size for EP 0 is set for both directions by writing // DIEPCTL. - in_ep[0].DIEPCTL |= enum_spd; + if(enum_spd == 0x03) { + // 64 bytes + in_ep[0].DIEPCTL &= ~(0x03 << USB_OTG_DIEPCTL_MPSIZ_Pos); + } else { + // 8 bytes + in_ep[0].DIEPCTL |= (0x03 << USB_OTG_DIEPCTL_MPSIZ_Pos); + } xfer_status[0][TUSB_DIR_OUT].max_size = 64; xfer_status[0][TUSB_DIR_IN].max_size = 64; }