Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs Books & Kits Visualisation Ecosystem Training Contact & Support




Last site update Jan 14 2014

Loading

FreeRTOS resets dsPIC30F

Posted by Martin Stuber on March 16, 2009
Hello everybody,
I need help with the FreeRTOS running on a dsPIC30F4013. It is working except of a reset problem. I tried to solve the problem and reduced the application to one task. The task just contains a for-loop which is limited to 9 cycles. After finishing the nine cycles the device is rebooted. But why is it rebooted? Shouldn’t the idle task hold the device in an infinite running state? A software reset seems to be responsible for the reboot (RCONbits.SWR is set to 1). The watchdogtimer is disabled. Please help me solving this problem. It seems to be the FreeRTOS but I have no idea.
Thank you in advance

RE: FreeRTOS resets dsPIC30F

Posted by MEdwards on March 16, 2009
The idle task would only run if you other task blocked, unless it is running at the same priority as the idle task. Can you post the code for your task?

RE: FreeRTOS resets dsPIC30F

Posted by Martin Stuber on March 17, 2009
I tried running the task with the same priority than the idle task but there is no difference.
Here is the code for the task and the initialization of the task:

void StartTaskOne( void )
{
xTaskCreate( (pdTASK_CODE) TaskOne, ( signed portCHAR * ) "TaskOne", configMINIMAL_STACK_SIZE*1, NULL, tskIDLE_PRIORITY + 3 , NULL );
}

void TaskOne (void)
{
char i;
UART_Init(); //Initialize the UART module to communicate with the COM port

portTickType xLastExecutionTime;

xLastExecutionTime = xTaskGetTickCount();


//for(;;)
for(i =0;i < 9;i++)
{
vTaskDelayUntil( &xLastExecutionTime, 1000 );

LATDbits.LATD2 = ~ LATDbits.LATD2;
}
}

The stack size of the task is 400 Byte. This should be enough. What can cause this (software) reset?
Thank you

RE: FreeRTOS resets dsPIC30F

Posted by Dave on March 17, 2009
You cannot exit a task by returning from the function. If you change your for loop to be an infinite loop then it should be ok (provided your UART is not causing a reset). I recommend reading the eBook.

RE: FreeRTOS resets dsPIC30F

Posted by Martin Stuber on March 17, 2009
Hello Dave,
You are right. This was my mistake. My real application has three tasks with infinite for-loops. I tried to reduce the complexity of my application and ran into this mistake.
The reset was due to UART and ADC interrupts. I don't know exactly why, but the interrupts caused the reset. When I disabled the interrupts everything was fine. Now I changed the CPU Interrupt Priority Level from 1 (as default) to 0 and everything is ok. Can anybody tell me how the interrupt priority influences the reset of my device?
Thank you very much for your help!


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2013 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.