Skip to content
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

esp_wifi_start stops USB on ESP32-S3 (IDFGH-6599) #8241

Closed
tannewt opened this issue Jan 14, 2022 · 5 comments
Closed

esp_wifi_start stops USB on ESP32-S3 (IDFGH-6599) #8241

tannewt opened this issue Jan 14, 2022 · 5 comments
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@tannewt
Copy link
Contributor

tannewt commented Jan 14, 2022

Environment

  • Development Kit: ESP32-DevKitC
  • Kit version DevKitC: v1
  • Module or chip used: ESP32-S3-WROOM-1 D2N8R2
  • IDF version (run git describe --tags to find it):
    release v4.4 commit 214d62b
  • Build System: CMake-ish
  • Compiler version (run xtensa-esp32-elf-gcc --version to find it):
    xtensa-esp32s3-elf-gcc (crosstool-NG esp-2021r2) 8.4.0
  • Operating System: Linux
  • Using an IDE?: No
  • Power Supply: USB

Problem Description

In CircuitPython we initialize wifi dynamically when the user does import wifi. We initialize the USB before this happens. Now, running esp_wifi_start stops the USB. tio shows the serial connection as disconnected.

Expected Behavior

Wifi should start and USB should stay connected.

Actual Behavior

USB disconnects but code seems to continue to run.

Steps to reproduce

  1. https://learn.adafruit.com/building-circuitpython
  2. Connect to the REPL over USB serial. Run import wifi.

Code to reproduce this issue

import wifi in CircuitPython.

Debug Logs

No crash.

I (7964) pp: pp rom version: e7ae62f
I (7964) net80211: net80211 rom version: e7ae62f
I (7974) wifi:wifi driver task: 3fce4ee8, prio:23, stack:3584, core=0
I (7974) system_api: Base MAC address is not set
I (7974) system_api: read default base MAC address from EFUSE
I (7984) wifi:wifi firmware version: 5c3d3bf
I (7984) wifi:wifi certification version: v7.0
I (7994) wifi:config NVS flash: disabled
I (7994) wifi:config nano formating: disabled
I (7994) wifi:Init data frame dynamic rx buffer num: 8
I (8004) wifi:Init management frame dynamic rx buffer num: 8
I (8004) wifi:Init management short buffer num: 32
I (8014) wifi:Init dynamic tx buffer num: 16
I (8014) wifi:Init tx cache buffer num: 16
I (8024) wifi:Init static tx FG buffer num: 2
I (8024) wifi:Init static rx buffer size: 1600
I (8024) wifi:Init static rx buffer num: 4
I (8034) wifi:Init dynamic rx buffer num: 8
I (8034) wifi_init: rx ba win: 6
I (8044) wifi_init: tcpip mbox: 32
I (8044) wifi_init: udp mbox: 6
I (8044) wifi_init: tcp mbox: 6
I (8054) wifi_init: tcp tx win: 2880
I (8054) wifi_init: tcp rx win: 2880
I (8064) wifi_init: tcp mss: 1440
I (8064) wifi_init: WiFi IRAM OP enabled
I (8064) wifi_init: WiFi RX IRAM OP enabled
I (8074) phy_init: phy_version 302,3ddfab3,Dec  3 2021,14:39:12
E (8084) phy_init: esp_phy_load_cal_data_from_nvs: NVS has not been initialized. Call nvs_flash_init before starting WiFi/BT.
W (8094) phy_init: failed to load RF calibration data (0x1101), falling back to full calibration
I (8144) wifi:mode : sta (7c:df:a1:e0:76:e0)
I (8144) wifi:enable tsf
W (8144) wifi: sta start

Other items if possible

firmware.elf.zip
sdkconfig.zip

@tannewt
Copy link
Contributor Author

tannewt commented Jan 14, 2022

CircuitPython issue is here: adafruit/circuitpython#5662

@espressif-bot espressif-bot added the Status: Opened Issue is new label Jan 14, 2022
@github-actions github-actions bot changed the title esp_wifi_start stops USB on ESP32-S3 esp_wifi_start stops USB on ESP32-S3 (IDFGH-6599) Jan 14, 2022
@igrr
Copy link
Member

igrr commented Jan 14, 2022

I think this was fixed on master by 582da32 and we backported the commit to release/v4.4 in 81ce15f. However we have made a mistake while backporting. We have overlooked the fact that the dependency on a soc_caps macro depends on USB_OTG_SUPPORTED has just been implemented in v5.0-dev and doesn't work in release/v4.4 branch. Unfortunately, kconfiglib didn't warn about non-existent symbol in the dependency.

Could you please try replacing

depends on USB_OTG_SUPPORTED || ESP_CONSOLE_USB_SERIAL_JTAG
with

depends on IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || ESP_CONSOLE_USB_SERIAL_JTAG 

and give it a try?

@tannewt
Copy link
Contributor Author

tannewt commented Jan 14, 2022

Thanks! That does get it past the import statement. I haven't actually tested the WiFi yet but USB continues to work.

@tannewt
Copy link
Contributor Author

tannewt commented Jan 14, 2022

WiFi works too. 👍 We have a branch under adafruit/esp-idf that we'll patch until we get it on the 4.4 branch.

@Dazza0
Copy link
Collaborator

Dazza0 commented Mar 4, 2022

Backported to v4.4 in commit bf523af.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

4 participants