cancel
Showing results for 
Search instead for 
Did you mean: 

X-CUBE-SPN7, speed calculation,counter_ARR_Bemf = __HAL_TIM_GetCounter(&LF_TIMx); The variable counter_ARR_Bemf is step_time ? why El_Speed_Hz = (int32_t)((SIXSTEP_parameters.SYSCLK_frequency)/(prsc))/(__HAL_TIM_GetAutoreload(&LF_TIMx)*6);

zquan.1
Associate

I can speak English ​ a little, sorry!

2 REPLIES 2
Cristiana SCARAMEL
ST Employee

Hi @zquan.1​ and welcome to the ST Community.

The variable counter_ARR_Bemf store the last value of Autoreload for Low Frequency timer

With El_Speed_Hz = (int32_t)((SIXSTEP_parameters.SYSCLK_frequency)/(prsc))/(__HAL_TIM_GetAutoreload(&LF_TIMx)*6);

you get the *Eletrical* Motor Speed from ARR value of Commutation / LF TIM

I hope these info can help you; if so, consider to mark it as best answer by clicking the label "Select as Best".

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

Hi @zquan.1​,

my reply solved your doubts? 

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