You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@mynewt.apache.org by "kasjer (via GitHub)" <gi...@apache.org> on 2026/03/13 19:35:10 UTC

[PR] tinyusb/synopsys: Add support for ULPI interface [mynewt-core]

kasjer opened a new pull request, #3591:
URL: https://github.com/apache/mynewt-core/pull/3591

   TinyUSB supports High Speed for STM32H7 with
   external ULPI interface.
   
   This adds support for this functionality.
   
   When USB_USE_OTG_HS_ULPI syscfg value is 1
   external PHY will be used instead of embedded FS PHY.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] tinyusb/synopsys: Add support for ULPI interface [mynewt-core]

Posted by "sjanc (via GitHub)" <gi...@apache.org>.
sjanc commented on code in PR #3591:
URL: https://github.com/apache/mynewt-core/pull/3591#discussion_r2945080228


##########
hw/usb/tinyusb/synopsys/src/synopsys.c:
##########
@@ -47,8 +54,47 @@ OTG_IRQHandler(void)
 void
 tinyusb_hardware_init(void)
 {
-    NVIC_SetVector(USB_OTG_IRQn, (uint32_t)OTG_IRQHandler);
+    NVIC_SetVector(USB_OTG_IRQn, (uint32_t)USB_OTG_IRQHandler);
     NVIC_SetPriority(USB_OTG_IRQn, 2);
+#if MYNEWT_VAL(USB_USE_OTG_HS)
+#ifdef __HAL_RCC_PWR_CLK_ENABLE
+    __HAL_RCC_PWR_CLK_ENABLE();
+#endif
+    USB_OTG_CLK_ENABLE();
+#if MYNEWT_VAL_USB_USE_OTG_HS_ULPI
+    hal_gpio_init_af(MCU_GPIO_PORTA(3), 10, GPIO_NOPULL, GPIO_MODE_AF_PP);
+    hal_gpio_init_af(MCU_GPIO_PORTA(5), 10, GPIO_NOPULL, GPIO_MODE_AF_PP);
+    hal_gpio_init_af(MCU_GPIO_PORTB(0), 10, GPIO_NOPULL, GPIO_MODE_AF_PP);
+    hal_gpio_init_af(MCU_GPIO_PORTB(1), 10, GPIO_NOPULL, GPIO_MODE_AF_PP);
+    hal_gpio_init_af(MCU_GPIO_PORTB(5), 10, GPIO_NOPULL, GPIO_MODE_AF_PP);
+    hal_gpio_init_af(MCU_GPIO_PORTB(10), 10, GPIO_NOPULL, GPIO_MODE_AF_PP);
+    hal_gpio_init_af(MCU_GPIO_PORTB(11), 10, GPIO_NOPULL, GPIO_MODE_AF_PP);
+    hal_gpio_init_af(MCU_GPIO_PORTB(12), 10, GPIO_NOPULL, GPIO_MODE_AF_PP);
+    hal_gpio_init_af(MCU_GPIO_PORTB(13), 10, GPIO_NOPULL, GPIO_MODE_AF_PP);
+    hal_gpio_init_af(MCU_GPIO_PORTC(0), 10, GPIO_NOPULL, GPIO_MODE_AF_PP);
+    hal_gpio_init_af(MCU_GPIO_PORTC(2), 10, GPIO_NOPULL, GPIO_MODE_AF_PP);
+    hal_gpio_init_af(MCU_GPIO_PORTC(3), 10, GPIO_NOPULL, GPIO_MODE_AF_PP);
+
+    __HAL_RCC_USB1_OTG_HS_ULPI_CLK_ENABLE();
+#else
+    /*
+     * USB Pin Init
+     * PB14- DM, PB15- DP
+     */
+    hal_gpio_init_af(MCU_GPIO_PORTB(14), 12, GPIO_NOPULL, GPIO_MODE_AF_PP);
+    hal_gpio_init_af(MCU_GPIO_PORTB(15), 12, GPIO_NOPULL, GPIO_MODE_AF_PP);
+#endif
+    // No VBUS sense

Review Comment:
   we should use C style comments
   
   @szymon-czapracki   FYI   this should be catch by clang-format



##########
hw/usb/tinyusb/synopsys/src/synopsys.c:
##########
@@ -47,8 +54,47 @@ OTG_IRQHandler(void)
 void
 tinyusb_hardware_init(void)
 {
-    NVIC_SetVector(USB_OTG_IRQn, (uint32_t)OTG_IRQHandler);
+    NVIC_SetVector(USB_OTG_IRQn, (uint32_t)USB_OTG_IRQHandler);
     NVIC_SetPriority(USB_OTG_IRQn, 2);
+#if MYNEWT_VAL(USB_USE_OTG_HS)
+#ifdef __HAL_RCC_PWR_CLK_ENABLE
+    __HAL_RCC_PWR_CLK_ENABLE();
+#endif
+    USB_OTG_CLK_ENABLE();
+#if MYNEWT_VAL_USB_USE_OTG_HS_ULPI

Review Comment:
   MYNEWT_VAL(USB_USE_OTG_HS_ULPI)     to be consistent with rest of file



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org