Quality RTOS & Embedded Software

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




Loading

Cortex-M3 (STM32L100xx) systick behavior

Posted by tzakariassen on November 27, 2013

I've got a STM32L100 running fine with freeRTOS 7.5.2 and Atollic 4.2 as dev tool on a Discovery board. I use the systick counter to measure time between certain events in my code like

~~~~~ xEventTimeToTrack = xTaskGetTickCount(); . . . if (condition) xPassedtimeBetweenEvents = xTaskGetTickCount() - xEventTimeToTrack; ~~~~~~~ When the systick counter eventually wraps to zero the above expression will produce undesireable result unless you make some validity checks and adjustments before attempting the subtraction. Does freeRTOS perform some clever internal adjustments to the systick counter value so that the above expression Always produce the intended result?

Best regards /Thom


Cortex-M3 (STM32L100xx) systick behavior

Posted by richard_damon on November 27, 2013

As long as PORTTICKTYPE is at least as big as an int, or the result put back into a PORTTICKTYPE, the answer will be correct due to the way unsigned arithmetic is defined. For a 32 bit processor you want to make sure you do not use 16 bit ticks counters (define in the FreeRtos Config header), and the match should just work out right.


Cortex-M3 (STM32L100xx) systick behavior

Posted by tzakariassen on November 28, 2013

OK, good news. Thanks!


[ 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