2
\$\begingroup\$

hello i'am using FreeRtos API with stm32f4 microcontroller , the program gets stuck when it enters vTaskDelay , when I debug it I see that it is stuck in this line (2588 of tasks.c at function vTaskDelay)

            if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ) ) > ( UBaseType_t ) 1 )
        {
            taskYIELD();
        }

thank a lot for your help

\$\endgroup\$
3
  • \$\begingroup\$ There are a lot of things that could cause this, but you're probably misusing the mutitasking API somewhere else. \$\endgroup\$
    – Daniel
    Dec 9, 2015 at 0:22
  • \$\begingroup\$ Not enough information provided to answer this \$\endgroup\$
    – Daniel
    Dec 9, 2015 at 0:23
  • \$\begingroup\$ hi @Daniel i discovered that the code never reaches " xTaskIncrementTick " wich means the tick interrupt doesn't execute , how to make it work ? \$\endgroup\$ Dec 10, 2015 at 11:06

2 Answers 2

3
\$\begingroup\$

well I found the reason why this error happened it's just that time doesn't seem to advance because the systick interruption was like doing nothing , and this because i used a FreeRTOSConfig.h generated with stmcube and the following was commented

/* IMPORTANT: This define MUST be commented when used with STM32Cube firmware, 
to prevent overwriting SysTick_Handler defined within STM32Cube HAL */
/* #define xPortSysTickHandler SysTick_Handler*/

, I decommented it , i also had to comment the definition of the systick interruption in stm32f4xx__it.c to avoid duplicate definition

\$\endgroup\$
0
\$\begingroup\$

With STM32Cube_FW_F4_V1.13.1 and FreeRTOS V8.2.3 you need to define the symbol USE_RTOS_SYSTICK.

Here is a working example:

#include "stm32f4xx.h"
#include "stm32f4xx_nucleo_144.h"

// don't forget to define USE_RTOS_SYSTICK globally!

#include <cmsis_os.h>

#define LED_PIN     GPIO_PIN_0
#define LED_PORT        GPIOB

void blinky_task( void* pvParameters)
{
    for(;;)
    {
        vTaskDelay( 1000 / portTICK_PERIOD_MS);
        HAL_GPIO_WritePin( LED_PORT, LED_PIN, GPIO_PIN_SET);

        vTaskDelay( 200  / portTICK_PERIOD_MS);
        HAL_GPIO_WritePin( LED_PORT, LED_PIN, GPIO_PIN_RESET);
    }
}

int main(void)
{
    HAL_Init();
    __HAL_RCC_GPIOB_CLK_ENABLE();

    GPIO_InitTypeDef GPIO_InitStructure;
    GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStructure.Pin  = LED_PIN;
    HAL_GPIO_Init( LED_PORT, &GPIO_InitStructure);

    xTaskCreate( blinky_task, (char*) "blinky", configMINIMAL_STACK_SIZE, 0, 1, 0);
    vTaskStartScheduler();
}
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.