Quality RTOS & Embedded Software

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


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.


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;

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


/* Maintain the tick count. */

#if configUSE_PREEMPTION == 1
/* Switch to the highest priority task that is ready to run. */


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) 2004-2010 Richard Barry. Copyright (C) 2010-2016 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.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists