无法使用FreeRTOS在esp32-wrover上打印日志。

huangapple go评论58阅读模式
英文:

Cannot print the logs using FreeRtos in esp32-wrover

问题

I recently started learning FreeRTOS on ESP32-WROVER and encountered an issue with printing logs. Despite my attempts, I am unable to see any log output. I am using Visual Studio Code (VSCode) as my development environment, and I have checked the Terminal tab, Output tab, and Debug Console, but no logs are displayed.

Following is the code that I am trying to run.

static const char* TAG = "MyModule";

void app_main(void)
{
    // Set the log level (optional)
    esp_log_level_set(TAG, ESP_LOG_VERBOSE);

    // Enable logging
    esp_log_level_set(TAG, ESP_LOG_VERBOSE);

    ESP_LOGV(TAG, "Starting the Log Test Program...");

    int counter = 0;

    while(1)
    {
        ESP_LOGI(TAG, "Iteration: %d", ++counter);
    }
}

I've also tried to explicitly set the baudrate to 115200 in the code (which I've checked is the default baudrate for the ESP32 UART), but I still didn't see the logs.

I would greatly appreciate any assistance in resolving this issue.

英文:

I recently started learning FreeRTOS on ESP32-WROVER and encountered an issue with printing logs. Despite my attempts, I am unable to see any log output. I am using Visual Studio Code (VSCode) as my development environment, and I have checked the Terminal tab, Output tab, and Debug Console, but no logs are displayed.

Following is the code that I am trying to run.

static const char* TAG = "MyModule";

void app_main(void)
{
    // Set the log level (optional)
    esp_log_level_set(TAG, ESP_LOG_VERBOSE);

    // Enable logging
    esp_log_level_set(TAG, ESP_LOG_VERBOSE);

    ESP_LOGV(TAG, "Starting the Log Test Program...");

    int counter = 0;

    while(1) 
    {
        ESP_LOGI(TAG, "Iteration: %d", ++counter);
    }
}

I've also tried to explicitly set the baudrate to 115200 in the code (which I've checked is the default baudrate for the ESP32 UART), but I still didn't see the logs.

I would greatly appreciate any assistance in resolving this issue.

答案1

得分: 3

这让我感到困惑:

> 我已经检查了终端选项卡、输出选项卡和调试控制台,但没有显示任何日志。

您正在设备上运行此代码,但期望在另一台机器上的集成开发环境(IDE)中看到日志吗?

ESP32-WROWER 有一个专用的串口,如果正确配置的话将输出日志。为此,根据您的设备,通常使用板上可通过 USB 访问的串口(例如 ESP32-WROWER-KIT)或 TTL-USB 适配器。

然后,根据您用于开发的操作系统,您可以使用任何您喜欢的工具来转储特定串口的输出。我个人在 Windows 上使用 Putty,在 Linux 上使用 screen (screen /dev/ttyUSB0 115200)。

官方文档的这部分内容应该对您有所帮助:与 ESP32 建立串行连接

英文:

This got me puzzled:

> I have checked the Terminal tab, Output tab, and Debug Console, but no logs are displayed.

You are running this code on a device, but are expecting the logs in your IDE on another machine?

ESP32-WROWER has a dedicated serial port, which if configured properly will output the logs. For this, depending on your device, you usually use either a serial port available via USB on your board (like in ESP32-WROWER-KIT), or TTL-USB adapter.

Then, depending of the OS you are using for development, you use whatever tool you like to dump the output of a particular serial port. I personally use Putty on Windows and screen (screen /dev/ttyUSB0 115200) on Linux.

This part of official documentation should help you: Establish Serial Connection with ESP32.

huangapple
  • 本文由 发表于 2023年5月20日 23:30:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/76295985.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定