diff --git a/drivers/usb/device/usb_dc_stm32.c b/drivers/usb/device/usb_dc_stm32.c index 4119f008b9c642..e64a81770e1356 100644 --- a/drivers/usb/device/usb_dc_stm32.c +++ b/drivers/usb/device/usb_dc_stm32.c @@ -372,6 +372,17 @@ static int usb_dc_stm32_init(void) } #endif /* USB */ +#ifdef SYSCFG_CFGR1_USB_IT_RMP + /* On STM32F302/F303 USB IRQ collides with CAN_1 IRQ */ + /* Remap IRQ by default to enable use of both IPs simultaneoulsy */ + if (LL_APB2_GRP1_IsEnabledClock(LL_APB2_GRP1_PERIPH_SYSCFG)) { + LL_SYSCFG_EnableRemapIT_USB(); + } else { + LOG_ERR("System Configuration Controller clock is " + "disabled. Unable to enable IRQ remapping."); + } +#endif + IRQ_CONNECT(DT_USB_IRQ, DT_USB_IRQ_PRI, usb_dc_stm32_isr, 0, 0); irq_enable(DT_USB_IRQ); @@ -395,7 +406,7 @@ int usb_dc_attach(void) LL_SYSCFG_EnablePinRemap(); } else { LOG_ERR("System Configuration Controller clock is " - "disable. Unable to enable pin remapping." + "disabled. Unable to enable pin remapping."); } #endif diff --git a/dts/arm/st/f3/stm32f302.dtsi b/dts/arm/st/f3/stm32f302.dtsi index 484e56fc4a647c..4a2b946e4fd9fb 100644 --- a/dts/arm/st/f3/stm32f302.dtsi +++ b/dts/arm/st/f3/stm32f302.dtsi @@ -8,6 +8,11 @@ / { soc { + usb: usb@40005c00 { + /* Remap USB_LB IRQ to enable use with CAN_1 */ + interrupts = <75 0>; + }; + i2c2: i2c@40005800 { compatible = "st,stm32-i2c-v2"; clock-frequency = ; diff --git a/dts/arm/st/f3/stm32f303.dtsi b/dts/arm/st/f3/stm32f303.dtsi index 1bf0d2b5cd3f7e..2077e66824e984 100644 --- a/dts/arm/st/f3/stm32f303.dtsi +++ b/dts/arm/st/f3/stm32f303.dtsi @@ -8,6 +8,11 @@ / { soc { + usb: usb@40005c00 { + /* Remap USB_LB IRQ to enable use with CAN_1 */ + interrupts = <75 0>; + }; + i2c2: i2c@40005800 { compatible = "st,stm32-i2c-v2"; clock-frequency = ;