vTaskStartScheduler() error

hello I’m getting started with freeRTOS
I’ve been trying to blink an led with a delay of 1sec but whenever I include vTaskStartScheduler() function the led blinks faster than the delay period what might be the problem ,here is my code

#include <stdio.h>

#include "freertos/FreeRTOS.h"

#include "freertos/task.h"

#include"freertos/FreeRTOSConfig.h"

#include "driver/gpio.h"

#include "sdkconfig.h"

/* Can use project configuration menu (idf.py menuconfig) to choose the GPIO to blink,

   or you can edit the following line and set a number here.

*/

#define BLINK_GPIO 1

void blink_1(void *parameters){

while(1) {

        /* Blink off (output low) */

        printf("Turning off the LED\n");

        gpio_set_level(BLINK_GPIO, 0);

        vTaskDelay(1000 / portTICK_PERIOD_MS);

        /* Blink on (output high) */

        printf("Turning on the LED\n");

        gpio_set_level(BLINK_GPIO, 1);

        vTaskDelay(1000 / portTICK_PERIOD_MS);

    }

}

void app_main()

{

    /* Configure the IOMUX register for pad BLINK_GPIO (some pads are

       muxed to GPIO on reset already, but some default to other

       functions and need to be switched to GPIO. Consult the

       Technical Reference for a list of pads and their default

       functions.)

    */

    gpio_pad_select_gpio(BLINK_GPIO);

    /* Set the GPIO as a push/pull output */

    gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);

      xTaskCreatePinnedToCore(blink_1,"blink_1",1024,NULL,configMAX_PRIORITIES-1,NULL,0);

     // xTaskCreate(blink_2,"blink_2",1024,NULL,0,NULL);

      vTaskStartScheduler();

}

thanks

Hi Joseph,

The issue is that the scheduler has already started before app_main is called. The solution is to comment out the call to vTaskStartScheduler();

See [TW#17310] xTaskCreate -> Guru Meditation Error of type InstrFetchProhibited occurred on core 0. (IDFGH-1540) · Issue #1457 · espressif/esp-idf · GitHub.

Thanks ,commenting out the call worked