2025-05-17 9:06 AM
Hello!
I’m currently working on a sensorless 6-step BLDC motor control project using an STM32G474RE.
I implemented the full control flow based on ADC-DMA sampling, center-aligned PWM (TIM1), TIM2-based timing, and ZCP detection logic.
The control flow is as follows:
The motor enters an alignment phase with fixed high/low-side conduction.
It transitions to open-loop commutation for ~1 second.
Once enough steps have passed, I enable ZCP detection.
ZCP is detected when BEMF crosses Vbus/2 with correct polarity.
After ZCP, commutation is scheduled with a 30° electrical delay using TIM1 Channel 4 compare interrupt.
All ADC channels (BEMF_A/B/C, DCBV, DCBI, etc.) are configured correctly, DMA is working, and ZCP detection logic is being called.
However, the motor does not spin at all, even during open-loop startup.
Could someone review the attached code and let me know if there’s something wrong in how PWM, commutation, or ZCP triggering is being handled?
Thank you!