2025-09-17 10:55 AM
I have a custom board with a STM32G491 with a single-shunt driver for 6-step with hall effect sensors.
One of the motors I have has a hall sensor placement close to 120°. I followed the process described in documentation (section 3. "Setting up the system when using Hall-effect sensors" in "Hall sensor feedback processing" page) and the Hall delay, described as "the delay in electrical degrees between the maximum of the B-emf induced on phase A and the first rising edge of signal H1" was approximately 108°.
I used that value with v6.3.2 and I confirmed that current through motor phases was cleaner with 108° than with 120° (with both values rotating correctly)
When v6.4.0 came out I tried the same configuration. The motor only vibrated violently with either 120° or 108° for hall delay. I reported it in this forum and a code modification was suggested that eventually was included in v6.4.1. But that solution only fixed when Hall delay is aligned with 60° steps.
With v6.4.1:
There seems to be an issue with the way that STEP_SHIFT and PHASE_SHIFT_DEG are used.
If I understood hall sensor delay definition correctly, in a motor where hall delay is 130° instead of 120°, the step commutation should have been advanced 10 electrical degrees in forward direction and delayed 10 electrical degrees in backwards direction versus the 120° version, but in both of them it seems delayed.
I added a toggle to an output pin during the CC2 ISR handling (used when PHASE_SHIFT_DEG is not 0 to call SixStep_StepCommution()) and captured hall signals and that pin signal both in forward and backward:
Forward:
Backward:
In both directions the toggles are always approximately 10 electrical degrees from hall changes, but delayed in both cases.
I also confirmed that, instead of STEP_SHIFT = 1 and PHASE_SHIFT_DEG = 50, I manually set STEP_SHIFT = 3 and PHASE_SHIFT_DEG = 50, the motor rotates in forward direction with no vibration, with commutation 10 degrees below the commutation it would show with 120 (STEP_SHIFT = 2 and PHASE_SHIFT_DEG = 0)
This is why I think that the logic for the conversion from hall status to steps and that sets commutation and sets CC2 ISR is wrong, but I have not figured out how to fix it.