相关文章推荐
眼睛小的生姜  ·  jtextarea_百度百科·  3 月前    · 
爱健身的跑步鞋  ·  spyder 缩进指南、 ...·  6 月前    · 
乐观的蚂蚁  ·  nginx redirect port ...·  1 年前    · 
斯文的春卷  ·  Run your app from a ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

My application run on stm32F4 with FreeRTOS V9.0.0 and port files Source\portable\RVDS\ARM_CM4F (imported via RTE Keil). The main, call some initialization functions, create the task and then call the vTaskStartScheduler. The task simply call vTaskDelay(1000) which never return. The system is not is fault. The fault report dosen't show any error or problem.

The code is:

int main(void) 
 init_foo1()
 init_foo2()
 xTaskCreate(aTask, "name",1280, NULL, 6, NULL);
 init_foo3();
 vTaskStartScheduler();
 void aTask()
 vTaskDelay(1000);
 bar();

What is wrong? Thanks all

Function definition are not NOT relevat for this problem. vTaskDelay funtion is weel defined in FreeRTOS documentation. Behaviour is mentioned. What is still need? – Mattia S. Aug 2, 2017 at 8:35 Please check your configTICK_RATE_HZ macro in FreeRTOSConfig.h. After that try this: vTaskDelay(1000/portTICK_RATE_MS);. – maestro Aug 3, 2017 at 17:39

You need to put infinite loop firstly:

Example usage of vTaskDelay function accordinly to documentation:

 void vTaskFunction( void * pvParameters )
 /* Block for 500ms. */
 const TickType_t xDelay = 500 / portTICK_PERIOD_MS;
     for( ;; )
         /* Simply toggle the LED every 500ms, blocking between each toggle. */
         vToggleLED();
         vTaskDelay( xDelay );

Also test the priority in xTaskCreate

UBaseType_t uxPriority
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.