@@ -99,14 +99,14 @@ void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state)
9999 {
100100#if defined(SOC_SERIES_STM32F1 )
101101 rt_pin_mode (BSP_USB_CONNECT_PIN ,PIN_MODE_OUTPUT );
102- rt_pin_write (BSP_USB_CONNECT_PIN , PIN_HIGH );
102+ rt_pin_write (BSP_USB_CONNECT_PIN , BSP_USB_PULL_UP_STATUS );
103103#endif
104104 }
105105 else
106106 {
107107#if defined(SOC_SERIES_STM32F1 )
108108 rt_pin_mode (BSP_USB_CONNECT_PIN ,PIN_MODE_OUTPUT );
109- rt_pin_write (BSP_USB_CONNECT_PIN , PIN_LOW );
109+ rt_pin_write (BSP_USB_CONNECT_PIN , ! BSP_USB_PULL_UP_STATUS );
110110#endif
111111 }
112112}
@@ -201,6 +201,9 @@ static rt_err_t _init(rt_device_t device)
201201#endif
202202 /* Initialize LL Driver */
203203 HAL_PCD_Init (pcd );
204+ /* USB interrupt Init */
205+ HAL_NVIC_SetPriority (USBD_IRQ_TYPE , 2 , 0 );
206+ HAL_NVIC_EnableIRQ (USBD_IRQ_TYPE );
204207#if !defined(SOC_SERIES_STM32F1 )
205208 HAL_PCDEx_SetRxFiFo (pcd , 0x80 );
206209 HAL_PCDEx_SetTxFiFo (pcd , 0 , 0x40 );
@@ -246,6 +249,9 @@ int stm_usbd_register(void)
246249 /* Register endpoint infomation */
247250 _stm_udc .ep_pool = _ep_pool ;
248251 _stm_udc .ep0 .id = & _ep_pool [0 ];
252+ #ifdef BSP_USBD_SPEED_HS
253+ _stm_udc .device_is_hs = RT_TRUE ;
254+ #endif
249255 rt_device_register ((rt_device_t )& _stm_udc , "usbd" , 0 );
250256 rt_usb_device_init ();
251257 return RT_EOK ;
0 commit comments