summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-05-29 13:06:33 +0700
committerhathach <[email protected]>2020-05-29 13:06:33 +0700
commite0490ae7866e8553b261e298719f7805fcac6875 (patch)
treef598f1f64960aa60b32c1dd9fe1fb0fbe360d0d1
parente9b41cb97d17e82287a146aba1159897a3bcfed2 (diff)
fix idf usb pin init changes
-rw-r--r--examples/device/cdc_msc_freertos/src/tusb_config.h6
-rw-r--r--hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c9
2 files changed, 13 insertions, 2 deletions
diff --git a/examples/device/cdc_msc_freertos/src/tusb_config.h b/examples/device/cdc_msc_freertos/src/tusb_config.h
index 794e996b6..40b7bced0 100644
--- a/examples/device/cdc_msc_freertos/src/tusb_config.h
+++ b/examples/device/cdc_msc_freertos/src/tusb_config.h
@@ -48,8 +48,10 @@
#define CFG_TUSB_OS OPT_OS_FREERTOS
-// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
-// #define CFG_TUSB_DEBUG 0
+// can be defined by compiler in DEBUG build
+#ifndef CFG_TUSB_DEBUG
+ #define CFG_TUSB_DEBUG 0
+#endif
/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
* Tinyusb use follows macros to declare transferring memory so that they can be put
diff --git a/hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c b/hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c
index ef70f1ee2..bbcdab6d2 100644
--- a/hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c
+++ b/hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c
@@ -26,7 +26,9 @@
#include "../board.h"
#include "driver/gpio.h"
+#include "driver/periph_ctrl.h"
#include "hal/usb_hal.h"
+#include "soc/usb_periph.h"
#include "driver/rmt.h"
#include "led_strip/include/led_strip.h"
@@ -66,10 +68,17 @@ void board_init(void)
gpio_set_pull_mode(BUTTON_PIN, BUTTON_STATE_ACTIVE ? GPIO_PULLDOWN_ONLY : GPIO_PULLUP_ONLY);
// USB Controller Hal init
+ periph_module_reset(PERIPH_USB_MODULE);
+ periph_module_enable(PERIPH_USB_MODULE);
+
usb_hal_context_t hal = {
.use_external_phy = false // use built-in PHY
};
usb_hal_init(&hal);
+
+ // Pin drive strength
+ gpio_set_drive_capability(USBPHY_DM_NUM, GPIO_DRIVE_CAP_3);
+ gpio_set_drive_capability(USBPHY_DP_NUM, GPIO_DRIVE_CAP_3);
}
// Turn LED on or off