cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to configure the Systick timer, used as timebase generator for theCUBEHAL and the rtOS, so that it generate an exception with a period less than 1msec (forn instance, .5 msec or .1 msec). Thanks for your answer, Piero

Hicss.2033
Associate III
 
4 REPLIES 4
TDK
Guru

Pretty sure CubeMX will only let you do 1ms frequency, but you can change your code to do whatever you want. This is the default:

HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);

If you want it every 0.1ms, then change it to:

HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/10000);

Most libraries are going to expect a 1ms interval here, so you may run into issues.

If you feel a post has answered your question, please click "Accept as Solution".
Is this true both for the F4 and F7 families?
And does FreeRTOS use the systick timer exploting the CUBEHAL or directy the systick, so I can eventually utilize a timebase for FreeRTOS and another for the CUBEHAL?
Thanks for yor fast answer.
Inviato da Posta per Windows 10
Da: ST Community
Inviato: venerdì 22 maggio 2020 19:29
A: foglia@iet.unipi.it
Oggetto: TDK answered you: Is it possible to configure the Systick timer, used as timebase generator for theCUBEHAL and the rtOS, so that it generate an exception with a period less than 1msec (forn instance, .5 msec or .1 msec). Thanks for your answer, Piero
Pretty sure CubeMX will only let you do 1ms frequency, but you can change your code to do whatever you want. This is the default: [Start code block] HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000); [End code block]If you want it every 0.1ms, then change it to: [Start code block] HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/10000); [End code block]Most libraries are going to expect a 1ms interval here, so you may run into issues.
 
 
 
 
 
 
TDK (Community Member)
Pretty sure CubeMX will only let you do 1ms frequency, but you can change your code to do whatever you want. This is the default:
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
If you want it every 0.1ms, then change it to:
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/10000);
Most libraries are going to expect a 1ms interval here, so you may run into issues.
 
  or reply to this email
 
 
 
 
 
 
Replying to
 
 
 
Hicss.2033 (Community Member) asked a question.
Friday, May 22, 2020 9:53 AM
Is it possible to configure the Systick timer, used as timebase generator for theCUBEHAL and the rtOS, so that it generate an exception with a period less than 1msec (forn instance, .5 msec or .1 msec). Thanks for your answer, Piero
 
 
 
 
 
 
 
TDK (Community Member)
Pretty sure CubeMX will only let you do 1ms frequency, but you can change your code to do whatever you want. This is the default:
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
If you want it every 0.1ms, then change it to:
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/10000);
Most libraries are going to expect a 1ms interval here, so you may run into issues.
Friday, May 22, 2020 10:29 AM
 
 
 
 
 
 
 
You're receiving emails when someone "Comments on my posts."
 
To change or turn off ST Community email, log in as foglia@iet.unipi.it.st.
 
Are notifications about this post getting annoying? Reply to this email with the word " mute ".
 
STMicroelectronics N.V.
 
 
 
 
TDK
Guru

> Is this true both for the F4 and F7 families?

Yes

> And does FreeRTOS use the systick timer exploting the CUBEHAL or directy the systick, so I can eventually utilize a timebase for FreeRTOS and another for the CUBEHAL?

Not sure what FreeRTOS does. There is only one SysTick interrupt though, so both have to use the same systick frequency.

I would not advise changing the frequency to something other than 1ms. You will likely break some implicit assumptions in RTOS. If you need interrupts at a different frequency, any of the timers can be used independently from SysTick.

If you feel a post has answered your question, please click "Accept as Solution".
Piranha
Chief II

> does FreeRTOS use the systick timer exploting the CUBEHAL or directy the systick

FreeRTOS uses SysTick peripheral directly. You can override HAL tick functions and implement those on FreeRTOS tick functions, but then you must ensure that ST's idiot code are not calling those from interrupts.

> I would not advise changing the frequency to something other than 1ms. You will likely break some implicit assumptions in RTOS.

FreeRTOS (and most other RTOS) itself works on ticks, it doesn't care the absolute time.