# RTOS timing slow on AVR ATMEGA32?

**URL:** <https://forums.freertos.org/t/rtos-timing-slow-on-avr-atmega32/243>\
**Category:** Kernel\
**Created:** [October 7, 2005, 5:29pm UTC](https://forums.freertos.org/t/rtos-timing-slow-on-avr-atmega32/243 "2005-10-07T17:29:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 7, 2005, 5:29pm UTC](https://forums.freertos.org/t/rtos-timing-slow-on-avr-atmega32/243/1 "2005-10-07T17:29:02Z")

</div>

**nobody** wrote on [Friday, October 07, 2005](https://sourceforge.net/p/freertos/discussion/382005/thread/0ed9155a/#5881):

I use the function vTaskDelay( ( portTickType ) 500 ); to delay the task and to turn on and off a led.  
I notice that the led is flashing at a slower frequency than expected.  
In the configuration file the following setup:

configCPU\_CLOCK\_HZ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( ( unsigned portLONG ) 8000000 )

configTICK\_RATE\_HZ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( ( portTickType ) 1000 )

I would think 1ms is one tick??  
So a delay of 500 should be half a second??

I’am using an ATMEGA32 with 8Mhz resonator and have CKOPT, SUT0, CKSEL3, CKSEL2, CKSEL1 turned on and programmed with Ponyprog.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 7, 2005, 6:00pm UTC](https://forums.freertos.org/t/rtos-timing-slow-on-avr-atmega32/243/2 "2005-10-07T18:00:10Z")

</div>

**nobody** wrote on [Friday, October 07, 2005](https://sourceforge.net/p/freertos/discussion/382005/thread/0ed9155a/#5881/9651):

Have you changed the start up code at all?&nbsp; The function prvSetupTimerInterrupt() in port.c?&nbsp; It works exactly for me.&nbsp; I don’t know ponyprog, but I suspect a fuse setting problem.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [October 7, 2005, 6:04pm UTC](https://forums.freertos.org/t/rtos-timing-slow-on-avr-atmega32/243/3 "2005-10-07T18:04:09Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Friday, October 07, 2005](https://sourceforge.net/p/freertos/discussion/382005/thread/0ed9155a/#5881/e005):

Try to verify the clock setting by toggling an LED within a timer interrupt before starting the scheduler.&nbsp; For example, toggle the LED every 1000 ticks to get a 1 second toggle.

Once you have got the frequency correct try the scheduler test again.

I suspect the clock fuse settings might be incorrect.

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 7, 2005, 6:11pm UTC](https://forums.freertos.org/t/rtos-timing-slow-on-avr-atmega32/243/4 "2005-10-07T18:11:53Z")

</div>

**nobody** wrote on [Friday, October 07, 2005](https://sourceforge.net/p/freertos/discussion/382005/thread/0ed9155a/#5881/258d):

Set the clock fuse settings to the Calibrated Internal RC Oscillator at 8Mhz and it is running fine now.

Thanx for comments, Adrian
