How to trigger ADC at a specific point during the ON period of PWM in STM32F303ZE?
Hello,
I am currently working on sensorless PI control for a BLDC motor, and I am using the STM32F303ZE MCU for this project.
In sensorless BLDC motor control, the motor must transition to the next commutation step 30 electrical degrees after the zero-crossing point (ZCP) of the unenergized phase’s Back EMF (BEMF). Therefore, I need to continuously monitor the BEMF of each phase using the ADC.
For my BLDC motor control strategy, I am implementing a unipolar PWM modulation technique. During the ON period of PWM, I need to sample the BEMF voltage, DC bus voltage, and DC bus current. Specifically, I want the ADC conversion to occur at around 90% of the ON duration of the PWM cycle.
However, since the duty cycle of the PWM is constantly changing due to the PI controller, the ADC must always trigger at the dynamically changing 90% point of the ON period.
My questions:
How can I configure the STM32F303ZE to trigger the ADC conversion at 90% of the ON duration of PWM?
Is it possible to achieve this without CPU intervention, using only register-level configurations (hardware-based solution)?
If register-based configuration is possible, which timer (TIM1 TRGO, TIMx, or any other peripheral) should be used, and how should I configure it?
I would appreciate any guidance, reference materials, or example code that could help me achieve this.
Thank you in advance!
