cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX-6.1.2 bug of generating SysTick clock source code

hexiaole
Associate II

hexiaole_0-1705920142853.png

hexiaole_1-1705920190810.png

Hi, engineers of ST company. I want to consult you a problem about generating code for 'SysTick clock source'.

Let us look at the first picture from documentation PM0215  page 63, there introduces the function of 'SysTick control and status register', and says that the 'CLOCKSOURCE' bit(bit 2) is to select the clock source for SysTick.

Then let us look at the second screenshot from STM32CubeMX-6.1.2, the red highlight rectangle part is used to let us configure which clock source to be used for SysTick, HCLK(HCLK/1) or HCLK/8.

Combine the above two picture, I think if we choose to use HCLK(HCLK/1) for SysTick, then the 'CLOCKSOURCE' bit from 'SysTick control and status register' will be set to 1, and if we choose to use HCLK/8 for SysTick, then the 'CLOCKSOURCE' bit from 'SysTick control and status register' will be set to 0.

If my understanding is correct, then the function of STM32CubeMX to produce code for the 'CLOCKSOURCE' bit might be wrong. Because whether I choose HCLK or HCLK/8 as clock source for SysTick, the 'CLOCKSOURCE' bit from 'SysTick control and status register' is always 1, as demostrated below:

hexiaole_3-1705921366220.png

hexiaole_2-1705921342981.png

hexiaole_4-1705921465016.png

hexiaole_5-1705921602811.png

hexiaole_6-1705921684910.png

hexiaole_7-1705921807235.png

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ghofrane GSOURI
ST Employee

Hello again @hexiaole 

Could you please try this for me :

-After choosing the HCLK/8 for SysTick and generating the code .

- Add the following lines:

HAL_SYSTICK_Config();

HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK_DIV8);

Then check if the  CLOCKSOURCE bit =0 or not .

I will be waiting for your feedback.

Thx a lot hexiaole 🙂

 

View solution in original post

5 REPLIES 5
Ghofrane GSOURI
ST Employee

Hello @hexiaole 

First let me thank you for posting.

Could you please try to use the latest version of CubeMX 6.10.0  and see if the issue still exist.

I will be waiting for your feedback.

Thanks in advance.

Ghofrane

@Ghofrane GSOURI 

Ghofrane, thank you for your immediate reply. I download the STM32CubeMX-6.10.0 and retry the same process, but the problem still exist, as demostrated below:

【1. Confirm the STM32CubeMX version is 6.10.0】

hexiaole_0-1705932617292.png

【2. Selecting HCLK(HCLK/1) as the clock source of SysTick and examine the CLOCKSOURCE bit from systick control and status register】

hexiaole_1-1705932692393.pnghexiaole_2-1705932711922.png

【3. Selecting HCLK/8 as the clock source of SysTick and examine the CLOCKSOURCE bit from systick control and status register】

hexiaole_3-1705932743684.pnghexiaole_4-1705932749684.png

 

 

Ghofrane GSOURI
ST Employee

Hello again @hexiaole 

Could you please try this for me :

-After choosing the HCLK/8 for SysTick and generating the code .

- Add the following lines:

HAL_SYSTICK_Config();

HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK_DIV8);

Then check if the  CLOCKSOURCE bit =0 or not .

I will be waiting for your feedback.

Thx a lot hexiaole 🙂

 

【1. generating code using SysTick with HCLK/8 as clock source】

hexiaole_0-1705941507618.png

【2. add suggested codes】

hexiaole_1-1705941559625.pnghexiaole_2-1705941571653.png

【3. test the CLOCKSOURCE bit】

hexiaole_3-1705941607820.png

 

@Ghofrane GSOURI Thank you Ghofrane. After your detailed instructions, the CLOCKSOURCE bit rightly reflect the configured clock source from CubeMX.

And I want to consult you whether this is a problem you and your team will fix later, or this is a normal steps that we should add manually to our project each time.

Hello @hexiaole 

Thank you for your contributions.

it has been reported to STM32CubeMX development team .

Internal ticket number:171441(This is an internal tracking number and is not accessible or usable by customers).

I will keep you posted with updates.

If your issue is resolved, please close this post by clicking the "Select as Best" button on the previous answer. This will help other members of the community find this response more quickly.

THX 🙂

Ghofrane