Pic24 automatic Reset

Automatic resetting occurs when i add/ create some tasks for example if i add xTaskCreate( vHandlerTask, “Handler”, 500, NULL, 1, NULL); in my program microcontroller will reset automatically void vHandlerTask( void pvParameters ) { int i; / As per most tasks, this task is implemented within an infinite loop. / for( ;; ) { U1_puts( “Handler task .rn” ); / Use the semaphore to wait for an event. The semaphore was created before the scheduler was started so before this task ran for the first time. The task blocks indefinitely so the function call will only return once the semaphore has been successfully taken (obtained). There is therefore no need to check the function return value. / xSemaphoreTake( xBinarySemaphore, portMAX_DELAY ); / To get here the event must have occurred. Process the event. case processing is simply a matter of printing out a message. */ U1_puts( “Handler task – Processing event.rn” ); } } Why this happening when adding some tasks?, if i delete or comment this task program will work. Please help These are my Tasks if i put tasks as shown below “vMT_InitRepman” will execute first , it never enter in to vHandlerTask even its priority is 10.
    xTaskCreate( vMT_InitRepman, "vMT_InitRepman", 500, NULL, 3, &xInitHandle );

    xTaskCreate( vMT_Loging, "vMT_Loging", 500, 5, 1, &xLogingHandle);
    xTaskCreate( vMT_Upload, "vMT_Upload", 500, 20, 1, &xUploadHandle );
    xTaskCreate( vMT_ErrorHandler, "vMT_ErrorHandler", 500, NULL, 2, &xErrorHandle );

    xTaskCreate( vHandlerTask, "Handler", 500, NULL, 10, NULL);
And if put as shown below, microcontroller will reset continuously
     xTaskCreate( vHandlerTask, "Handler", 500, NULL, 10, NULL);
     xTaskCreate( vMT_InitRepman, "vMT_InitRepman", 500, NULL, 3, &xInitHandle );

    xTaskCreate( vMT_Loging, "vMT_Loging", 500, 5, 1, &xLogingHandle);
    xTaskCreate( vMT_Upload, "vMT_Upload", 500, 20, 1, &xUploadHandle );
    xTaskCreate( vMT_ErrorHandler, "vMT_ErrorHandler", 500, NULL, 2, &xErrorHandle );

Pic24 automatic Reset

Try all the usual things first – define configASSERT(), have the malloc failed and stack overflow hooks defined, etc. Then, if still no luck in trapping the error, step through the task in the debugger until the point at which the reset occurs to see what is causing it. Regards.