Quality RTOS & Embedded Software

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


How to set a Timer > 1000Hz

Posted by CP Kwok on December 22, 2008
I am developing a project on at91sam7se. I set a timer of 10k Hz. However, I found that the timer interrrupt can only be toggled every 1 ms when I set the timer frequency >1000Hz. Is this the limit of the system?

Does anyone have any idea?


RE: How to set a Timer > 1000Hz

Posted by Richard on December 22, 2008
If you are talking about the tick interrupt, then the SAM7 uses the PIT (Periodic Interval Timer) to generate the tick. I'm sure you would be able to make it go very quickly, but you might need to change the implementation of prvSetupTimerInterrupt() in port.c to do this (it might be that you need to use some pre-scales or something on the timer).

Also, the standard demos make a lot of use of the constant portTICK_RATE_MS. If you go above 1ms tick then this will not work. You don't need to use the constant, its just for convenience.

Its best to keep the tick interrupt frequency as low as possible, otherwise you could get into to efficiency issues. If you need a faster timer consider using one of the other timer peripherals in addition to the tick interrupt, then keep the tick frequency lower.


RE: How to set a Timer > 1000Hz

Posted by CP Kwok on December 23, 2008
Thx Richard,

Yes, I notice the system tick is using PIT.

I am using Timer0 to generate the 10kHz, But it's strange that the ISR is called at a limit of 1kHz. I don't see this problem in another module, say UART. Using the same code, I can do it in a stand alone applcation. Thus I am wondering if there are any missing part that I have to change to do so in FreeRTOS.


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

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

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo & Nuvoton Cortex-M23 demo.

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

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

Cadence Tensilica Cortes

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