Skip to main content
zquan.1
Visitor II
July 3, 2021
Question

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

  • July 3, 2021
  • 1 reply
  • 560 views

I can speak English ​ a little, sorry!

This topic has been closed for replies.

1 reply

Cristiana SCARAMEL
ST Employee
July 9, 2021

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"""
Cristiana SCARAMEL
ST Employee
August 5, 2021

Hi @zquan.1​,

my reply solved your doubts? 

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