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

Monitor no access (error) over native USB after esp_wifi_init() (IDFGH-5196) #6969

Closed
3 tasks done
majodi opened this issue May 1, 2021 · 3 comments
Closed
3 tasks done
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@majodi
Copy link

majodi commented May 1, 2021

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

Environment

Custom board with ESP32-S2 WROVER module but also verified on Saola

  • Module or chip used: ESP32-S2 WROVER
  • IDF version: v4.4-dev-1183-g9d34a1cd4
  • Build System: idf.py
  • Compiler version: 8.4.0
  • Operating System: macOS
  • Using an IDE?: VSCode
  • Power Supply: USB

Problem Description

When flashing DFU over native USB, monitor gets:

read failed: [Errno 6] Device not configured
Waiting for the device to reconnect

But code is working.

Narrowed down to esp_wifi_init() call. If not calling esp_wifi_init() the monitor has normal access.

(See stripped down code)

Expected Behavior

Besides working code also access with monitor over native USB

Actual Behavior

Code works but no access over native USB (error)

Steps to reproduce

Uncomment call to esp_wifi_init(&cfg)

Code to reproduce this issue

void app_main(void)
{
    static httpd_handle_t server = NULL;

    ESP_ERROR_CHECK(nvs_flash_init());
    ESP_ERROR_CHECK(esp_netif_init());
    ESP_ERROR_CHECK(esp_event_loop_create_default());
    esp_netif_create_default_wifi_ap();
    wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
    //ESP_ERROR_CHECK(esp_wifi_init(&cfg)); // ===========> uncomment will show described behavior

    while (1) {
        ESP_LOGI(TAG, "Testing...");
        vTaskDelay(1000 / portTICK_PERIOD_MS);
    }
}

Debug Logs

No access to monitor (the problem), board does not have UART bridge

@espressif-bot espressif-bot added the Status: Opened Issue is new label May 1, 2021
@github-actions github-actions bot changed the title Monitor no access (error) over native USB after esp_wifi_init() Monitor no access (error) over native USB after esp_wifi_init() (IDFGH-5196) May 1, 2021
@majodi
Copy link
Author

majodi commented May 7, 2021

Additional info:

Again, only using the native USB post (or trying so). When flashing DFU without wifi code I get a new serial port. But if I then turn on wifi (uncomment wifi code) and do idf.py build and flash over this new port, the firmware is working but the port is now gone.

So, I can create a dfu with wifi code and flash it (dfu-flash), I get a new serial port but using monitor over this port shows [Errno 6] Device not configured. After a while, closing the monitor the new port is gone. I can reset the device to get the port back but still not working in monitor.

If I try an idf.py flash on this port I also get the same error and also the port is gone afterwards. As if wifi and native USB can not coexist.

@majodi
Copy link
Author

majodi commented Jan 8, 2022

For my sanity (maybe I just miss something here), would it be possible to let me know if this can be confirmed as a problem? I prepared an even simpler way to demonstrate the issue. Just follow these few steps:

copy the hello world: cp -r $IDF_PATH/examples/get-started/hello_world .
set-target esp32s2
menuconfig --> set console output to CDC
dfu
dfu-flash
monitor
=== output shows up in monitor ===

now add these few lines:

#include <esp_wifi.h>

===> and just at the top of main:
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&cfg));

repeat the dfu, dfu-flash and monitor

=== not possible to connect with monitor tool ===

@Dazza0
Copy link
Contributor

Dazza0 commented Mar 4, 2022

This think this is same issue as #8241, should be closed on master by f82ab4c and on release/v4.4 by bf523af. If the issue isn't resolved, please feel free to reopen this issue.

@Dazza0 Dazza0 closed this as completed Mar 4, 2022
@espressif-bot espressif-bot added Resolution: Done Issue is done internally Status: Done Issue is done internally and removed Status: Opened Issue is new labels May 18, 2022
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

3 participants