Quality RTOS & Embedded Software

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


PIC32 changing timer?

Posted by ulmus on October 18, 2011
I was searching forum but dont know exactly:
I want to change Timer2 into Timer5. Timer2 which is choosen in PIC32 port is imho not good. Timer 2 is used e.g. in PWM implementation in PIC32. Id like to change timer2 into 5 and want to know if it has something to do with license or not?
And the last thing: anyone has change already timer2? there is some tricks or only changing 2's into 5's in source?
Thanx in advance :)

RE: PIC32 changing timer?

Posted by Richard on October 18, 2011
Just change the implementation of prvSetupTimerInterrupt() in port.c, no problem.


RE: PIC32 changing timer?

Posted by ulmus on October 18, 2011
Not exactly, i can see something else in port.c:

extern void __attribute__( (interrupt(ipl1), vector(_TIMER_1_VECTOR))) vT1InterruptHandler( void );

enough to change _TIMER_1_VECTOR into _TIMER_5_VECTOR, name of function can stay ;)

I hope it's all :)
but about licence: have to do something if i change those points of source?

RE: PIC32 changing timer?

Posted by Richard on October 18, 2011
You are right of course - you also have to change the vector used.

Don't worry about the license. What you are doing is not adding to or modifying FreeRTOS, just changing the peripheral used to generate the tick, nothing need be done.


RE: PIC32 changing timer?

Posted by RĂ©mi Debord on April 25, 2012
We have 4 lines to change:

First, change the Vector,

extern void __attribute__( (interrupt(ipl1), vector(_TIMER_5_VECTOR))) vT1InterruptHandler( void );

Next, change the lines in void prvSetupTimerInterrupt( void ) by these lines (for timer5),

OpenTimer5( ( T5_ON | T5_PS_1_64 | T5_SOURCE_INT ), ulCompareMatch );

and next modify this line in void vPortIncrementTick( void )


Enjoy ;)

RE: PIC32 changing timer?

Posted by ulmus on April 25, 2012
Thanx remidebord, but as you can see, this post is 6 months old :) I have already everything done and all is still working:)

[ 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