mirror of
https://github.com/micropython/micropython.git
synced 2026-03-14 21:00:18 +01:00
stm32: Update STM32U5 suppport.
Add USB FS configuration to enable for STM32U5. Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
This commit is contained in:
committed by
Damien George
parent
f94980677c
commit
746e2c985a
@@ -470,7 +470,7 @@ void OTG_FS_WKUP_IRQHandler(void) {
|
||||
|
||||
#if defined(STM32L4)
|
||||
EXTI->PR1 = USB_OTG_FS_WAKEUP_EXTI_LINE;
|
||||
#elif !defined(STM32H5) && !defined(STM32H7)
|
||||
#elif !defined(STM32H5) && !defined(STM32H7) && !defined(STM32U5)
|
||||
/* Clear EXTI pending Bit*/
|
||||
__HAL_USB_FS_EXTI_CLEAR_FLAG();
|
||||
#endif
|
||||
|
||||
@@ -193,10 +193,12 @@ MP_WEAK void SystemClock_Config(void) {
|
||||
// H7 MCUs without SMPS, lock the power supply configuration update.
|
||||
MODIFY_REG(PWR->CR3, PWR_CR3_SCUEN, 0);
|
||||
#elif defined(STM32U5)
|
||||
#if defined(STM32U5A5xx)
|
||||
HAL_PWREx_DisableUCPDDeadBattery();
|
||||
if (HAL_PWREx_ConfigSupply(PWR_SMPS_SUPPLY) != HAL_OK) {
|
||||
MICROPY_BOARD_FATAL_ERROR("HAL_PWREx_ConfigSupply");
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
// other MCUs, enable power control clock.
|
||||
__PWR_CLK_ENABLE();
|
||||
@@ -565,9 +567,14 @@ MP_WEAK void SystemClock_Config(void) {
|
||||
PeriphClkInitStruct.AdcDacClockSelection = RCC_ADCDACCLKSOURCE_HSE;
|
||||
PeriphClkInitStruct.Dac1ClockSelection = RCC_DAC1CLKSOURCE_LSE;
|
||||
#endif
|
||||
#if defined(MICROPY_HW_ENABLE_USB)
|
||||
#if defined(MICROPY_HW_ENABLE_USB) && (MICROPY_HW_ENABLE_USB)
|
||||
#if defined(STM32U5A5xx)
|
||||
PeriphClkInitStruct.PeriphClockSelection |= RCC_PERIPHCLK_USBPHY;
|
||||
PeriphClkInitStruct.UsbPhyClockSelection = RCC_USBPHYCLKSOURCE_PLL1;
|
||||
#elif defined(STM32U585xx)
|
||||
PeriphClkInitStruct.PeriphClockSelection |= RCC_PERIPHCLK_CLK48;
|
||||
PeriphClkInitStruct.IclkClockSelection = RCC_CLK48CLKSOURCE_HSI48;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MICROPY_HW_RCC_RTC_CLKSOURCE)
|
||||
|
||||
@@ -98,7 +98,7 @@ static void mp_usbd_ll_init_fs(void) {
|
||||
const uint32_t otg_alt = GPIO_AF0_USB;
|
||||
#elif defined(STM32L432xx) || defined(STM32L452xx)
|
||||
const uint32_t otg_alt = GPIO_AF10_USB_FS;
|
||||
#elif defined(STM32H5) || defined(STM32WB)
|
||||
#elif defined(STM32H5) || defined(STM32U5) || defined(STM32WB)
|
||||
const uint32_t otg_alt = GPIO_AF10_USB;
|
||||
#else
|
||||
const uint32_t otg_alt = GPIO_AF10_OTG_FS;
|
||||
@@ -139,7 +139,7 @@ static void mp_usbd_ll_init_fs(void) {
|
||||
// Enable VDDUSB
|
||||
#if defined(STM32H5) || defined(STM32WB)
|
||||
HAL_PWREx_EnableVddUSB();
|
||||
#elif defined(STM32L4)
|
||||
#elif defined(STM32L4) || defined(STM32U5)
|
||||
if (__HAL_RCC_PWR_IS_CLK_DISABLED()) {
|
||||
__HAL_RCC_PWR_CLK_ENABLE();
|
||||
HAL_PWREx_EnableVddUSB();
|
||||
|
||||
Reference in New Issue
Block a user