Freertos stuck in vTaskDelay

smallbook wrote on Wednesday, December 09, 2015:

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();
    }
    
    thaks a lot for your answers

heinbali01 wrote on Wednesday, December 09, 2015:

Hi

When I go to line 2588 in tasks.c I see totally different code.

Would it be possible for you to download the latest official version from freertos.org (V8.2.3) and try that first?

If your code is still simple, you might want to post some code here?

smallbook wrote on Wednesday, December 09, 2015:

hi , i’m using freeRtos v8.1.2 here is a sample of what i’am triying to do , the code get stuck when it enters the vTaskDelay

int main()
{ 
  rcc_clk_config(); // co,figures system clk to run on 100 Mhz
  
 gpio_config(); // enable the portD clk
  
 
SystemCoreClockUpdate(); // updates the system core clk
  
xTaskCreate( vTask1, "Task1", 150, NULL, 1,  NULL );

vTaskStartScheduler();

}


// bliking port D
void vTask1(void *pv1)
{ 
  while(1)
   { 
      GPIOD->BSRRL=GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15;/// BSRRL = set
     vTaskDelay((TickType_t)200);
      GPIOD->BSRRH=GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15;// BSRRH = reset
       vTaskDelay((TickType_t)200);
  
  }
  
}

i have tested that the code before vTaskStartScheduler() runs correctly
Thank you verry much for your reply

rtel wrote on Wednesday, December 09, 2015:

Are you sure the tick interrupt is executing? If you put a break point in xTaskIncrementTick in FreeRTOS/Source/tasks.c does it ever get hit.

Do you have configASSERT defined? http://www.freertos.org/a00110.html#configASSERT

smallbook wrote on Wednesday, December 09, 2015:

The code of "xTaskIncrementTick "is not reached during the debug session
I don’t have a "configASSERT "
according to the link you specified , some functions should be defined inside a new file called "application_defined_privileged_functions.h ", can you please specifie for me what are these functions and how to do this

Thanks a lot

rtel wrote on Thursday, December 10, 2015:

The code of "xTaskIncrementTick "is not reached during the debug session

That will be why the delay function doesn’t return. It doesn’t sound
like your tick interrupt is executing, and if the tick interrupt is not
executing then time stands still - hence the delay never expires.

I don’t have a "configASSERT "

It is always recommended to have configASSERT() defined when developing.
It can find an error in seconds that could otherwise take weeks - I
can’t put it any more clearly than that. It is also best to have the
latest version of FreeRTOS as we add more configASSERT() statements to
assist people.

according to the link you specified , some functions should be defined
inside a new file called "application_defined_privileged_functions.h ",
can you please specifie for me what are these functions and how to do this

Not sure what you mean here - I thought I had sent a link to the
configASSERT() description on the configuration web page, nothing about
privileged functions.

smallbook wrote on Thursday, December 10, 2015:

yes i can see it is defined in freeRTOSconfig.h as follows :

#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }

how should i use it to know the reason why tick interrupt is not executing .

Thanks a lot for your replies .

rtel wrote on Thursday, December 10, 2015:

Have you installed the FreeRTOS interrupt handlers? See point (1) on the following page: http://www.freertos.org/FAQHelp.html

If you are using STM32 cube then it may have its own systick handler, but that should be calling the FreeRTOS one. Did you create the project yourself, or did the cube software create it for you?

smallbook wrote on Thursday, December 10, 2015:

hi this was so much helpfull
in fact i’ve been working with the FreeRTOSConfig.h generated with stmcube and the following was commented , I decommented it
now everything is working fine
thankyou

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