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

time measure

Posted by Braun on January 27, 2012
Hello,

efm32g290f128, arm3, IAR

I have a task priority 2 and priority tasks of these two creates the first
Now I will measure the time how long the two tasks need.
I'm thinking of the SysTick timer. He gives an interrupt every ms.
Am I on the wrong track? Is there something better?

RE: time measure

Posted by Dave on January 27, 2012
Your question is not clear, but here are some general comments on measuring time.

You can get the tick count by calling xTaskGetTickCount(). This will increment at the tick frequency, so give an accuracy of roughly twice the tick frequency. If that is good enough, use that.

If you want a higher resolution time value then use a hardware peripheral timer, and read its count value directly.

Hope that helps.

RE: time measure

Posted by Braun on January 27, 2012
Ok, Thank you

I need a time reference, and I would like to build on a hardware peripheral timer.

The timer should be started by the task with priority 2.
If the task with Priorit├Ąt2, the other tasks created with Priority 1 -> suspend
if the tasks is finished with Priority 1 -> Task Priority 2 resume
Now I want to measure the time for this part
How can I implement this?

RE: time measure

Posted by Richard on January 27, 2012
If I understand you correctly, then you have the following scenario, where P1 is a task with priority 1, and P2 is a task with priority 2.

1: P2 suspends itself.
2: Because P2 is suspended P1 runs.
3: When P1 has done something it un-suspends (resumes) P2, so P2 runs again.

and you want to measure between step 1 and step 2.

If the tick count has enough resolution then you can do that by:

void P2( void *pvParameters )
{
xTickType xTimeBefore, xTotalTimeSuspended;

____for( ;; )
____{
________/* Take a time before suspending. */
________xTimeBefore = xTaskGetTickCount();

________/* Suspend the task. */
________vTaskSuspend( NULL );

________/* The other task will have run an unsuspended P2 for this line to execute. */
________xTotalTimeSuspended = xTaskGetTickCount() - xTimeBefore;



Regards.

RE: time measure

Posted by Braun on February 1, 2012
Yes this work, thank you.


[ 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