-
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
ESP32-S2 CDC does not boot after OS updates anymore (IDFGH-14450) #15226
Comments
I think this looks like problem on our side. I suspect the log where it crashes happens when cache is disabled, but If in |
If I changed from "inline" to "attribute((always_inline))" the device is not starting anymore on the Win11 host system and therefore I do not get any output. It seems the functions "write_lock_acquire" and "write_lock_release" are releated to "CONFIG_ESP_CONSOLE_USB_CDC_SUPPORT_ETS_PRINTF" only. Please notice, that I enable the option "CONFIG_ESP_CONSOLE_USB_CDC_SUPPORT_ETS_PRINTF" only to get the error messages. Usually, I do not enable this option, so I do not think the inline declarations can solve this issue. I just see, that the bootloader was not on verbose level. The following is the boot process which crash in verbose mode:
This was working for weeks, it have to be related to the updates of the operating systems. But, I do not why. I will try to setup a ESP32-C2 and check if the inbuilt CDC is still working for this device class. |
I was able to solve this issue. My sdkconfig configuration had CDC enabled, but the option "CONFIG_ESP32S2_KEEP_USB_ALIVE" was disabled. This option needs to be active and should be setup automatically - accordingly to the docs. I have no clue, how I was able to bring the sdkconfig in this inconsistent state. Maybe my sdkconfig was from v5.1 branch and not up-to-date. I have rebuild thre sdkconfig completely new with set-target and all is working fine again. I think that the USB interface power was not keep alive and then the access to the flash memory failed during boot process. However, this is just a guess. |
Additionally information: It seems the real problem was the option "CONFIG_SPIRAM_USE_MALLOC=y". With this option enabled, my apps are crashing (=CDC not booting). I am running arduino as component and mixing C++ with C/ESP-IDF - maybe this could be the problem with malloc. I switched to "SPIRAM_USE_CAPS_ALLOC" which is enough for me and all is working again! Unfortunately, I had setup "SPIRAM_USE_CAPS_ALLOC" within my sdkconfig.defaults and this gets me into trouble while creating the new sdkconfig. Well, this was a tricky one - costs me a couple of days! Maybe this information helps! |
And finally: You need to have a responsive bootloader, that cdc is recognized on Win11 (and properly other operating systems as well). If you use "BOOTLOADER_LOG_LEVEL_NONE" or "BOOTLOADER_LOG_LEVEL_ERROR" or "BOOTLOADER_LOG_LEVEL_WARN" your device might not be recognized. Just use "BOOTLOADER_LOG_LEVEL_INFO" to ensure you have output on the cdc interface. Summarize:
Well, all this steps are important and now this issue is really solved! Hopefully this information is useful for someone! |
Answers checklist.
IDF version.
v5.3.2
Espressif SoC revision.
ESp32-S2
Operating System used.
Linux
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
None
Development Kit.
ESP32-S2
Power Supply used.
USB
What is the expected behavior?
After booting the device CDC connects and the device is running as expected. This all works before the updates of the operating systems fine for several weeks.
What is the actual behavior?
The last days I have worked successfully with the ESP32-S2 on my virtual machine with "Ubuntu24" (Linux 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec 5 13:09:44 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux) running on a proxmox "Debian12" (Linux 6.8.12-5-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-5 (2024-12-03T10:26Z) x86_64 GNU/Linux) while the host system is Windows 11. Everything works perfectly fine for several weeks.
Then I updated Windows 11, Proxmox/Debian and Ubuntu24 to the latest versions. Afterwards, the ESP32-S2 CDC is not booting properly anymore. I have enabled verbose messages for bootloader and the app. Also, the errors can only be cached with "ESP_CONSOLE_UART" setup to "USB CDC", and more important to activate "ESP_CONSOLE_USB_CDC_SUPPORT_ETS_PRINTF". Esp-idf was not updated, just the release "v5.3.2".
The error is so early within the boot process that I assume this has something to do with the CDC interface. If the option "ESP_CONSOLE_USB_CDC_SUPPORT_ETS_PRINTF" is not enabled, then the device will just not initialized properly by Windows11 and cannot be redirected through the virtual machines.
Important notices:
Steps to reproduce.
...
Debug Logs.
More Information.
I am fully aware, that this problem cannot be solved/reproduced by the developer team easily. There are three operating systems, virtual machines and more difficulties involved here. However, I do think it is a good idea to report this issue - maybe other people running into similar issues and we collect the experiences here. Maybe, I also have a wrong setup as well and some one have suggestions to solve this issue. Thank you.
The text was updated successfully, but these errors were encountered: