-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP32S2: When WiFi is enabled, USB endpoints stop working (IDFGH-5683) #7404
Comments
Experiencing the same issue on a ESP32-S2-WROVER module on Windows 10 19042.870 Asus Sabertooth Z77, ESP-IDF 4.3.1 I added a 5 second delay before starting Wi-Fi on boot, this at least allows me to flash without holding the boot button, though I need to press flash 2-3 times in VSCode |
@cibomahto That included dfu.bin.zip file is odd. There is only 1 bin file inside, but should be few more files: You should have all but |
@chegewara Here's a new version. dfu.zip. Please note that this is a zip file containing dfu.bin. dfu.bin appears to be a CPIO archive that contains the files you mentioned above. Edit: The original zip file seems fine, it is also just a .zip file that contains dfu.bin. dfu.bin, again, is then a cpio archive that contains all 4 files. |
@Dazza0 Thanks, I just tried it with the release/v4.4 branch. It looks like this isn't implemented for ESP32-S2. I get a compilation error when I enable ESP_PHY_ENABLE_USB:
/home/matt/esp/esp-idf-v4.4/components/esp_phy/src/phy_init.c:649: undefined reference to `phy_bbpll_en_usb' and the phy lib for esp32s2 doesn't seem to have the referenced symbol:
|
I'm also hitting Is there a solution? I'm not sure what I enabled that is even causing this. Edit: oddly I see Edit2: fixed it by updating Espressif VSC extension from 1.3.0 to 1.4.0, full clean, set-target using VSC UI, then rebuild. |
@igrr I also get a compilation error when I enable ESP_PHY_ENABLE_USB. It seems that the S2 version of libraries don't have the right symbol, while S3 versions do. Please, can this be fixed? It is very difficult to debug on S2 boards, as it is not possible to reset them via the USB when WiFi is active. And WiFi is the core functionality for ESP32. What is even more frustrating, the reset used to work in the first pre-release of ESP IDF for S2... |
Hi @dchichkov, The issue which @Dazza0 has mentioned was specific to S3. It was related to the fact that when Wi-Fi got enabled, the Wi-Fi driver would reconfigure the PLL (which is shared between Wi-Fi part and USB) in a way which stopped USB from working. This bug has a different cause. The issue occurs when reset (signaled by the host via DTR and RTS) is detected. USB console driver calls We have a fix now, but unfortunately it's not quite straightforward, and requires several supporting changes to be merged first. I'm sorry it's taking so unacceptably long! In the meantime you can probably work around the issue by replacing this line:
with esp_usb_console_before_restart();
esp_restart_noos(); (the latter call requires an #include "esp_private/system_internal.h") |
@igrr Wow. Thank you very much. Reset over USB is now working even after WiFi is up. For some reason |
Hi! Is this issue solved? Because i am having the same, or maybe a related issue: Environment
Problem DescriptionWhen configuring the console output to USB CDC, my application crashes periodically. That is if the USB is connected to the Computer. With Power only it seems to work fine. Additionally i can not open the monitor on the USB CDC Serial Port: ('OSError: [Errno 6] Device not configured') When testing the ESP IDF Examples i can reproduce the Logging error e.g. by building and flashing the '/examples/wifi/getting_started/softAP' (with USB CDC). |
@stk84 the issue isn't solved yet, but please try the workaround explained in #7404 (comment) and see if it helps in your case? |
@igrr Thanks for the quick response. The workaround unfortunately only helps for the ESP IDF examples in my case. With my application, i still have the same issues. I would rule out the custom board, since all other examples work fine. Do you have any hints where i could check? Because i am currently stepping in the dark. |
@stk84 Unfortunately I don't have other suggestions based on the information you have provided.
I suggest opening a new issue about this, and trying to find out more information about how the application crashes. For example, you can connect JTAG debugger and try to see where exactly the application crashes. |
Thank you! |
When I enable "Enable USB when phy init" I'm getting phy_init.c:701: undefined reference to `phy_bbpll_en_usb' with IDF v5.0.1 and 4.4.4 with ESP32 S2. Tried reinstalling IDF and it still happens even with the wifi/getting_started/station example can this issue be opened? |
You should reopen a new issue :) Make sure to include your compilation logs, and do a full clean prior. |
Environment
git describe --tags
to find it): v4.3 (xtensa-esp32-elf-gcc --version
to find it): xtensa-esp32-elf-gcc (crosstool-NG esp-2020r3) 8.4.0Problem Description
Enabling WiFi on an ESP32-S2 causes the USB peripheral to stop working correctly. When a user firmware is loaded that enables WiFi, the idf.py 'dfu-flash', 'flash', and 'monitor' commands no longer function. Loading a firmware that does not enable WiFi allows all of the above commands to work correctly.
I'm able to repeat this with both ESP-IDF V4.3 and master (83956eb), on both the Saola board and a custom board I'm developing.
There is a related issue here that might be the same as this one, however the scope is larger than noted there: #6969
Expected Behavior
Running 'idf.py monitor' should show the debug console; running 'idf.py dfu-flash' should flash firmware into the device and restart it.
Actual Behavior
The device fails to program:
Dmesg reports this when the device is reset after a successful program:
When starting the unsuccessful dfu-flash, the USB device starts by disconnecting and reconnecting correctly:
But then hangs for a while (during which dfu-flash errors out). Eventually the USB operations fail:
Steps to reproduce
Using the 'wifi/getting_started/station' example, I configure it by:
// If possible, attach a picture of your setup/wiring here.
Wiring is identical to the description in: https://blog.espressif.com/dfu-using-the-native-usb-on-esp32-s2-for-flashing-the-firmware-b2c4af3335f1
Code to reproduce this issue
This example causes the usb to fail: https://github.com/espressif/esp-idf/tree/master/examples/wifi/getting_started/station
Using a different example (that doesn't initialize wifi), works correctly: https://github.com/espressif/esp-idf/tree/master/examples/get-started/hello_world
Debug Logs
(included above)
Other items if possible
dfu.bin.zip
sdkconfig.zip
The text was updated successfully, but these errors were encountered: