2025-05-30 7:37 AM
I have a custom board (G491) with a 1-shunt driver and Hall sensors I have been using with MCSDK 6.3.2 with no issue.
When I saw the Release Notes of 6.4.0 I decided to give it a try, I wanted to try out the current monitoring.
The workspace project was created from scratch with the same configuration as it worked on 6.3.2 (6-step, hall sensor as speed sensor), but, when I tried to start the motor, it didn't start. When I manually moved the shaft, speed control got crazy and started spinning at max speed.
In idle, I realized that the UI reports 30 rpm when not in movement. I can move the motor forward and it reports some speed but, if I turn it backwards, speed is reported as 30 rpm. HALL_EL_ANGLE register is stuck at 0, when it should change.
I went back to a nucleo-G431 with a IHM08M1 and a different motor, and the behavior is exactly the same.
It looks like the logic for the Hall sensor is broken.
Has anybody experienced anything like that?
2025-06-05 12:02 AM
Hi,
Same issue with me. Tested with NUCLEO-G431+IHM16M1+ PMSM with HALL.
Work perfectly with X-CUBE-MCSDK v6.3.2 but not working with the latest version.
Can't control the speed through GUI. When start, motor spin at full speed.
2025-06-05 9:42 AM
Hi All, one of the changes made into the new MCSDK WB 6.4.0, is the ability to choose the timer number used to catch the HALL inputs
By default, the timer selected is the Timer 2, that could be different of the one used into MCSDK WB 6.3.2.
Naturally, another timer choice will generate different PINs for the H1, H2 and H3 signals, and in consequence a problem of connection if boards have been modified in desoldering access to the unused HALL signal connections for example.
MCSDK WB 6.4.0 HALL timer setection
i.e IHM16M1 HALL possible connections
Best regards.
Fabrice
2025-06-06 3:11 AM
I checked and that's not the issue for me. In either my custom board or IHM08M1 the Hall inputs can only be connected to a timer so there is no choice.
In fact, I compared TIM3 initialization code (in my custom board Hall sensors are connected to TIM3) from the previous working project v6.3.2 and the new using v6.4.0 and there is no difference.
There is a minor difference in TIM3 initialization inside HALL_Init(, this might be a bug in v6.4.0 but I doubt it has relevance, ICF1 filter seems wrong:
/* Set IC filter for Channel 1 (ICF1). */
LL_TIM_IC_SetFilter(TIMx, LL_TIM_CHANNEL_CH1, (uint32_t)(pHandle->ICx_Filter) << 20U);
vs the old code in v6.3.2:
/* Set IC filter for Channel 1 (ICF1) */
LL_TIM_IC_SetFilter(TIMx, LL_TIM_CHANNEL_CH1, (uint32_t)(pHandle->ICx_Filter));
But mayor difference is the ISR management:
What should be the values of HALL_PHASE_SHIFT and PHASE_SHIFT_DEG when Hall sensor placement electrical angle (measured as described in the documentation) is 108 or 120 degrees?
2025-07-08 9:02 AM
Hi jovijuan, thank you for your post, we identify the problem, and a correction will be applied into the next version of the MCSDK.
Unfortunately, the configuration for the Placement electrical angle parameter HALL_PHASE_SHIFT has been set up for a specific HALL sensor (300 degrees). Besides, this parameter is not extract from the configuration defined into the MCSDK WB tool (stage motor).
The Placement electrical angle parameter HALL_PHASE_SHIFT is decomposed into two defines:
i.e. 120 degrees HALL_PHASE_SHIFT => STEP_SHIFT = 2 and PHASE_SHIFT_DEG = 0
i.e. 108 degrees HALL_PHASE_SHIFT => STEP_SHIFT = 1 and PHASE_SHIFT_DEG = 48
However, even if the HALL_PHASE_SHIFT is taken into account into the current MCSDK FW, the PHASE_SHIFT_DEG has a timer definition issue.
Then for a proper Placement electrical angle parameter setting, you can update your code with:
1. The two defines into drive_parameters.h
#define STEP_SHIFT (HALL_PHASE_SHIFT / 60) /*!< Number of steps (60 degrees) into the Placement electrical angle. */
#define PHASE_SHIFT_DEG (HALL_PHASE_SHIFT - (STEP_SHIFT * 60)) /*!< Number of degrees remaining after STEP_SHIFT. */
2. The corresponding HALL_PHASE_SHIFT value of your HALL sensor into pmsm_motor_parameters.h
i.e. #define HALL_PHASE_SHIFT 120
3. Update the management of the STEP_SHIFT parameter at the end of the function HALL_TIMx_CC_IRQHandler embedded into the file hall_speed_pos_fdbk_sixstep.c
...
if (0U == pHandle->PhaseShift)
{
LL_TIM_DisableIT_CC2(pHandle->TIMx);
}
else
{
/* Set the remaining degrees after STEP_SHIFT set up into HALL_State2Step. */
/* Compute the counter value % to speed vs 60 degrees (step). */
uint32_t PhaseShiftTemp = ((pHandle->PhaseShift * hHighSpeedCapture) / 60U);
LL_TIM_OC_SetCompareCH2(pHandle->TIMx, PhaseShiftTemp);
LL_TIM_EnableIT_CC2(pHandle->TIMx);
}
...
Best regards.
Fabrice