Regarding Freertos

Hello, I have an ch32v303 board.
This is my code:-

/* Global define */
#define TASK1_TASK_PRIO     1
#define TASK1_STK_SIZE      1500

/* Global Variable */
TaskHandle_t Task1Task_Handler;

void GPIO_VOL_REGULATOR_INIT(void) {
    GPIO_InitTypeDef  GPIO_InitStructure={0};

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
    GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
    GPIO_Init(GPIOA, &GPIO_InitStructure);

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
    GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
    GPIO_Init(GPIOC, &GPIO_InitStructure);

}



void task1_task(void *pvParameters)
{
    static int cnt = 0;
    while(1)
    {

        printf("cnt: %d\r\n", cnt);
        wm_lcd_write_num(5, cnt);
        printf("Updated\r\n");
        vTaskDelay(pdMS_TO_TICKS(5000));
        cnt++;
        if(cnt >=9){
            cnt = 0;
        }

    }
}

int main(void)
{

    NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
    SystemCoreClockUpdate();
    Delay_Init();
    USART_Printf_Init(115200);

    printf("SystemClk:%d\r\n",SystemCoreClock);
    printf( "ChipID:%08x\r\n", DBGMCU_GetCHIPID() );
    printf("FreeRTOS Kernel Version:%s\r\n",tskKERNEL_VERSION_NUMBER);


    GPIO_VOL_REGULATOR_INIT();       //Mandatory


    GPIO_Config_Lcd();
    wm_config();


    xTaskCreate((TaskFunction_t )task1_task,
                    (const char*    )"task1",
                    (uint16_t       )TASK1_STK_SIZE,
                    (void*          )NULL,
                    (UBaseType_t    )TASK1_TASK_PRIO,
                    (TaskHandle_t*  )NULL);
    vTaskStartScheduler();

    while(1)
    {
        printf("shouldn't run at here!!\n");
    }
}

This is the simple code. This code is displaying the number on the lcd. I have defined wm_lcd_write_num() function in a source file and also related functions in source file. Actually when we passed the lcd segment address and data to wm_lcd_write_num, it displays the data on the lcd segment. But the task is stopping after displaying the 0 digit on the lcd. Means code is stop when compiler reaches at vtaskdelay. When i writes the delay_ms() then it printing the digit on the lcd, but time is unpredictable in case of delay_ms().
In the source file, the functions have delay in the form of delay_ms() or delay_us(). Means i am using these two delays in my source file. Before i was trying the code without freertos, now i am integrating my code on freertos.
Please help me. ?
Why my code is stop on vtaskdelay ().
Is problem to my function?
Because when wm_lcd_write_num is call, it updates the buffer and buffer is update the digit on the lcd, that also defined in a source file.

Hi @harsh_09 ,
First thing to check would be the ‘usual suspects’ - things like the asserts and stack overflows. This page provides pointers to the relevant information on things like configASSERT() and configCHECK_FOR_STACK_OVERFLOW FreeRTOS - Open Source RTOS Kernel for small embedded systems
You can also try checking in debugger , where the code stops inside vTaskDelay().

Are these delay function implemented as busy waits? Is this library compatible with RTOS i.e. would the functions like wm_lcd_write_num be okay if those are preempted in the middle? If the library does not use any interrupts, you can do a quick check by putting taskENTER_CRITICAL/taskEXIT_CRITICAL around the wm_lcd_write_num call. I’d also suggest to reach out the authors of this library to confirm.

Yes, I have sent a message to the author of library. I am waiting for their response.
After i will tell you.
Thank you sir for your kind help…