File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929#include "lib/utils/interrupt_char.h"
3030#include "lib/mp-readline/readline.h"
3131
32+ #include "esp-idf/components/soc/soc/esp32s2/include/soc/usb_periph.h"
33+ #include "esp-idf/components/driver/include/driver/periph_ctrl.h"
34+ #include "esp-idf/components/driver/include/driver/gpio.h"
35+ #include "esp-idf/components/esp_rom/include/esp32s2/rom/gpio.h"
36+
3237#include "freertos/FreeRTOS.h"
3338#include "freertos/task.h"
3439
@@ -64,16 +69,22 @@ void usb_device_task(void* param)
6469}
6570
6671void init_usb_hardware (void ) {
72+ periph_module_reset (PERIPH_USB_MODULE );
73+ periph_module_enable (PERIPH_USB_MODULE );
6774 usb_hal_context_t hal = {
6875 .use_external_phy = false // use built-in PHY
6976 };
7077 usb_hal_init (& hal );
7178
79+ // Initialize the pin drive strength.
80+ gpio_set_drive_capability (USBPHY_DM_NUM , GPIO_DRIVE_CAP_3 );
81+ gpio_set_drive_capability (USBPHY_DP_NUM , GPIO_DRIVE_CAP_3 );
82+
7283 (void ) xTaskCreateStatic (usb_device_task ,
7384 "usbd" ,
7485 USBD_STACK_SIZE ,
7586 NULL ,
76- configMAX_PRIORITIES - 1 ,
87+ 5 ,
7788 usb_device_stack ,
7889 & usb_device_taskdef );
7990}
You can’t perform that action at this time.
0 commit comments