I use dsPIC33F processor with FreeRTOS and they work very well..
1) I would suggest that you start with the supported demo… if your using
an explorer 16 board, it will just run
if your using your own hardware, make change for the LED and serial
port in the standard demo…
The standard demo is a good test to make sure your hardware is
stable..
2) If you can, move up to MPLABX and the XC compiler… and FreeRTOS 8.xx
as a starting base
3) add the FreeRTOS callback functions to see if your having a stack or
memory issue…
( you will also need to enable them in FreeRTOSConfig.h)
4) what FreeRTOS heap are you using heap_1.c, 2, 3 or 4??
5) change your FreeRTOS task size to a bigger value by 2X or 3X
/* *********** FreeRTOS callback functions *********** */
/*
*
* vApplicationIdleHook
*
*
*/
void vApplicationIdleHook( void )
{
/* Schedule the co-routines from within the idle task hook. */
}
/*
*
* vApplicationTickHook
*
*
*/
void vApplicationTickHook( void )
{
/* This function will be called by each tick interrupt if
configUSE
TICKHOOK is set to 1 in FreeRTOSConfig.h. User code can be
added here, but the tick hook is called from an interrupt context, so
code must not attempt to block, and only the interrupt safe FreeRTOS API
functions can be used (those that end in FromISR()). */
}
/*
*
* vApplicationStackOverflowHook
*
*
*/
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed portCHAR
*pcTaskName )
{
taskDISABLE_INTERRUPTS();
while(1) ; // we will hang here if we have stack overflow
}
/*
*
* vApplicationMallocFailedHook
*
*
*/
void vApplicationMallocFailedHook( void )
{
/* vApplicationMallocFailedHook() will only be called if
configUSE
MALLOCFAILED
HOOK is set to 1 in FreeRTOSConfig.h. It is a
hook
function that will get called if a call to pvPortMalloc() fails.
pvPortMalloc() is called internally by the kernel whenever a task,
queue,
timer or semaphore is created. It is also called by various parts of
the
demo application. If heap1.c or heap
2.c are used, then the size of
the
heap available to pvPortMalloc() is defined by configTOTALHEAP_SIZE in
FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be
used
to query the size of free heap space that remains (although it does not
provide information on how the remaining heap might be fragmented). */
taskDISABLE_INTERRUPTS();
while(1) ; // we will hang here if we have stack
overflow
}
On Mon, Jan 19, 2015 at 10:00 AM, Patrick
patricknew@users.sf.net wrote:
hi everyone,
this is my first time working with FreeRTOS and i hope u guys could help
me.
First:
I´m using MPLABv8.30 and the C30v3.12 compiler. I´m working with the
dsPIC33FJ256GP710 uC and the Microchip PICkit2 Programmer.
I´m using the FreeRTOS demo project
(.FreeRTOSV8.1.2FreeRTOSDemodsPIC_MPLAB).
Problem:
I was just playing with tasks but the tasks arent context switching –
Programm remains in the first created task.
Configuration:
//default values of the demo project#define configUSEPREEMPTION 1#define configUSETIMESLICING 1 #define configUSEIDLEHOOK 1#define configUSETICKHOOK 0#define configTICKRATEHZ ( ( TickTypet ) 1000 )#define configCPUCLOCKHZ ( ( unsigned long ) 25000000 ) /* Fosc / 2 */#define configMAX_PRIORITIES ( 4 )#define configMINIMAL_STACK_SIZE ( 105 )#define configTOTAL_HEAP_SIZE ( ( size_t ) 5120 )#define configMAX_TASK_NAME_LEN ( 4 )#define configUSE_TRACE_FACILITY 0#define configUSE_16_BIT_TICKS 1#define configIDLE_SHOULD_YIELD 1
main:
//both tasks with same priorityxTaskCreate(firsttask,”f”, 1024, NULL, 1, NULL);xTaskCreate(secoundtask,”s”, 1024, NULL, 1, NULL);vTaskStartScheduler();
tasks:
void firsttask(void *p){
while(1){
functionone();
}}
void secoundtask(void *p){
while(1){
functiontwo();
}}
tick Interrupt:
void attribute((interrupt, autopsv)) configTICKINTERRUPT_HANDLER( void ){
/* Clear the timer interrupt. */
IFS0bits.T1IF = 0;
if( xTaskIncrementTick() != pdFALSE )
{
portYIELD();
}}
The tick-Interrupt occurs but the function “xTaskIncrementTick()” returns
always pdFALSE – I never reach “portYIELD()”.
I really dont know why this is happening but I hope someone out there
knows whats wrong.
PIC33: Problem with taskschedule
Sent from sourceforge.net because you indicated interest in
https://sourceforge.net/p/freertos/discussion/382005/
To unsubscribe from further messages, please visit
https://sourceforge.net/auth/subscriptions/
—
~~ _/) ~~~~ _/) ~~~~ _/) ~~~~ _/) ~~
Tom Lafleur