Problem: vTaskDelay and running a code

Hi, I’m not sure I should post this here or rather on the ST forum, but let’s try here first. Issue involves: • Microcontroller STM32L100RC • STM Discovery Board with ST-Link • FreeRTOS v10.0.1 • IDE Eclipse Workbench for STM32 • Windows 10 • Blinking an led My problem is a program (simple blinking an led) isn’t running immediately when I’m writing it to a microcontroller. Resetting the chip doesn’t result in successfully running, but when I unplug a USB cable connected to the board and a computer, and plug the cable again – the program starts running fine. It turns out that the program freezes at a calling a function vTaskDelay or vTaskDelayUntil, reaches below line in the tasks.c file and goes into a infinite loop. /* Force a reschedule if xTaskResumeAll has not already done so, we may have put ourselves to sleep. / if( xAlreadyYielded == pdFALSE ) { portYIELD_WITHIN_API(); / <- here */ } else { mtCOVERAGE_TEST_MARKER(); } I’ve noticed that for parameter less about 200 ms the program runs immediately, which is correct behaviour. Task’s body: static void vLEDTask( void *pvParameters ) { const TickType_t xTicksToWait = pdMS_TO_TICKS(300);
for (;;) {
    vTaskDelay(xTicksToWait);
    GPIO_ToggleBits(GPIOC, GPIO_Pin_9);     /* toggle the led state */
}
} I attach a link to my github profile where I upload the whole code: https://github.com/bialasek/stm32l1_freeRTOS I would like to ask you for help in solving that issue or maybe you have faced a similar situation. Thank you in advance!

Problem: vTaskDelay and running a code

My first thought when things work for short delays but not longer is that there is an issue with the configuration of Tickless Idle. It could be that the debugger sets up something that causes issue with it, and the full power cycle is needed to clear that. One test would be to disable tickless Idle and see if that fixes things,

Problem: vTaskDelay and running a code

Wow, you’re correct! So I changed in the file FreeRTOSConfig.h the macro: ~~~

define configCREATELOWPOWER_DEMO 1

~~~ to: ~~~

define configCREATELOWPOWER_DEMO 0

~~~ because it’s related to the following: ~~~

define configUSETICKLESSIDLE configCREATELOWPOWER_DEMO

~~~ and now it’s working fine. Thanks!