Quality RTOS & Embedded Software

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


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 ]    [ 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.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

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.


Careers

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

Renesas

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