From aa6e8cafcf1932891dfa98768098541a5e58757d Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Tue, 15 Mar 2022 23:21:19 +0100 Subject: [PATCH 1/2] cpu/stm32: enable usbdev_fs for STM32F1 --- cpu/stm32/Makefile.dep | 3 ++- cpu/stm32/include/periph/cpu_gpio.h | 2 +- cpu/stm32/periph/Makefile | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cpu/stm32/Makefile.dep b/cpu/stm32/Makefile.dep index 23493f47ab..816392c439 100644 --- a/cpu/stm32/Makefile.dep +++ b/cpu/stm32/Makefile.dep @@ -4,7 +4,8 @@ USEMODULE += periph stm32_clk stm32_vectors ifneq (,$(filter periph_usbdev,$(FEATURES_USED))) - ifeq (,$(filter f3 wb,$(CPU_FAM))) + # TODO: STM32F105xx and STM32F107xx also use synopsys_dwc2 + ifeq (,$(filter f1 f3 wb,$(CPU_FAM))) USEMODULE += usbdev_synopsys_dwc2 endif USEMODULE += ztimer diff --git a/cpu/stm32/include/periph/cpu_gpio.h b/cpu/stm32/include/periph/cpu_gpio.h index 8a2ddd6782..fb0f3e730c 100644 --- a/cpu/stm32/include/periph/cpu_gpio.h +++ b/cpu/stm32/include/periph/cpu_gpio.h @@ -116,10 +116,10 @@ typedef enum { GPIO_AF13, /**< use alternate function 13 */ GPIO_AF14, /**< use alternate function 14 */ GPIO_AF15, /**< use alternate function 15 */ +#endif #endif GPIO_AF_UNDEF /** an UNDEF value definition, e.g. for register based spi */ -#endif } gpio_af_t; #ifdef CPU_FAM_STM32F1 diff --git a/cpu/stm32/periph/Makefile b/cpu/stm32/periph/Makefile index 23fa83b26d..91be0f8c93 100644 --- a/cpu/stm32/periph/Makefile +++ b/cpu/stm32/periph/Makefile @@ -51,7 +51,7 @@ endif # Select the correct implementation for `periph_usbdev` ifneq (,$(filter periph_usbdev,$(USEMODULE))) - ifneq (,$(filter f3 wb,$(CPU_FAM))) + ifneq (,$(filter f1 f3 wb,$(CPU_FAM))) SRC += usbdev_fs.c endif endif From d3d89aaec817fd2bddb7d7f248e603e0158d7b0b Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Tue, 15 Mar 2022 23:22:08 +0100 Subject: [PATCH 2/2] boards/blxxxpill: configure usbdev_fs --- boards/common/blxxxpill/Kconfig | 1 + boards/common/blxxxpill/Makefile.features | 1 + boards/common/blxxxpill/include/periph_conf.h | 26 +++++++++++++++++++ tests/sys_fido2_ctap/Makefile.ci | 6 +++++ 4 files changed, 34 insertions(+) create mode 100644 tests/sys_fido2_ctap/Makefile.ci diff --git a/boards/common/blxxxpill/Kconfig b/boards/common/blxxxpill/Kconfig index db171ba280..a588083f8b 100644 --- a/boards/common/blxxxpill/Kconfig +++ b/boards/common/blxxxpill/Kconfig @@ -17,6 +17,7 @@ config BOARD_COMMON_BLXXXPILL select HAS_PERIPH_TIMER select HAS_PERIPH_UART select HAS_PERIPH_QDEC + select HAS_PERIPH_USBDEV # Clock configuration select BOARD_HAS_HSE diff --git a/boards/common/blxxxpill/Makefile.features b/boards/common/blxxxpill/Makefile.features index cc6ef98e5b..556c3e7128 100644 --- a/boards/common/blxxxpill/Makefile.features +++ b/boards/common/blxxxpill/Makefile.features @@ -11,3 +11,4 @@ FEATURES_PROVIDED += periph_spi FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_uart FEATURES_PROVIDED += periph_qdec +FEATURES_PROVIDED += periph_usbdev diff --git a/boards/common/blxxxpill/include/periph_conf.h b/boards/common/blxxxpill/include/periph_conf.h index 73069ec308..4a7054d824 100644 --- a/boards/common/blxxxpill/include/periph_conf.h +++ b/boards/common/blxxxpill/include/periph_conf.h @@ -310,6 +310,32 @@ static const spi_conf_t spi_config[] = { #define SPI_NUMOF ARRAY_SIZE(spi_config) /** @} */ +/** + * @brief USB device FS configuration + */ +static const stm32_usbdev_fs_config_t stm32_usbdev_fs_config[] = { + { + .base_addr = (uintptr_t)USB, + .rcc_mask = RCC_APB1ENR_USBEN, + .irqn = USB_LP_CAN1_RX0_IRQn, + .apb = APB1, + .dm = GPIO_PIN(PORT_A, 11), + .dp = GPIO_PIN(PORT_A, 12), + .af = GPIO_AF_UNDEF, + .disconn = GPIO_UNDEF, + }, +}; + +/** + * @brief Interrupt function name mapping + */ +#define USBDEV_ISR isr_usb_lp_can1_rx0 + +/** + * @brief Number of available USB device FS peripherals + */ +#define USBDEV_NUMOF ARRAY_SIZE(stm32_usbdev_fs_config) + #ifdef __cplusplus } #endif diff --git a/tests/sys_fido2_ctap/Makefile.ci b/tests/sys_fido2_ctap/Makefile.ci new file mode 100644 index 0000000000..b52ef8eb94 --- /dev/null +++ b/tests/sys_fido2_ctap/Makefile.ci @@ -0,0 +1,6 @@ +BOARD_INSUFFICIENT_MEMORY := \ + blackpill \ + blackpill-128kib \ + bluepill \ + bluepill-128kib \ + #