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


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) 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