From 4b7578b2ebb2fe3764689437a7b9db4d87027cb2 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Thu, 17 Nov 2022 14:07:38 +0100 Subject: [PATCH 1/3] pkg/tinyusb: fix USB speed selection for STM32 --- cpu/stm32/include/tinyusb_hw_defaults.h | 14 +++++++++++++- pkg/tinyusb/contrib/include/tusb_config.h | 4 ---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/cpu/stm32/include/tinyusb_hw_defaults.h b/cpu/stm32/include/tinyusb_hw_defaults.h index 4128227552..a7a0a51eeb 100644 --- a/cpu/stm32/include/tinyusb_hw_defaults.h +++ b/cpu/stm32/include/tinyusb_hw_defaults.h @@ -83,12 +83,24 @@ extern "C" { #define TINYUSB_TUH_RHPORT 1 #endif +/* + * Only if the module `periph_usbdev_hs_utmi` or `periph_usbdev_hs_ulpi` is + * enabled for the HS port, a HS PHY is used and OPT_MODE_HIGH_SPEED must be + * set. Otherwise, the built-in on-chip FS PHY is used and + * OPT_MODE_DEFAULT_SPEED should be set so tinyUSB can select the correct speed. + */ +#if (MODULE_PERIPH_USBDEV_HS_UTMI || MODULE_PERIPH_USBDEV_HS_ULPI) +#define TINYUSB_OPT_SPEED OPT_MODE_HIGH_SPEED +#else +#define TINYUSB_OPT_SPEED OPT_MODE_DEFAULT_SPEED +#endif + /* * Since tinyUSB does not support host mode for STM32 MCUs yet, only * OPT_MODE_DEVICE is enabled for the port. Once tinyUSB supports the host mode, * OPT_MODE_HOST could be added to CFG_TUSB_RHPORT1_MODE */ -#define CFG_TUSB_RHPORT1_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED) +#define CFG_TUSB_RHPORT1_MODE (OPT_MODE_DEVICE | TINYUSB_OPT_SPEED) #else diff --git a/pkg/tinyusb/contrib/include/tusb_config.h b/pkg/tinyusb/contrib/include/tusb_config.h index 06181ab416..f090b43113 100644 --- a/pkg/tinyusb/contrib/include/tusb_config.h +++ b/pkg/tinyusb/contrib/include/tusb_config.h @@ -251,10 +251,6 @@ */ #define CFG_TUD_ENABLED MODULE_TINYUSB_DEVICE -#ifndef CFG_TUD_MAX_SPEED -#define CFG_TUD_MAX_SPEED OPT_MODE_DEFAULT_SPEED -#endif - #ifndef CFG_TUD_ENDPOINT0_SIZE #define CFG_TUD_ENDPOINT0_SIZE CONFIG_TUSBD_EP0_SIZE #endif From c42b6d601d2ea67ca279563fb4c8e21bef3709ff Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Thu, 17 Nov 2022 17:50:20 +0100 Subject: [PATCH 2/3] pkg/tinyusb: fix CONFIG_CLOCK_HSE for STM32 --- pkg/tinyusb/hw/hw_stm32_otg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/tinyusb/hw/hw_stm32_otg.c b/pkg/tinyusb/hw/hw_stm32_otg.c index e6bccb2636..2346f38d68 100644 --- a/pkg/tinyusb/hw/hw_stm32_otg.c +++ b/pkg/tinyusb/hw/hw_stm32_otg.c @@ -148,7 +148,7 @@ static int tinyusb_hw_init_dev(const dwc2_usb_otg_fshs_config_t *conf) global_regs->GCCFG |= USB_OTG_GCCFG_PHYHSEN; /* determine the PLL input clock of the USB HS PHY from HSE clock */ - switch (CLOCK_HSE) { + switch (CONFIG_CLOCK_HSE) { case 12000000: USB_HS_PHYC->USB_HS_PHYC_PLL |= USB_HS_PHYC_PLL1_PLLSEL_12MHZ; break; From 600421dc757c5879d280f42c96baa64a0786c6de Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Fri, 18 Nov 2022 07:33:28 +0100 Subject: [PATCH 3/3] tests/pkg_tflite-micro: fix the out of ROM problem for stm32fdiscovery --- tests/pkg_tflite-micro/Makefile.ci | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/pkg_tflite-micro/Makefile.ci b/tests/pkg_tflite-micro/Makefile.ci index 3651d0e58e..dbcca31b9e 100644 --- a/tests/pkg_tflite-micro/Makefile.ci +++ b/tests/pkg_tflite-micro/Makefile.ci @@ -93,6 +93,7 @@ BOARD_INSUFFICIENT_MEMORY := \ stk3600 \ stm32f030f4-demo \ stm32f0discovery \ + stm32f3discovery \ stm32f7508-dk \ stm32g0316-disco \ stm32l0538-disco \