From: Michael McMaster Date: Mon, 15 Feb 2021 22:11:10 +0000 (+1000) Subject: Fix USB endpoint Fifo sizes X-Git-Tag: v6.4.0~6^2~6 X-Git-Url: http://git.codesrc.com/gitweb.cgi?a=commitdiff_plain;h=2a4b302c0a3483c7324a303286aa47ea52517ae1;p=SCSI2SD-V6.git Fix USB endpoint Fifo sizes --- diff --git a/STM32CubeMX/2020c.diff b/STM32CubeMX/2020c.diff index 7028835a..cc21a39e 100644 --- a/STM32CubeMX/2020c.diff +++ b/STM32CubeMX/2020c.diff @@ -209,3 +209,33 @@ index 902bdb2..4935bf0 100644 hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_4; hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB; hspi1.Init.TIMode = SPI_TIMODE_DISABLE; +diff --git a/STM32CubeMX/2020c/Src/usbd_conf.c b/STM32CubeMX/2020c/Src/usbd_conf.c +index adb664f..9b9b800 100644 +--- a/STM32CubeMX/2020c/Src/usbd_conf.c ++++ b/STM32CubeMX/2020c/Src/usbd_conf.c +@@ -458,9 +458,12 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev) + HAL_PCD_RegisterIsoOutIncpltCallback(&hpcd_USB_OTG_FS, PCD_ISOOUTIncompleteCallback); + HAL_PCD_RegisterIsoInIncpltCallback(&hpcd_USB_OTG_FS, PCD_ISOINIncompleteCallback); + #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ ++ ++ // Sum of all FIFOs must be <= 320. + HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_FS, 0x80); + HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 0, 0x40); +- HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x80); ++ HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x40); ++ HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 2, 0x40); + } + if (pdev->id == DEVICE_HS) { + /* Link the driver to the stack. */ +@@ -498,8 +501,9 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev) + HAL_PCD_RegisterIsoInIncpltCallback(&hpcd_USB_OTG_HS, PCD_ISOINIncompleteCallback); + #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_HS, 0x200); +- HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 0, 0x80); +- HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 1, 0x174); ++ HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 0, 0x40); ++ HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 1, 0x40); ++ HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 2, 0x174); + } + return USBD_OK; + } diff --git a/STM32CubeMX/2020c/Src/usbd_conf.c b/STM32CubeMX/2020c/Src/usbd_conf.c index adb664f0..9b9b8001 100644 --- a/STM32CubeMX/2020c/Src/usbd_conf.c +++ b/STM32CubeMX/2020c/Src/usbd_conf.c @@ -458,9 +458,12 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev) HAL_PCD_RegisterIsoOutIncpltCallback(&hpcd_USB_OTG_FS, PCD_ISOOUTIncompleteCallback); HAL_PCD_RegisterIsoInIncpltCallback(&hpcd_USB_OTG_FS, PCD_ISOINIncompleteCallback); #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + + // Sum of all FIFOs must be <= 320. HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_FS, 0x80); HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 0, 0x40); - HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x80); + HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x40); + HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 2, 0x40); } if (pdev->id == DEVICE_HS) { /* Link the driver to the stack. */ @@ -498,8 +501,9 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev) HAL_PCD_RegisterIsoInIncpltCallback(&hpcd_USB_OTG_HS, PCD_ISOINIncompleteCallback); #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_HS, 0x200); - HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 0, 0x80); - HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 1, 0x174); + HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 0, 0x40); + HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 1, 0x40); + HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 2, 0x174); } return USBD_OK; } diff --git a/STM32CubeMX/2021.diff b/STM32CubeMX/2021.diff index 47b090f0..b67f732e 100644 --- a/STM32CubeMX/2021.diff +++ b/STM32CubeMX/2021.diff @@ -209,3 +209,30 @@ index 902bdb2..1d8d45e 100644 hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_4; hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB; hspi1.Init.TIMode = SPI_TIMODE_DISABLE; +diff --git a/STM32CubeMX/2021/Src/usbd_conf.c b/STM32CubeMX/2021/Src/usbd_conf.c +index 1e08ba4..110da2f 100644 +--- a/STM32CubeMX/2021/Src/usbd_conf.c ++++ b/STM32CubeMX/2021/Src/usbd_conf.c +@@ -468,7 +468,8 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev) + #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_FS, 0x80); + HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 0, 0x40); +- HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x80); ++ HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x40); ++ HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 2, 0x40); + } + if (pdev->id == DEVICE_HS) { + /* Link the driver to the stack. */ +@@ -507,8 +508,9 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev) + HAL_PCD_RegisterIsoInIncpltCallback(&hpcd_USB_OTG_HS, PCD_ISOINIncompleteCallback); + #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_HS, 0x200); +- HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 0, 0x80); +- HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 1, 0x174); ++ HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 0, 0x40); ++ HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 1, 0x40); ++ HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 2, 0x174); + } + return USBD_OK; + } + diff --git a/STM32CubeMX/2021/Src/usbd_conf.c b/STM32CubeMX/2021/Src/usbd_conf.c index 1e08ba47..110da2f9 100644 --- a/STM32CubeMX/2021/Src/usbd_conf.c +++ b/STM32CubeMX/2021/Src/usbd_conf.c @@ -468,7 +468,8 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev) #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_FS, 0x80); HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 0, 0x40); - HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x80); + HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x40); + HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 2, 0x40); } if (pdev->id == DEVICE_HS) { /* Link the driver to the stack. */ @@ -507,8 +508,9 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev) HAL_PCD_RegisterIsoInIncpltCallback(&hpcd_USB_OTG_HS, PCD_ISOINIncompleteCallback); #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_HS, 0x200); - HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 0, 0x80); - HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 1, 0x174); + HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 0, 0x40); + HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 1, 0x40); + HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 2, 0x174); } return USBD_OK; }