FreeRTOS Support Archive

The FreeRTOS support forum can be used for active support both from Amazon Web Services
and the community. In return for using our software for
free, we request you play fair and do your bit to help others! Sign up
to receive notifications of new support topics then help where you can.

This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.

SysTick Timer ARM Cortex M0 and configTICK_RATE_HZ

Howdy -- I'm an experienced 8 bit embedded designer, who is porting a project over to a STM32 CM0 and using FreeRTOS 9.

I've currently got my SysTick configured to trigger the SysTick interrupt every 1ms. (I can set it to whatever value, changing reload the value... but just for example).

I'm not clear on what configTICKRATEHZ is clocked too.

If I went through the code base for my FreeRTOS 9 CM0 port (my port is just right from the KEIL Pack Installer), would I find that the value I set for configTICKRATEHZ actually overwrites any previous reload value in the SysTick register, when I activate the kernel?

Or is configTICKRATEHZ some value of HZ after the SysTick interrupt (not even certain how that would work...).

SysTick Timer ARM Cortex M0 and configTICK_RATE_HZ

The SysTick timer is intended for use by an RTOS. It normally runs at the same frequency as the core. Set configCPUCLOCKHZ to the frequency the core will be executing at, then configTICKRATEHZ to the rate at which you want the RTOS tick interrupt to execute at, and the RTOS will setup the SysTick timer for you when the scheduler is started.

Typing on my phone so I can’t give you the links, but the config parameters are documented on the FreeRTOS.org website, where you will also find a free to download (if a little out of date) book.

SysTick Timer ARM Cortex M0 and configTICK_RATE_HZ

Is there any documentation, or could you provide any direction,
on where you would look in the code to change the timer being used?
It is possible, but why would you want to use a different timer for this?
You would have to make sure the the priorities are set correctly.

In case you also want to use the systick, there is an application hook that you can use:

~~~

if ( configUSETICKHOOK == 1 )

void vApplicationTickHook()
{
/* This function will be called at a rate of "configTICK_RATE_HZ" */
}

endif

~~~

If you want your handler to be called at a higher frequency, I would use some Time-Counter interrupt.

Remind that your ISR code is not supposed to call normal FreeRTOS API's. From an interrupt service routine, you should call functions that end with FromISR().

When configASSERT() is defined, the NVIC priorities will be checked for. When the priorities are not OK, the program will be kept in an infinite loop in vAssertCalled().

SysTick Timer ARM Cortex M0 and configTICK_RATE_HZ

I'm racking my brain for a reason why you wouldn't use the SysTick, I think my primary motivation is in learning the Cortex architecture for the first time and eventually looking at tickless and the whole assortment of other timers on a CM0, and mixing it up with optimal power management. [I'm not familiar enough yet, to articulate entirely what I'm thinking -- but it's not a pipe dream ;) ].

That's a VERY GOOD call out on the ISR, because I have ane existing project that I am porting (just to power profile a CM0 vs. our current 8 bit MCU), that samples data at rates faster than 1ms. In this case, maybe you dial the RTOS to 20ms a tick for housekeeping, and sample independetly in the ISR. This will be the learning curve to put all of that together.

I saw that earlier with the HAL. Honestly it is kind of weird a peripheral driver library would use the SysTick handler, but hey what do I know... I'm coming from a pretty bare-metal approach.

Like for me the NVIC functions where they modify several registers at a time, seem exotic!

I'm using the LL ("low level") library from STM, which I don't think has this dependency?

I do remember having to clean out a SysTick handler in the STM library in any case.

SysTick Timer ARM Cortex M0 and configTICK_RATE_HZ

@Richard -- I also, just wanna give you a shout-out for such an outstanding project. I own a small business and get how things go. This is crazy you guys have built this good of a system and then released the whole thing as a freebie! Good karma, my man.... hopefully the Amazon thing worked out well!