ESP32-S2-DevKit-Lipo-USB and ESP_LOG

Started by timokett81, June 16, 2021, 08:03:48 PM

Previous topic - Next topic

timokett81

I just bought few ESP32-S2-DevKit-Lipo-USB modules and I can flash OK and get console output OK (thanks to another thread telling: Component config=>ESP System Settings=>Channel for console output=>Choose "USB CDC").
So ordinary printf becomes visible with monitor command. But if I build and run any Espressif samples that use ESP_LOG-macros, nothing comes out and even the printf stops working. So it seems that setting the console output to USB CDC has no impact on ESP_LOG. Possible the log system init reverts the selection back to UART, breaking the printf output.

Q1: Is there any way to get ESP_LOG working with ESP32-S2 with native USB support?
Q2: Does the ESP_LOG work with modules having the serial-USB converter?

LubOlimex

Not sure about this specific case but a customer provided some feedback about similar problems with UART0, so it might as well work, check his post here:

https://www.olimex.com/forum/index.php?topic=8157.msg31519#msg31519
Technical support and documentation manager at Olimex

timokett81

Yes, I was referring to same post in my message, no problem with that.

Now when I study more, it is not the ESP_LOG-macros that prevent output, they work fine in most of the Espressif samples.
But this call in examples/wifi/getting_started/station/station_example_main.c:

void app_main(void)
{
    //Initialize NVS
    esp_err_t ret = nvs_flash_init();

Disables all output to USB CDC console. Commenting that out produces output with ESP_LOG and printf OK.

Q: Is there something in the default NVS partition that is related to USB CDC?

findmyname

Hi @timokett81,

I don't recall any issue with logging after I enabled USB CDC option.

Actually I have this code at the begging which initialize NVS as well and logging work without issues.

void app_main(void)
{
    ESP_LOGI(TAG, "[APP] Startup..");

    // Initialize NVS.
    esp_err_t ret = nvs_flash_init();
    if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
        ESP_ERROR_CHECK(nvs_flash_erase());
        ret = nvs_flash_init();
    }
    ESP_ERROR_CHECK( ret )

timokett81

Good to to know that it should work.
I added led blinking to the start to see if the code really runs.
When led blinking is included, code and outputs works fine.
When I change the #if 1 to #if 0, nothing is outputted and device seems to be in boot loop.
So delay before beginning has big impact.

@findmyname, what HW you have?
My HW is ESP32-S2-WROVER-DevKit-LiPo-USB. It has 2 MB PSRAM when compared to WROOM but I do not know if it makes any difference.

timokett81

Just to conclude, 500 ms delay at the start will fix the issue.
So I added this in the beginning and it works fine:
vTaskDelay(500 / portTICK_PERIOD_MS);

There was someone else in ESP32 forum that had the same issue and delay fixed it.
Discussed in: https://www.esp32.com/viewtopic.php?f=2&t=21505&p=79520#p79520

findmyname

Quote from: timokett81 on June 23, 2021, 09:02:07 PM@findmyname, what HW you have?
My HW is ESP32-S2-WROVER-DevKit-LiPo-USB. It has 2 MB PSRAM when compared to WROOM but I do not know if it makes any difference.

I have ESP32-S2-DevKit-Lipo-USB - which is per Olimex description:


board is pin-to-pin compatible with Espressif ESP32-Saola-1, but adds Lipo charger and the ability to work on LiPo power when external power supply is missing, allowing handheld applications.

findmyname

Upgrade my OS and installed esp-idf 4.5 and logging stopped to work for me :(
Does anybody experienced the same issue ?

findmyname

Debugging more. It looks like issue on my end.
False alarm sorry ...