pbielenia wrote on Wednesday, July 25, 2018:
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!