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




Loading

Timer is slower when debugging, STR9 with IAR

Posted by soufien on January 24, 2013
I configured a timer (timer0) for 1ms interrupts which is used to implement our own software timers. The timer is configured as the highest priority. When running the system with the debugger connected (J-Link emulator), the system runs slow as a result of timer running slow. If I reset a counter inside the timer interrupt and run the system for 10 seconds, the counter shows about 7000 which is not correct (10sec =10000ms).
This only occurs when I am connected to the device using J-link emulator. Also, it only occurs if the FreeRTOS is running and switching tasks. There seems to be constant traffic between the IDE and the processor through the JTAG as the LED of the emulator is blinking constantly. The blinking is caused by calls to __enable_interrupt() and __disable_interrupt(). It seems like these calls cause some traffic between the IDE and the processor that causes the timer to slow down.
Would the __enable_interrupt() and __disable_interrupt() calls cause the timer to slow down and why? Is this normal?
Thanks for your help,

RE: Timer is slower when debugging, STR9 with IAR

Posted by MEdwards on January 24, 2013
Make sure FreeRTOS is not also using Timer0. If you are using the official port with IAR then the kernel is probably using the watchdog.

Are you saying the problem only happens when the J-Link is connected?

The tick interrupt is probably also running at high frequency, but you still should not miss your timer interrupts unless something is making very long critical sections. Unlike Cortex ports the ARM9 port does not manage interrupt nesting.

RE: Timer is slower when debugging, STR9 with IAR

Posted by Richard Damon on January 25, 2013
One thing to be aware of is dbugging tools like J-Link can work by periodically stopping the processor and transferring information between the processor and your computer. This will make time run slower inside the processor than real time.

RE: Timer is slower when debugging, STR9 with IAR

Posted by soufien on January 25, 2013
Are you saying the problem only happens when the J-Link is connected?
-->Yes, it only happens when J-link is connected.

The tick interrupt is probably also running at high frequency, but you still should not miss your timer interrupts unless something is making very long critical sections. Unlike Cortex ports the ARM9 port does not manage interrupt nesting.
-->I measured the time it takes to make context switch (and disable interrupts) using a timer with no interrupt and was very low.


[ 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