Quality RTOS & Embedded Software

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




Loading

freertos VTaskDelayUntil strange behavior

Posted by Fayyaz on August 4, 2013
I am using FreeRTOS Zynq port for software development on ZedBoard. I have a periodic task, which I need to call after a specified interval. For periodic delay, I am using vTaskDelayUntil freertos method for absolute delay. Below is my setting for the tick timer.

XScuTimer_LoadTimer(&Timer, XSCUTIMER_CLOCK_HZ / configTICK_RATE_HZ);

XSCUTIMER_CLOCK_HZ = 666666687/2;
configTICK_RATE_HZ =100
So, Timer reloads value after every interrupt is 3333333.435
According to this setting, after every 10 us [2.99ns (time period for timer clock) * 3333333.435 (count value)], timer interrupt will be called. But when I call vTaskDelayUntil( &prevValue, 10), it took so much time, roughly around 30~40 seconds. However, in actual, it should take 100 us delay [10 (tick count)*10 us (tick time) =100 us]. I tried many things and would not be succeeded. If anybody can help me, I would be very grateful.


RE: freertos VTaskDelayUntil strange behavior

Posted by Richard on August 4, 2013
The Zynq port is not an official port (there is now an official Cortex-A9 port, but the Zynq code is not using it as far as I'm aware), and I am not familiar with the timers is provides at all. In any case, we cannot normally provide direct support to chip specific configuration as there are such a mass of chips and timer peripherals on the market.

However, the easy way to know if your tick configuration is setup correctly is to toggle an LED from a tick hook function, then measure the toggle frequency on a scope. Once you are confident that the tick is occurring at the correct frequency your vTaskDelayUntil() function should function as expected.

Regards.

RE: freertos VTaskDelayUntil strange behavior

Posted by Fayyaz on August 4, 2013
Dear Sir,

Thank you very much for your suggestion. As per your suggestion, I tried the tick hook function and found that tick interrupt occurs after every 2.56 seconds (on scope). It was the actual problem but I do not why, I checked the timer and its clock as well. Every thing seems OK. Do you suggest something on that,please?

Regards
M. Fayyaz

RE: freertos VTaskDelayUntil strange behavior

Posted by Richard on August 4, 2013
Sorry - I'm not familiar with the Zynq peripherals. All I can suggest is you work through the setting with the datasheet or library documentation in front of you - or find a worked example of how to configure the peripheral.

Regards.

RE: freertos VTaskDelayUntil strange behavior

Posted by Fayyaz on August 4, 2013
Dear Sir,

Sorry- The only peripheral I have is the private timer (also called "scutimer" for port tick), I checked the timer peripheral configuration, it looks fine. What others , do you think the possibility of this type of error? Your help is highly appreciated.

Regards

RE: freertos VTaskDelayUntil strange behavior

Posted by Richard on August 4, 2013
If your timer interrupt is generating interrupts at the wrong frequency it is doubtful that your problem is related to FreeRTOS, meaning this is not the best place to get advice on a solution.

I would suggest creating a very simply non-FreeRTOS project that does absolutely nothing other than configure the timer to generate periodic interrupts, then sits in a loop to allow you to measure the period using a scope. That will allow you to check the peripheral's configuration, and the configuration of the Zynq's main clocks (that presumably feed the peripheral timer). Once you are sure they are all correct and functioning as you expect you can copy the configuration into your FreeRTOS project.

If the time then still misbehaves in the FreeRTOS project it would give a clue as to where to look.

Regards.

RE: freertos VTaskDelayUntil strange behavior

Posted by Fayyaz on August 5, 2013
Dear Sir,

I tested the scu timer as a standalone application as suggested by you and found that timer frequency is very low (1.35 MHz). It is also not stable. When I use the lower timer value, I measured the time period on the scope using gpio, it is around 1.6 us (0.625 MHz). But when I tried larger timer reload value 10^6, the timer gives me 740 ns (1.35 MHz). As mentioned in the ug585- page 193. "Each Cortex-A9 processor has its own private 32-bit timer. These timers are always clocked at 1/2 of the CPU frequency (CPU_3x2x)." In my case, CPU frequency is 667 MHz, so timer should run at 667/2 MHz. I checked the CPU frequency, that is also ok.


Regards
Fayyaz


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




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

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