2020-11-17 04:35 PM
Hello Friends and ST engineer.
I am controlling BLDC motor using STSW-SPIN3204 firmware with Hall Sensor. But some functions I do not understand, please explain more detail for me.
I do not understand this function for what? please tell more detail for me
If you have the detail document, please give
Thank you so much.
Best regards.
Solved! Go to Solution.
2020-12-04 09:37 AM
Hi @Vnguy.1
The TIM_SelectOCxM function comes from the old standard libraries for STM32. The new HAL doesn't provide this specific function.
In any case the objective here is managing the channels of HF timer in order to set the high-impedance state in one of the phases.
The code achieve this result through the writing of the CCER register and enabling/disabling the channels.
Enrico
2020-11-23 09:44 PM
how much pole pairs are there in your motor..? i am trying to work with single pole pair motor and the firmware i got is with 7 pole pair,i am stuck at changing the firmware to single pole pair....do you have any idea about this..?
2020-11-27 06:05 AM
Hi @ORaph.1
You can open a new post for this.
Regards
Enrico
2020-11-27 09:48 AM
hi @Vnguy.1
The HAL_TIM_OC_DelayElapsedCallback is called by the triggering of the timeout between Hall sensor commutation (IC capture) and changes of the HF timer configuration (commutation event).
This delay is set using one OC channel of the LF timer.
Basically the HF timer configuration (TIM1) is pre-loaded into the shadow registers and when this timeout is elapsed the new values became active. This allows a perfect synchronization of the 3 phases of the motor.
This is the "commutation event" and it is automatically triggered by the internal master/slave system of the MCU.
The MC_TIMx_SixStep_CommutationEvent sets the delay between the IC capture (Hall commutation) and the commutation event of TIM1 allowing this synchronization.
Summary:
Hall sensor commutation --> LF_TIM IC capture --> MC_TIMx_SixStep_CommutationEvent setting a delay
Delay expires --> LF_TIM OC delayelapsed --> HF_TIM Commutation event
The code inside the HAL_TIM_OC_DelayElapsedCallback checks that the Hall sesnors are commutating as expected and the motor is not locked.
Kind Regards
Enrico
2020-11-30 12:46 AM
Hi Enrico Poli.
Thank you so much for your information, it is really useful for me.
But after I read the STSW-SPIN3204 firmware, I got some troubles, please explain to me.
2 . May you explain to me why MC_TIMx_SixStep_timebase() function is called 2 times, first is in HAL_TIM_PeriodElapsedCallback(), and second is in HAL_TIM_IC_CaptureCallback()? I think it will be called 1 time in HAL_TIM_IC_CaptureCallback() as enough.
3 . For example, when Input capture happens HAL_TIM_IC_CaptureCallback() is called , assume that hall status = 2, it means as case 2 in MC_SixStep_NEXT_step(), next_step_pos = 1, this function sets up the CCR1 = pulse_value. As the below picture, I think we should set up the CCR2 = pulse_value, is that correct? For my understanding, after the commutation delay, HAL_TIM_OC_DelayElapsedCallback() is then called. At that time, next_step_pos = 2. And then MC_SixStep_TABLE(2) is called, in case 2 in MC_SixStep_TABLE(2) set up CH1, and CH3. It made me so confused. May you explain to me? Thank you so much.
Best Regards
2020-12-02 05:51 AM
Hi @Vnguy.1 ,
Following my answer to your points:
Kind Regards
Enrico
2020-12-02 07:21 PM
Hi Enrico Poli
Thank you so much for your reply.
One question I would like to ask you.
In order to set or reset OCxM, some document use the TIM_SelectOCxM command. but in MC_SixStep_NEXT_step() function, there is no TIM_SelectOCxM to control OCxM as the below picture. May you explain for me? Thank you so much
Best Regards.
2020-12-04 09:37 AM
Hi @Vnguy.1
The TIM_SelectOCxM function comes from the old standard libraries for STM32. The new HAL doesn't provide this specific function.
In any case the objective here is managing the channels of HF timer in order to set the high-impedance state in one of the phases.
The code achieve this result through the writing of the CCER register and enabling/disabling the channels.
Enrico
2020-12-11 06:17 AM
Hi @Vnguy.1 ,
If you think my replies answer your doubts, please mark them ad "Best answer".
This will help other community members to find the support they are looking for.
Thanks!
Enrico
2020-12-13 10:32 PM
Hi Enrico Poli
I am sorry for reply late
Thank you for your help and your time.
I got many in formation from you.
Best Regards and Keep safe.