stm32h7: Enable USB peripheral (device does not enumerate yet).

This commit is contained in:
William D. Jones
2019-08-30 21:57:06 -04:00
parent 0afbf1a9bb
commit 7153561984
3 changed files with 45 additions and 1 deletions
+2 -1
View File
@@ -21,7 +21,8 @@ SRC_C += \
hw/mcu/st/stm32lib/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cortex.c \
hw/mcu/st/stm32lib/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc.c \
hw/mcu/st/stm32lib/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc_ex.c \
hw/mcu/st/stm32lib/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_gpio.c
hw/mcu/st/stm32lib/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_gpio.c \
hw/mcu/st/stm32lib/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr_ex.c
SRC_S += \
hw/mcu/st/startup/stm32h7/startup_stm32h743xx.s
@@ -163,6 +163,11 @@ void board_init(void)
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(LED_PORT, &GPIO_InitStruct);
// https://community.st.com/s/question/0D50X00009XkYZLSA3/stm32h7-nucleo-usb-fs-cdc
// TODO: Board init actually works fine without this line.
HAL_PWREx_EnableUSBVoltageDetector();
__HAL_RCC_USB2_OTG_FS_CLK_ENABLE();
}
//--------------------------------------------------------------------+