I create task but Esp32 serial monitor outputs nothing useful

hello guys, i neep help from you please.
I compiled and run blink program and hello world and everything was ok but i tried with a new program creating 2 tasks and the serial monitor outputs nothing useful. I was searching for a reason in the community and one of them says

  • Remove: #define CONFIG_ESP32_XTAL_FREQ_40 1
  • Remove: #define CONFIG_ESP32_XTAL_FREQ 40
  • Add: #define CONFIG_ESP32_XTAL_FREQ_AUTO 1
  • Add #define CONFIG_ESP32_XTAL_FREQ 0
    I did it but nothing works.
    my code is:
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_spi_flash.h"
#include "nvs_flash.h"


void vTask1(void *pvParameters){
    while (1)
    {
       // vprintf(pcTaskName);
        printf("Task1 running \n");
        vTaskDelay(1000 / portTICK_PERIOD_MS);
    }
    vTaskDelete(NULL);
}

void vTask2(void *pvParameters){
    while (1)
    {
        //vprintf(pcTaskName);
        printf("Task2 running \n");
        vTaskDelay(1000 / portTICK_PERIOD_MS);
    }
    vTaskDelete(NULL);
}

void app_main(){

    nvs_flash_init();
    xTaskCreate(
        vTask1,
        "Task 1",
        1000,
        NULL,
        1,
        NULL
    );

    xTaskCreate(vTask2, "Task 2", 1000, NULL, 1, NULL);

    vTaskStartScheduler();

    for (int i = 10; i >= 0; i--) {
        printf("Restarting in %d seconds...\n", i);
        vTaskDelay(1000 / portTICK_PERIOD_MS);
    }
    printf("Restarting now.\n");
    fflush(stdout);
    esp_restart();
}

I’ve never seen the app_main() function start the scheduler itself. Looking at https://github.com/platformio/platform-espressif32/blob/master/examples/espidf-blink/src/main.c, you just create tasks and they run themselves / task scheduler has already been started.

Also you run your serial monitor on 9600 baud but the ESP32 outputs at 115200 by default? You need

monitor_speed = 115200

in your platformio.ini (docs)

maxgerhardt Thank you man, I did what you recommended but now I have this error

What’s the full platformio.ini now? What exact board do you have?

looks like


i was checking this Ld emits ignoring invalid character `#’ in expression

In the behind part its said “node mcu esp-32S” and the front “esp-wroom-32” dont let me upload a picture of this board

Seems like you need this board then, i.e. board = node32s.But it doesn’t change the problem you’re having.

Could you follow this advice and comment out that statement in your esp32_out.ld file?

Also it seems to me that this board does have a normal 40MHz crystal (according to this and this p. 30, which means that your initial modification should be removed. You can remove the whole sdkconfig.h file, it will get re-generated.

Thank you so much maxgerhardt i did it all what you recommended and nothing seems better, I will comment on that other publication