Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


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(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 ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner