Skip to main content
Senior III
Sep 9, 2025 12:15 PM UTC
Question

Clarification on the Hall Interrupt

STuser2_0-1757419669568.pngSTuser2_1-1757419688398.png

I always observe a spike when i start to run the motor which leads to audible noise or jerk when i went through the code to modify i have observed the variable hAux little confusing request to please confirm if it is intended 

__weak void *HALL_TIMx_CC_IRQHandler(void *pHandleVoid)
{
 if (pHandle->OVFCounter != 0U)
 {
 /* Adjust the capture using prescaler */
 uint16_t hAux;
 hAux = hPrscBuf + 1U;
 wCaptBuf *= hAux;

again declared
 if (pHandle->RatioDec) /* and don't decrease it again */
 {
 /* Adjust the capture using prescaler */
 uint16_t hAux;
 hAux = hPrscBuf + 2U;
 wCaptBuf *= hAux;

again declared

 else /* If prescaler was not modified on previous capture */
 {
 /* Adjust the capture using prescaler */
 uint16_t hAux = hPrscBuf + 1U;
 wCaptBuf *= hAux;

 

 

This topic has been closed for replies.

6 replies

STuser2Author
Senior III
Sep 11, 2025 8:03 AM UTC

There is always in dip in speed then adjusts itself when i start the motor 

STuser2_0-1757576949778.png

STuser2_1-1757576977481.pngspeed dip

STuser2_2-1757577649033.pngSTuser2_3-1757577666951.png

I am really not sure of the impact of this but i confirmed that it is happening due to the below transition of the code from if to else in the file hall_speed_pos_fdbk.c

if ((pHandle->BufferFilled < pHandle->SpeedBufferSize) && (wCaptBuf != 0U))
 {
 uint32_t tempReg = (pHandle->PseudoFreqConv / wCaptBuf) * (uint32_t)pHandle->Direction;
 pHandle->AvrElSpeedDpp = (int16_t)tempReg;
 }
 else
 {
 /* Average speed allow to smooth the mechanical sensors misalignement */
 pHandle->AvrElSpeedDpp = (int16_t)((int32_t)pHandle->PseudoFreqConv /
 (pHandle->ElPeriodSum / (int32_t)pHandle- >SpeedBufferSize)); /* Average value */

 }

Could you please confirm if that is the root cause or not, if yes request to please provide me the solution? I need to close these issues and thank you for support.

 

 

Gael A
ST Employee
Sep 12, 2025 12:32 PM UTC

Hello STuser2,

Could you please tell me which version of the MCSDK you are using for this application ?

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.
STuser2Author
Senior III
Sep 12, 2025 12:53 PM UTC

MCSDK 6.4.1

STuser2Author
Senior III
Sep 18, 2025 9:51 AM UTC

Hello @Gael A 

Thank you for the reply, i have not profiled the hall sensors but i have run the profiler software and compared the angles as below

STuser2_0-1758188830112.png

This is done as part of the other issue which is still in progress and not resolved (both are same setup)

Motor Jerks at start and multiple Speed Feedback f... - STMicroelectronics Community

I have followed the method documented in MCSDK to find the placement angle. Please let me know if any actions need to be done from my side.