Skip to content

Commit

Permalink
usb_serial_jtag: can print when wifi enabled by default
Browse files Browse the repository at this point in the history
 Closes #8131
  • Loading branch information
mythbuster5 committed Dec 27, 2021
1 parent d9b71e7 commit f82ab4c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions components/esp_phy/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ menu "PHY"

config ESP_PHY_ENABLE_USB
bool "Enable USB when phy init"
depends on USB_OTG_SUPPORTED || ESP_CONSOLE_USB_SERIAL_JTAG
depends on USB_OTG_SUPPORTED || ESP_CONSOLE_USB_SERIAL_JTAG || ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG
default y if IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3
default n
help
When using USB Serial/JTAG/OTG/CDC, PHY should enable USB, otherwise USB module
can not work properly.
can not work properly. Notice: Enabling this configuration option will slightly impact wifi performance.

endmenu # PHY
12 changes: 11 additions & 1 deletion components/esp_phy/src/phy_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#include "esp_rom_crc.h"
#include "esp_rom_sys.h"

#if CONFIG_ESP_PHY_ENABLE_USB
#include "hal/usb_serial_jtag_ll.h"
#endif

#include "soc/rtc_cntl_reg.h"
#if CONFIG_IDF_TARGET_ESP32C3
#include "soc/syscon_reg.h"
Expand Down Expand Up @@ -652,7 +656,13 @@ void esp_phy_load_cal_and_init(void)
#endif

#if CONFIG_ESP_PHY_ENABLE_USB
phy_bbpll_en_usb(true);
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG || CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG
if (usb_serial_jtag_ll_txfifo_writable() == 1)
#endif // Only check usb_jtag status with usb_jtag related config options enabled.
{
// If the USB_SEIRAL_JTAG is really in use.
phy_bbpll_en_usb(true);
}
#endif

#ifdef CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE
Expand Down

0 comments on commit f82ab4c

Please sign in to comment.