From c7cc58ca771a18faa0a8cb5c7f10a3b8bd429776 Mon Sep 17 00:00:00 2001 From: Marc Desvaux Date: Fri, 19 Jan 2024 10:38:38 +0100 Subject: [PATCH] drivers: usb_dc_stm32: Fix OUT transfer issue The driver cannot handle OUT transactions for an endpoint with an MPS smaller than 64 bytes. To solve the issue, we will not use one fixed value, EP_MPS, but instead use the actual MPS of an endpoint, ep_state->ep_mps. Signed-off-by: Marc Desvaux Signed-off-by: Loic Poulain --- drivers/usb/device/usb_dc_stm32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/device/usb_dc_stm32.c b/drivers/usb/device/usb_dc_stm32.c index 326c6e284a2..13131061610 100644 --- a/drivers/usb/device/usb_dc_stm32.c +++ b/drivers/usb/device/usb_dc_stm32.c @@ -784,7 +784,7 @@ int usb_dc_ep_enable(const uint8_t ep) if (USB_EP_DIR_IS_OUT(ep) && ep != EP0_OUT) { return usb_dc_ep_start_read(ep, usb_dc_stm32_state.ep_buf[USB_EP_GET_IDX(ep)], - EP_MPS); + ep_state->ep_mps); } return 0; @@ -923,7 +923,7 @@ int usb_dc_ep_read_continue(uint8_t ep) */ if (!ep_state->read_count) { usb_dc_ep_start_read(ep, usb_dc_stm32_state.ep_buf[USB_EP_GET_IDX(ep)], - EP_MPS); + ep_state->ep_mps); } return 0;