# vTaskStartScheduler() causes an Assertion

**URL:** <https://forums.freertos.org/t/vtaskstartscheduler-causes-an-assertion/6210>\
**Category:** Kernel\
**Created:** [October 26, 2016, 11:10am UTC](https://forums.freertos.org/t/vtaskstartscheduler-causes-an-assertion/6210 "2016-10-26T11:10:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 26, 2016, 11:10am UTC](https://forums.freertos.org/t/vtaskstartscheduler-causes-an-assertion/6210/1 "2016-10-26T11:10:32Z")

</div>

**[flat213](https://sourceforge.net/u/flat213/)** wrote on [Wednesday, October 26, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/e30e5032/#fc1b):

Hello,

i’m new to FreeRTOS and just want to set up a test project with Windows Port.  
So i’ve started the demo project therefor and it works fine.

For my project i didn’t changed anything in the demo except of starting with the function main\_blinky(), i start with the function usrAppInit(), which looks like that:

```auto
void usrAppInit(void)
{
	printf("Init\n");
	StartTasks();

}

void StartTasks(void)
{
	TaskHandle_t xNvmTaskHandle = NULL;
	TaskHandle_t xMainTaskHandle = NULL;
    
	xTaskCreate(NVMTask, "tNVMTask",initNVM_STACK_SIZE, ( void * ) 1, initNVM_TASK_PRIORITY, &xNvmTaskHandle );
	
	xTaskCreate(MainTask, "tMainTask", initMAIN_STACK_SIZE, (void *) 1, initMAIN_TASK_PRIORITY, &xMainTaskHandle );

	vTaskStartScheduler();

	for (;; );
}

```

and both Tasks are empty(just a printf):

```auto
void MainTask( void * pvParameters )
{
	/* Prevent the compiler warning about the unused parameter. */
	( void ) pvParameters;

	for ( ;; )
	{
		printf("Task Main ist dran\n");
	}
}

```

When i debug this, i always get the following:

“ASSERT! Line 422, file c:…\timers.c, GetLastError() 0  
Trace output saved to Trace.dump”

I know that the Assertion is caused by vTaskStartScheduling, but why? What can be wrong? I think it’s quite the same as in the demo which is running within the same project.

Thank you for helping!

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 26, 2016, 12:50pm UTC](https://forums.freertos.org/t/vtaskstartscheduler-causes-an-assertion/6210/2 "2016-10-26T12:50:03Z")

</div>

**[flat213](https://sourceforge.net/u/flat213/)** wrote on [Wednesday, October 26, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/e30e5032/#e62c):

Ok, i have found the fail. Its because of my implementation to get my application started. It looks like this:

```auto
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY	2

	#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )
	{
		main_blinky();
	}
	#elif ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 2 )
	{
		usrAppInit();		
	}
	#else
	{
		main_full();
	}
	#endif

```

I don’t know which Line of Code exact causes the fail, but if i put my function instead of the blinky and start with mainCREATE\_SIMPLE\_BLINKY\_DEMO\_ONLY declared as 1, it should be ok.

You can delete or close.

---

<div class="post-metadata">

**Author:** ![tlafleur](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@tlafleur](https://forums.freertos.org/u/tlafleur)\
**Post date:** [October 26, 2016, 1:46pm UTC](https://forums.freertos.org/t/vtaskstartscheduler-causes-an-assertion/6210/3 "2016-10-26T13:46:24Z")

</div>

**[tlafleur](https://sourceforge.net/u/tlafleur/)** wrote on [Wednesday, October 26, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/e30e5032/#fc1b/6e27):

Printf are not in general terms, “rtos friendly”. You might try running without them and see if you have the same issue.

Their is a friendly version in some of the demo code

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 26, 2016, 1:57pm UTC](https://forums.freertos.org/t/vtaskstartscheduler-causes-an-assertion/6210/4 "2016-10-26T13:57:53Z")

</div>

**[flat213](https://sourceforge.net/u/flat213/)** wrote on [Wednesday, October 26, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/e30e5032/#fc1b/6e27/d825):

Yes, i read this. But i think for test purposes it’s ok to use printf. In my final project shouldn’t be any printf.  
This didn’t cause the error.
