Skip to content

Commit bc41e22

Browse files
committed
[stm32] Fix clock enable for internal PHYC
1 parent dadb298 commit bc41e22

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/modm/platform/usb/stm32/module.lb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def generate_instance(env, port, otg=False):
6767
"port": port,
6868
"peripheral": "Usbotg{}".format(port) if otg else "Usb",
6969
"is_otg": otg,
70+
"is_phyc": port == "hs" and not is_ulpi,
7071
"is_remap": irq_data["is_remap"],
7172
"irqs": irq_data["port_irqs"][port],
7273
"target": env[":target"].identifier,

src/modm/platform/usb/stm32/usb.hpp.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ public:
4343
#endif
4444
%% endif
4545
Rcc::enable<Peripheral::{{ peripheral }}>();
46+
%% if is_phyc
47+
Rcc::enable<Peripheral::Usbotghsulpi>();
48+
#ifdef RCC_APB2ENR_OTGPHYCEN
49+
RCC->APB2ENR |= RCC_APB2ENR_OTGPHYCEN; __DSB();
50+
#elif defined RCC_AHB2ENR1_USBPHYCEN
51+
RCC->AHB2ENR1 |= RCC_AHB2ENR1_USBPHYCEN; __DSB();
52+
#endif
53+
%% endif
4654
%% if is_remap
4755
SYSCFG->CFGR1 |= SYSCFG_CFGR1_USB_IT_RMP;
4856
%% endif

0 commit comments

Comments
 (0)