Quality RTOS & Embedded Software

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




Loading

Microchip Port

Posted by Ron Seese on March 27, 2010
My first attempt at using FreeRTOS went smoothly with an 18F8723. My second attempt is a little bumpy. I am attempting to port a 18F2620. In this design I use all of the CCP modules, so I am attempting to use timer 0 for the timer tick resource. After having the initial problems, I went back to the 8723 and changed the existing method of using a compare module and timer for the timer tick to only using timer 0, and successfully.

What seems to be happening is that any of the task delays seem to return immediately. Time slicing with 2 tasks seem to be working. I have a test point toggling on in the timer tick routine as well as both of the test tasks. I thought that there is a problem updating the timer tick counter, but I wrote a small routine that fetches the variable, and it is counting.

What would be some of the next steps in debugging this issue?

RE: Microchip Port

Posted by Richard on March 28, 2010
Are you using calls to vTaskDelayUntil()? If so, are you initialising the first parameter before using it for the first time? It should be initialised to the current time before it gets used, but once its initialised you should not (normally) write to it directly again.

Regards.

RE: Microchip Port

Posted by Ron Seese on March 29, 2010
Hi Richard,
I believe so:
static void vHeartBeat( void *pvParameters )
{
portTickType xDelayTime;

xDelayTime = xTaskGetTickCount();
for( ;; )
{
vTaskDelayUntil (&xDelayTime, DELAY_SEC);
LED1 = !LED1;
}
}

And I toggle another testpoint in the timer tick routine:
#pragma code
static void prvTickISR( void )
{
/* Interrupts must have been enabled for the ISR to fire, so we have to
save the context with interrupts enabled. */

INTCONbits.TMR0IF = 0;
TP3=!TP3;

TMR0H = ( unsigned char ) 0x82;
TMR0L = ( unsigned char ) 0xff;

portSAVE_CONTEXT( portGLOBAL_INTERRUPT_FLAG );

/* Maintain the tick count. */
vTaskIncrementTick();

#if configUSE_PREEMPTION == 1
{
/* Switch to the highest priority task that is ready to run. */
vTaskSwitchContext();
}
#endif

portRESTORE_CONTEXT();
}

I am expecting LED1 to toggle at a 1 second rate, but it toggles faster than TP3.

Thanks, Ron


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




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

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